From bacfd5b66d2cebb050cd5c2f2e31a54b72d864bc Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Thu, 13 May 2021 19:09:56 +0200 Subject: [PATCH] Fix error caused by round off issue in IE --- src/function/matrix/eigs/complexEigs.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/function/matrix/eigs/complexEigs.js b/src/function/matrix/eigs/complexEigs.js index d513181e5..8150d0a8c 100644 --- a/src/function/matrix/eigs/complexEigs.js +++ b/src/function/matrix/eigs/complexEigs.js @@ -404,12 +404,13 @@ export function createComplexEigs ({ addScalar, subtract, flatten, multiply, mul for (const λ of values) { const i = indexOf(uniqueValues, λ, equal) - // a dirty trick that helps us find more vectors - // TODO with iterative algorithm this can be removed - const roundedλ = round(λ, subtract(-1, log10(prec))) - if (i === -1) { - uniqueValues.push(roundedλ) + // a dirty trick that helps us find more vectors + // TODO with iterative algorithm this can be removed + // Note: the round around log10 is needed to prevent rounding off errors in IE + const rounded = round(λ, subtract(-1, round(log10(prec)))) + + uniqueValues.push(rounded) multiplicities.push(1) } else { multiplicities[i] += 1