| Download
All published worksheets from http://sagenb.org
Project: sagenb.org published worksheets
Views: 168733Image: ubuntu2004
Sage includes a copy of LAPACK (in the scipy library). Here we directly call LAPACK's DGETRF Fortran function to compute a PLU decomposition with partial pivoting. I do this so that you see how this is done with the industry-standard function for computing LU decompositions.
[10.0 2.0 3.0]
[ 3.0 4.0 6.0]
[ 2.0 8.0 10.0]
P:
[1 0 0]
[0 0 1]
[0 1 0]
L:
[ 1.0 0.0 0.0]
[ 0.2 1.0 0.0]
[ 0.3 0.447368421053 1.0]
U:
[ 10.0 2.0 3.0]
[ 0.0 7.6 9.4]
[ 0.0 0.0 0.894736842105]
[10.0 2.0 3.0]
[ 3.0 4.0 6.0]
[ 2.0 8.0 10.0]
Sage calls this function (through scipy) behind the scenes when you ask for an LU decomposition of a real double matrix.
[1.0 0.0 0.0]
[0.0 0.0 1.0]
[0.0 1.0 0.0]
[ 1.0 0.0 0.0]
[ 0.2 1.0 0.0]
[ 0.3 0.447368421053 1.0]
[ 10.0 2.0 3.0]
[ 0.0 7.6 9.4]
[ 0.0 0.0 0.894736842105]