imsl.linalg.lu_factor_full

lu_factor_full(a)

Compute the LU decomposition of matrix A, PA=LU.

Parameters:a ((N,N) array_like) – Square matrix to be factorized.
Returns:
  • P ((N,N) ndarray) – A permutation matrix, matrix P in the factorization PA=LU.
  • L ((N,N) ndarray) – A unit lower triangular matrix, the L factor in the factorization PA=LU.
  • U ((N,N) ndarray) – An upper triangular matrix, the U factor in the factorization PA=LU.

Notes

Function lu_factor_full returns full matrices P, L and U that describe the LU factorization PA=LU. This is in contrast to function lu_factor which returns only a compressed form of the factorization.

Examples

>>> import numpy as np
>>> import imsl.linalg as la
>>> A = [[1.0, 3.0, 3.0], [1.0, 3.0, 4.0], [1.0, 4.0, 3.0]]
>>> P, L, U = la.lu_factor_full(A)
>>> print("P*A:\n"+str(np.dot(P,A))) 
P*A:
[[1. 3. 3.]
 [1. 4. 3.]
 [1. 3. 4.]]
>>> print("L*U:\n"+str(np.dot(L,U))) 
L*U:
[[1. 3. 3.]
 [1. 4. 3.]
 [1. 3. 4.]]