Эх сурвалжийг харах

bug fix for quantization and empty dimensions

Alexander Freytag 9 жил өмнө
parent
commit
032424e268
1 өөрчлөгдсөн 5 нэмэгдсэн , 0 устгасан
  1. 5 0
      SortedVectorSparse.h

+ 5 - 0
SortedVectorSparse.h

@@ -260,6 +260,11 @@ template<class T> class SortedVectorSparse : NICE::Persistent{
                                      const bool & _getTransformedValue = false
                                    ) const
     {
+      if ( this->getNonZeros() == 0)
+      {
+        return  0.0;
+      }
+      
         uint idxDest ( round ( (this->getNonZeros() - 1) * _quantile)  );
         
         if ( _quantile > 0.5 )