lup.md (1045B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 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 ### Throws 29 30 Type | Description 31 ---- | ----------- 32 33 34 ## Examples 35 36 ```js 37 const m = [[2, 1], [1, 4]] 38 const r = math.lup(m) 39 // r = { 40 // L: [[1, 0], [0.5, 1]], 41 // U: [[2, 1], [0, 3.5]], 42 // P: [0, 1] 43 // } 44 ``` 45 46 47 ## See also 48 49 [slu](slu.md), 50 [lsolve](lsolve.md), 51 [lusolve](lusolve.md), 52 [usolve](usolve.md)