UNPKG

1.65 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function slu
4
5Calculate 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
13math.slu(A, order, threshold)
14```
15
16### Parameters
17
18Parameter | 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
26Type | Description
27---- | -----------
28Object | The lower triangular matrix, the upper triangular matrix and the permutation vectors.
29
30
31## Examples
32
33```js
34const A = math.sparse([[4,3], [6, 3]])
35math.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)