UNPKG

993 BMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function lup
4
5Calculate the Matrix LU decomposition with partial pivoting. Matrix `A` is decomposed in two matrices (`L`, `U`) and a
6row permutation vector `p` where `A[p,:] = L * U`
7
8
9## Syntax
10
11```js
12math.lup(A)
13```
14
15### Parameters
16
17Parameter | Type | Description
18--------- | ---- | -----------
19`A` | Matrix &#124; Array | A two dimensional matrix or array for which to get the LUP decomposition.
20
21### Returns
22
23Type | Description
24---- | -----------
25{L: Array &#124; Matrix, U: Array &#124; Matrix, P: Array.&lt;number&gt;} | The lower triangular matrix, the upper triangular matrix and the permutation matrix.
26
27
28## Examples
29
30```js
31const m = [[2, 1], [1, 4]]
32const 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)