mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
47 lines
992 B
Markdown
47 lines
992 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
# Function lup
|
|
|
|
Calculate the Matrix LU decomposition with partial pivoting. Matrix `A` is decomposed in two matrices (`L`, `U`) and a
|
|
row permutation vector `p` where `A[p,:] = L * U`
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.lup(A);
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`A` | Matrix | Array | A two dimensional matrix or array for which to get the LUP decomposition.
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
{L: Array | Matrix, U: Array | Matrix, P: Array.<number>} | The lower triangular matrix, the upper triangular matrix and the permutation matrix.
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
var m = [[2, 1], [1, 4]];
|
|
var r = math.lup(m);
|
|
// r = {
|
|
// L: [[1, 0], [0.5, 1]],
|
|
// U: [[2, 1], [0, 3.5]],
|
|
// P: [0, 1]
|
|
// }
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[slu](slu.md),
|
|
[lsolve](lsolve.md),
|
|
[lusolve](lusolve.md),
|
|
[usolve](usolve.md)
|