|
From: andre m. <and...@gm...> - 2024-01-10 01:10:27
|
Hi list, this one from Michel Talon's post on the bird algorithm caught my attention. So I did some quick tests, mostly for checking that invert_by_lu, which I use a lot, is not affected. See the output below, my file is attached. One can see the matrices from the P.L.U decomposition don't have issues. But determinant_by_lu for the permutation matrix looks to be broken. Is this a known defect/bug? Regards Andre -------------------------- Maxima 5.45.1 https://maxima.sourceforge.io using Lisp SBCL 2.0.1-8.fc36 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) batch("detbylu.mac") read and interpret /home/user/detbylu.mac (%i2) display2d:false (%o2) false (%i3) A:matrix([1,0,-1,-1],[-1,0,1,-1],[0,0,-1,1],[1,-1,0,1]) (%o3) matrix([1,0,-1,-1],[-1,0,1,-1],[0,0,-1,1],[1,-1,0,1]) (%i4) determinant(A) (%o4) 2 (%i5) determinant_by_lu(A) (%o5) -2 (%i6) Ainv:invert_by_lu(A) (%o6) matrix([0,-1,-1,0],[-1/2,-3/2,-1,-1],[-1/2,-1/2,-1,0],[-1/2,-1/2,0,0]) (%i7) Ainv . A (%o7) matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]) (%i8) determinant(Ainv) (%o8) 1/2 (%i9) determinant_by_lu(Ainv) (%o9) -1/2 (%i10) [P,L,U]:get_lu_factors(lu_factor(A)) (%o10) [matrix([1,0,0,0],[0,0,0,1],[0,0,1,0],[0,1,0,0]),matrix([1,0,0,0],[1,1,0,0],[0,0,1,0],[-1,0,0,1]),matrix([1,0,-1,-1],[0,-1,1,2],[0,0,-1,1],[0,0,0,-2])] (%i11) M:P . L . U-A (%o11) matrix([0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]) (%i12) P (%o12) matrix([1,0,0,0],[0,0,0,1],[0,0,1,0],[0,1,0,0]) (%i13) determinant(P) (%o13) -1 (%i14) determinant_by_lu(P) (%o14) 1 (%i15) L (%o15) matrix([1,0,0,0],[1,1,0,0],[0,0,1,0],[-1,0,0,1]) (%i16) determinant(L) (%o16) 1 (%i17) determinant_by_lu(L) (%o17) 1 (%i18) U (%o18) matrix([1,0,-1,-1],[0,-1,1,2],[0,0,-1,1],[0,0,0,-2]) (%i19) determinant(U) (%o19) -2 (%i20) determinant_by_lu(U) (%o20) -2 (%i21) B:matrix([1,0,0,0],[0,0,0,1],[0,0,1,0],[0,1,0,0]) (%o21) matrix([1,0,0,0],[0,0,0,1],[0,0,1,0],[0,1,0,0]) (%i22) determinant(B) (%o22) -1 (%i23) determinant_by_lu(B) (%o23) 1 (%o24) "/home/user/detbylu.mac" ------------------------------- |