- add additional condition in svd helper to take into account rounding errors (#31)

Signed-off-by: Yurii <iuriish@yahoo.com>
master
Yurii Shyrma 2019-11-05 17:16:17 +02:00 committed by GitHub
parent 9124974e3b
commit 871f3bb3e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -469,7 +469,7 @@ void SVD<T>::calcSingVals(const NDArray& col0, const NDArray& diag, const NDArra
useBisection = true;
if (shift == right && (muCur < -(right - left) || muCur > (T)0.))
useBisection = true;
if (math::nd4j_abs<T>(fCur) > math::nd4j_abs<T>(fPrev))
if (math::nd4j_abs<T>(fCur) > math::nd4j_abs<T>(fPrev) && math::nd4j_abs<T>(fCur - fPrev) > (T)16. * DataTypeUtils::eps<T>())
useBisection = true;
}

View File

@ -466,7 +466,7 @@ void SVD<T>::calcSingVals(const NDArray& col0, const NDArray& diag, const NDArra
useBisection = true;
if (shift == right && (muCur < -(right - left) || muCur > (T)0.))
useBisection = true;
if (math::nd4j_abs<T>(fCur) > math::nd4j_abs<T>(fPrev))
if (math::nd4j_abs<T>(fCur) > math::nd4j_abs<T>(fPrev) && math::nd4j_abs<T>(fCur - fPrev) > (T)16. * DataTypeUtils::eps<T>())
useBisection = true;
}