Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

LU matrix factorization

`[L,U] = lu(A)`

`[L,U,P] = lu(A)`

`[L,U,P] = lu(A,outputForm)`

`[L,U,P,Q] = lu(S)`

`[L,U,P,Q,D] = lu(S)`

`[___] = lu(S,thresh)`

`[___] = lu(___,outputForm)`

`[___] = lu(`

specifies thresholds for the pivoting strategy employed by
`S`

,`thresh`

)`lu`

using any of the previous output argument
combinations. Depending on the number of output arguments specified, the default
value and requirements for the `thresh`

input are different.
See the `thresh`

argument description for details.

`[___] = lu(___,`

returns `outputForm`

)`P`

and `Q`

in the form specified by
`outputForm`

. Specify `outputForm`

as
`'vector'`

to return `P`

and
`Q`

as permutation vectors. You can use any of the input
argument combinations in previous syntaxes.

The LU factorization is computed using a variant of Gaussian elimination. Computing an
accurate solution is dependent upon the value of the condition number of the original
matrix `cond(A)`

. If the matrix has a large condition number (it is
nearly singular), then the computed factorization might not be accurate.

The LU factorization is a key step in obtaining the inverse with
`inv`

and the determinant with `det`

. It is also
the basis for the linear equation solution or matrix division obtained with the
operators `\`

and `/`

. This necessarily means that the
numerical limitations of `lu`

are also present in these dependent
functions.