slu.md (1702B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 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 ### Throws 32 33 Type | Description 34 ---- | ----------- 35 36 37 ## Examples 38 39 ```js 40 const A = math.sparse([[4,3], [6, 3]]) 41 math.slu(A, 1, 0.001) 42 // returns: 43 // { 44 // L: [[1, 0], [1.5, 1]] 45 // U: [[4, 3], [0, -1.5]] 46 // p: [0, 1] 47 // q: [0, 1] 48 // } 49 ``` 50 51 52 ## See also 53 54 [lup](lup.md), 55 [lsolve](lsolve.md), 56 [usolve](usolve.md), 57 [lusolve](lusolve.md)