|
@@ -1377,10 +1377,8 @@ void FastMinKernel::hikComputeKVNApproximation(const NICE::VVector & _A,
|
|
|
position--;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
double firstPart(0.0);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if ( !posIsZero && ((position-nrZeroIndices) < this->ui_n) )
|
|
|
firstPart = (_A[dim][position-nrZeroIndices]);
|
|
|
|
|
@@ -1390,15 +1388,16 @@ void FastMinKernel::hikComputeKVNApproximation(const NICE::VVector & _A,
|
|
|
|
|
|
fval = fval * fval;
|
|
|
|
|
|
- double secondPart( 0.0);
|
|
|
+
|
|
|
+ double secondPart( this->ui_n-nrZeroIndices-1 );
|
|
|
|
|
|
- if ( !posIsZero )
|
|
|
- secondPart = fval * (this->ui_n-nrZeroIndices-(position+1));
|
|
|
- else
|
|
|
- secondPart = fval * (this->ui_n-nrZeroIndices);
|
|
|
+ if ( !posIsZero && (position >= nrZeroIndices) )
|
|
|
+ {
|
|
|
+ secondPart = (position-nrZeroIndices);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- _norm += firstPart + secondPart;
|
|
|
+ _norm += firstPart + secondPart* fval;
|
|
|
}
|
|
|
}
|
|
|
|