浏览代码

bug fix for quantization and empty dimensions

Alexander Freytag 9 年之前
父节点
当前提交
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 )