src/search_engine/relja_retrival/external/KMCode_relja/descriptor/CSiftDescriptor.cpp
/* Normalize length of vec to 1.0.
*/
Normalize length of vec to 1.0.
Normalize length of vec to 1 . 0 .
void NormalizeCVect(float *vec, int len) 
{
   int i,roindex,oindex;
   float val, fac, sqlen = 0.0;
   sqlen = 0.0; 
   for(int r=0;r<CRadIndexSize;r++){
     roindex=r*COriSize;
     for(int o=0;o<COriSize;o++){ 
       oindex=(roindex+o)*CAngIndexSize;
       for(int c=0;c<CAngIndexSize;c++){
	 val=vec[oindex+c];
	 sqlen+=val*val;
       }
     }
   }
   fac=1.0 / (sqrt(sqlen));
   for(int r=0;r<CRadIndexSize;r++){
     roindex=r*COriSize;
     for(int o=0;o<COriSize;o++){
       oindex=(roindex+o)*CAngIndexSize;
       for(int c=0;c<CAngIndexSize;c++){
	 vec[oindex+c]*=fac;
       }
     }
   }
}
void NormalizeCVect ( float * vec , int len ) { int i , roindex , oindex ; float val , fac , sqlen = 0.0 ; sqlen = 0.0 ; for ( int r = 0 ; r < CRadIndexSize ; r ++ ) { roindex = r * COriSize ; for ( int o = 0 ; o < COriSize ; o ++ ) { oindex = ( roindex + o ) * CAngIndexSize ; for ( int c = 0 ; c < CAngIndexSize ; c ++ ) { val = vec [ oindex + c ] ; sqlen += val * val ; } } } fac = 1.0 / ( sqrt ( sqlen ) ) ; for ( int r = 0 ; r < CRadIndexSize ; r ++ ) { roindex = r * COriSize ; for ( int o = 0 ; o < COriSize ; o ++ ) { oindex = ( roindex + o ) * CAngIndexSize ; for ( int c = 0 ; c < CAngIndexSize ; c ++ ) { vec [ oindex + c ] *= fac ; } } } }
Normalize length of vec to 1.0.
Normalize length of vec to 1 . 0 .
/*     fac=1.0 / (sqrt(sqlen));
       for(int o=0;o<COriSize;o++){
       oindex=(roindex+o)*CAngIndexSize;
       for(int c=0;c<CAngIndexSize;c++){
	 vec[oindex+c]*=fac;
       }
       }
     */