mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
62 lines
2.1 KiB
Markdown
62 lines
2.1 KiB
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
<h1 id="function-slu">Function slu <a href="#function-slu" title="Permalink">#</a></h1>
|
|
|
|
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
|
|
|
|
`P * A * Q = L * U`
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.slu(A, order, threshold)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`A` | SparseMatrix | A two dimensional sparse matrix for which to get the LU decomposition.
|
|
`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.
|
|
`threshold` | Number | Partial pivoting threshold (1 for partial pivoting)
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Object | The lower triangular matrix, the upper triangular matrix and the permutation vectors.
|
|
|
|
|
|
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
const A = math.sparse([[4,3], [6, 3]])
|
|
math.slu(A, 1, 0.001)
|
|
// returns:
|
|
// {
|
|
// L: [[1, 0], [1.5, 1]]
|
|
// U: [[4, 3], [0, -1.5]]
|
|
// p: [0, 1]
|
|
// q: [0, 1]
|
|
// }
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[lup](lup.html),
|
|
[lsolve](lsolve.html),
|
|
[usolve](usolve.html),
|
|
[lusolve](lusolve.html)
|