<< linalg_factorlu linalg linalg_gaussnaive >>

linalg >> linalg > linalg_factorlupivot

linalg_factorlupivot

Computes the LU decomposition with pivoting.

Calling Sequence

[L, U, P] = linalg_factorlupivot ( A )
[L, U, P] = linalg_factorlupivot ( A , verbose )

Parameters

A :

a n-by-n matrix of doubles

verbose :

a 1-by-1 matrix of boolean (default verbose=%f), set to %t to display intermediate messages

L :

a n-by-n matrix of doubles, lower triangular.

U :

a n-by-n matrix of doubles, upper triangular.

P :

a n-by-n matrix of doubles, with 0 or 1 entries

Description

Decomposes A as P*A = L*U with L lower triangular and unit diagonal, U upper triangular and non-unit diagonal, P a permutation matrix with 0/1 entries. This algorithm might be sensitive to inaccuracies if A near singular. There is no solution is A is singular. If A is not ill-conditionned, the algorithm is accurate. Uses an effective algorithm with vectorization.

Examples

A=[
1.d-8 1
1     1
];
[L,U,P]=linalg_factorlupivot(A)
Lexpected=[
1.    0
1.d-8 1.
]
Uexpected=[
1     1
0     1 - 1.d-8
]
Pexpected=[
0 1
1 0
]
// See what happens
[L,U,P]=linalg_factorlupivot(A,%t)

// See the algorithm
edit linalg_factorlupivot

Authors


Report an issue
<< linalg_factorlu linalg linalg_gaussnaive >>