You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Invert the diagonal values in 'e'. If a value is zero, do
* nothing to it. */
zsl_mtx_get(&e, g, g, &x);
if ((x<epsilon) || (x>-epsilon)) {
x=1 / x;
zsl_mtx_set(&e, g, g, x);
}
In the if statement on line 1788, x > -epsilon always evaluates to true when x is 0 because epsilon is equal to 1e-6 and 0 is always bigger than -1e-6. This causes an incorrect output matrix with infinity values since 0 should be ignored.
I changed line 1788 to the below code to fix this issue: if (((x < epsilon) || (x > -epsilon)) && x != 0) {
The text was updated successfully, but these errors were encountered:
zscilib/src/matrices.c
Lines 1785 to 1791 in 34c3432
In the if statement on line 1788,
x > -epsilon
always evaluates to true when x is 0 because epsilon is equal to 1e-6 and 0 is always bigger than -1e-6. This causes an incorrect output matrix with infinity values since 0 should be ignored.I changed line 1788 to the below code to fix this issue:
if (((x < epsilon) || (x > -epsilon)) && x != 0) {
The text was updated successfully, but these errors were encountered: