cmatrix.Matrix.LU¶
- Matrix.LU()¶
Realize a LU decomposition from the self Matrix. If the self matrix contain some 0, they are automatiquely replaced with 1
- Returns
- tuple Matrix
A tuple containing the Lower and Upper matrix computed. To restore the origial self matrix, compute U*L
See also
Examples
>>> m=rand(6) >>> print(m) | +19.000 | +8.000 | +18.000 | +6.000 | +4.000 | +30.000 | | +1.000 | +28.000 | +12.000 | +32.000 | +33.000 | +35.000 | | +0.000 | +7.000 | +16.000 | +35.000 | +10.000 | +28.000 | | +25.000 | +11.000 | +16.000 | +17.000 | +30.000 | +30.000 | | +27.000 | +4.000 | +18.000 | +6.000 | +2.000 | +31.000 | | +6.000 | +34.000 | +16.000 | +11.000 | +9.000 | +22.000 | printed >>> L,U=m.LU() >>> print(L) | +1.000 | +0.000 | +0.000 | +0.000 | +0.000 | +0.000 | | +0.053 | +1.000 | +0.000 | +0.000 | +0.000 | +0.000 | | +0.053 | +0.239 | +1.000 | +0.000 | +0.000 | +0.000 | | +1.316 | +0.017 | -0.634 | +1.000 | +0.000 | +0.000 | | +1.421 | -0.267 | -0.373 | +0.623 | +1.000 | +0.000 | | +0.316 | +1.141 | -0.185 | -0.855 | +0.756 | +1.000 | printed >>> print(U) | +19.000 | +8.000 | +18.000 | +6.000 | +4.000 | +30.000 | | +0.000 | +27.579 | +11.053 | +31.684 | +32.789 | +33.421 | | +0.000 | +0.000 | +12.416 | +27.126 | +1.968 | +18.448 | | +0.000 | +0.000 | +0.000 | +25.764 | +25.421 | +1.652 | | +0.000 | +0.000 | +0.000 | +0.000 | -10.023 | +3.142 | | +0.000 | +0.000 | +0.000 | +0.000 | +0.000 | -23.164 | printed >>> print(U*L) | +19.000 | +8.000 | +18.000 | +6.000 | +4.000 | +30.000 | | +1.000 | +28.000 | +12.000 | +32.000 | +33.000 | +35.000 | | +1.000 | +7.000 | +16.000 | +35.000 | +10.000 | +28.000 | | +25.000 | +11.000 | +16.000 | +17.000 | +30.000 | +30.000 | | +27.000 | +4.000 | +18.000 | +6.000 | +2.000 | +31.000 | | +6.000 | +34.000 | +16.000 | +11.000 | +9.000 | +22.000 |