1 |
|
2 |
|
3 | # Function lup
|
4 |
|
5 | Calculate the Matrix LU decomposition with partial pivoting. Matrix `A` is decomposed in two matrices (`L`, `U`) and a
|
6 | row permutation vector `p` where `A[p,:] = L * U`
|
7 |
|
8 |
|
9 | ## Syntax
|
10 |
|
11 | ```js
|
12 | math.lup(A)
|
13 | ```
|
14 |
|
15 | ### Parameters
|
16 |
|
17 | Parameter | Type | Description
|
18 | --------- | ---- | -----------
|
19 | `A` | Matrix | Array | A two dimensional matrix or array for which to get the LUP decomposition.
|
20 |
|
21 | ### Returns
|
22 |
|
23 | Type | Description
|
24 | ---- | -----------
|
25 | {L: Array | Matrix, U: Array | Matrix, P: Array.<number>} | The lower triangular matrix, the upper triangular matrix and the permutation matrix.
|
26 |
|
27 |
|
28 | ## Examples
|
29 |
|
30 | ```js
|
31 | const m = [[2, 1], [1, 4]]
|
32 | const r = math.lup(m)
|
33 | // r = {
|
34 | // L: [[1, 0], [0.5, 1]],
|
35 | // U: [[2, 1], [0, 3.5]],
|
36 | // P: [0, 1]
|
37 | // }
|
38 | ```
|
39 |
|
40 |
|
41 | ## See also
|
42 |
|
43 | [slu](slu.md),
|
44 | [lsolve](lsolve.md),
|
45 | [lusolve](lusolve.md),
|
46 | [usolve](usolve.md)
|