Menu

#4961 lu_factor and determinant_by_lu treat a uniformly small float matrix as zero

None
open
nobody
5
16 hours ago
16 hours ago
No

determinant_by_lu of a matrix with entries around 1e-20 returns -6.0e-40 instead of -2.0e-40, and lu_factor returns the input unfactored

Maxima 5.49post, SBCL 2.6.7.

Scaling the identical matrix up by 1e20 and scaling the answer back gives the right value, so nothing about the data is ill-conditioned.

(%i1) display2d:false$
(%i2) load(linearalgebra)$
(%i3) S: matrix([1.0e-20,2.0e-20],[3.0e-20,4.0e-20])$
(%i4) determinant_by_lu(S,'floatfield);
(%o4) -6.0e-40
(%i5) determinant_by_lu(1e20*S,'floatfield)/1e40;
(%o5) -2.000000000000001e-40
(%i6) lu_factor(S,'floatfield)[1];
(%o6) matrix([1.0e-20,2.0e-20],[3.0e-20,4.0e-20])

Expected: (%o4) = -2.0e-40 as in (%o5), and (%o6) should be a factored matrix, not the input.

The exact determinant of the rationalized entries confirms -2.0e-40. The zero test used by 'floatfield appears to be absolute rather than relative.

Discussion


Log in to post a comment.