소스 검색

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 )