1 |
|
2 |
|
3 | # Function slu
|
4 |
|
5 | Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix `A` is decomposed in two matrices (`L`, `U`) and two permutation vectors (`pinv`, `q`) where
|
6 |
|
7 | `P * A * Q = L * U`
|
8 |
|
9 |
|
10 | ## Syntax
|
11 |
|
12 | ```js
|
13 | math.slu(A, order, threshold)
|
14 | ```
|
15 |
|
16 | ### Parameters
|
17 |
|
18 | Parameter | Type | Description
|
19 | --------- | ---- | -----------
|
20 | `A` | SparseMatrix | A two dimensional sparse matrix for which to get the LU decomposition.
|
21 | `order` | Number | The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'. This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with more than 10*sqr(columns) entries.
|
22 | `threshold` | Number | Partial pivoting threshold (1 for partial pivoting)
|
23 |
|
24 | ### Returns
|
25 |
|
26 | Type | Description
|
27 | ---- | -----------
|
28 | Object | The lower triangular matrix, the upper triangular matrix and the permutation vectors.
|
29 |
|
30 |
|
31 | ## Examples
|
32 |
|
33 | ```js
|
34 | const A = math.sparse([[4,3], [6, 3]])
|
35 | math.slu(A, 1, 0.001)
|
36 | // returns:
|
37 | // {
|
38 | // L: [[1, 0], [1.5, 1]]
|
39 | // U: [[4, 3], [0, -1.5]]
|
40 | // p: [0, 1]
|
41 | // q: [0, 1]
|
42 | // }
|
43 | ```
|
44 |
|
45 |
|
46 | ## See also
|
47 |
|
48 | [lup](lup.md),
|
49 | [lsolve](lsolve.md),
|
50 | [usolve](usolve.md),
|
51 | [lusolve](lusolve.md)
|