Răsfoiți Sursa

removed obsolete quantization.size() method

Alexander Freytag 9 ani în urmă
părinte
comite
a053227025

+ 2 - 2
FMKGPHyperparameterOptimization.cpp

@@ -2320,7 +2320,7 @@ void FMKGPHyperparameterOptimization::store ( std::ostream & _os,
     {
     {
       int sizeOfLUT ( 0 );
       int sizeOfLUT ( 0 );
       if ( q != NULL )
       if ( q != NULL )
-        sizeOfLUT = q->size() * this->fmk->get_d();
+        sizeOfLUT = q->getNumberOfBins() * this->fmk->get_d();
       _os << "SizeOfLUTs: " << sizeOfLUT << std::endl;      
       _os << "SizeOfLUTs: " << sizeOfLUT << std::endl;      
       for ( std::map< uint, double * >::const_iterator it = this->precomputedT.begin(); it != this->precomputedT.end(); it++ )
       for ( std::map< uint, double * >::const_iterator it = this->precomputedT.begin(); it != this->precomputedT.end(); it++ )
       {
       {
@@ -2461,7 +2461,7 @@ void FMKGPHyperparameterOptimization::store ( std::ostream & _os,
       _os << "NOTNULL" << std::endl;
       _os << "NOTNULL" << std::endl;
       int sizeOfLUT ( 0 );
       int sizeOfLUT ( 0 );
       if ( q != NULL )
       if ( q != NULL )
-        sizeOfLUT = q->size() * this->fmk->get_d();
+        sizeOfLUT = q->getNumberOfBins() * this->fmk->get_d();
       
       
       _os << sizeOfLUT << std::endl;
       _os << sizeOfLUT << std::endl;
       for ( int i = 0; i < sizeOfLUT; i++ )
       for ( int i = 0; i < sizeOfLUT; i++ )

+ 6 - 6
FastMinKernel.cpp

@@ -604,7 +604,7 @@ void FastMinKernel::hik_kernel_multiply_fast(const double *_Tlookup,
       const SortedVectorSparse<double>::dataelement & de = i->second;
       const SortedVectorSparse<double>::dataelement & de = i->second;
       uint feat = de.first;
       uint feat = de.first;
       uint qBin = _q->quantize( i->first, dim );
       uint qBin = _q->quantize( i->first, dim );
-      _beta[feat] += _Tlookup[dim*_q->size() + qBin];
+      _beta[feat] += _Tlookup[dim*_q->getNumberOfBins() + qBin];
     }
     }
   }
   }
 
 
@@ -780,7 +780,7 @@ void FastMinKernel::hik_kernel_sum_fast(const double *_Tlookup,
     double v = _xstar[dim];
     double v = _xstar[dim];
     uint qBin = _q->quantize( v, dim );
     uint qBin = _q->quantize( v, dim );
     
     
-    _beta += _Tlookup[dim*_q->size() + qBin];
+    _beta += _Tlookup[dim*_q->getNumberOfBins() + qBin];
   }
   }
 }
 }
 
 
@@ -801,7 +801,7 @@ void FastMinKernel::hik_kernel_sum_fast(const double *_Tlookup,
     double v = i->second;
     double v = i->second;
     uint qBin = _q->quantize( v, dim );
     uint qBin = _q->quantize( v, dim );
     
     
-    _beta += _Tlookup[dim*_q->size() + qBin];
+    _beta += _Tlookup[dim*_q->getNumberOfBins() + qBin];
   }
   }
 }
 }
 
 
@@ -826,7 +826,7 @@ double *FastMinKernel::solveLin(const NICE::Vector & _y,
   bool verboseMinimal ( false );
   bool verboseMinimal ( false );
 
 
   // number of quantization bins
   // number of quantization bins
-  uint hmax = _q->size();
+  uint hmax = _q->getNumberOfBins();
   
   
   NICE::Vector diagonalElements(_y.size(),0.0);
   NICE::Vector diagonalElements(_y.size(),0.0);
   this->X_sorted.hikDiagonalElements(diagonalElements);
   this->X_sorted.hikDiagonalElements(diagonalElements);
@@ -1426,7 +1426,7 @@ void FastMinKernel::hikComputeKVNApproximationFast(const double *_Tlookup,
     // nonetheless, the lookup table was created using the parameterized function    
     // nonetheless, the lookup table was created using the parameterized function    
     uint qBin = _q->quantize( v, dim );
     uint qBin = _q->quantize( v, dim );
     
     
-    _norm += _Tlookup[dim*_q->size() + qBin];
+    _norm += _Tlookup[dim*_q->getNumberOfBins() + qBin];
   }  
   }  
 }
 }
 
 
@@ -1569,7 +1569,7 @@ void FastMinKernel::hikComputeKVNApproximationFast(const double *_Tlookup,
     // nonetheless, the lookup table was created using the parameterized function    
     // nonetheless, the lookup table was created using the parameterized function    
     uint qBin = _q->quantize( v, dim );
     uint qBin = _q->quantize( v, dim );
     
     
-    _norm += _Tlookup[dim*_q->size() + qBin];
+    _norm += _Tlookup[dim*_q->getNumberOfBins() + qBin];
   }  
   }  
 }
 }
 
 

+ 0 - 5
quantization/Quantization.cpp

@@ -26,11 +26,6 @@ Quantization::~Quantization()
 {
 {
 }
 }
 
 
-uint Quantization::size() const
-{
-  return this->ui_numBins;
-}
-
 uint Quantization::getNumberOfBins() const
 uint Quantization::getNumberOfBins() const
 {
 {
   return this->ui_numBins;
   return this->ui_numBins;

+ 0 - 1
quantization/Quantization.h

@@ -68,7 +68,6 @@ class Quantization  : public NICE::Persistent
   /**
   /**
   * @brief get the size of the vocabulary, i.e. the number of bins
   * @brief get the size of the vocabulary, i.e. the number of bins
   */
   */
-  virtual uint size() const;
   virtual uint getNumberOfBins() const;  
   virtual uint getNumberOfBins() const;  
 
 
   /**
   /**

+ 5 - 5
tests/TestFastHIK.cpp

@@ -609,7 +609,7 @@ void TestFastHIK::testLUTUpdate()
   }
   }
   
   
   
   
-  bool equal = compareLUTs(T, TNew, q->size()*d, 10e-8);
+  bool equal = compareLUTs(T, TNew, q->getNumberOfBins()*d, 10e-8);
   
   
   if (verbose)
   if (verbose)
   {
   {
@@ -618,16 +618,16 @@ void TestFastHIK::testLUTUpdate()
     else
     else
     {
     {
       std::cerr << "T are not equal :( " << std::endl;
       std::cerr << "T are not equal :( " << std::endl;
-      for (uint i = 0; i < q->size()*d; i++)
+      for (uint i = 0; i < q->getNumberOfBins()*d; i++)
       {
       {
-        if ( (i % q->size()) == 0)
+        if ( (i % q->getNumberOfBins()) == 0)
           std::cerr << std::endl;
           std::cerr << std::endl;
         std::cerr << T[i] << " ";
         std::cerr << T[i] << " ";
       }
       }
       std::cerr << "TNew: "<< std::endl;
       std::cerr << "TNew: "<< std::endl;
-      for (uint i = 0; i < q->size()*d; i++)
+      for (uint i = 0; i < q->getNumberOfBins()*d; i++)
       {
       {
-        if ( (i % q->size()) == 0)
+        if ( (i % q->getNumberOfBins()) == 0)
           std::cerr << std::endl;
           std::cerr << std::endl;
         std::cerr << TNew[i] << " ";
         std::cerr << TNew[i] << " ";
       }     
       }