函数 slu #

使用完全主元法计算稀疏矩阵的 LU 分解。稀疏矩阵 A 被分解为两个矩阵(LU)和两个置换向量(pinvq),其中

P * A * Q = L * U

Syntax #

math.slu(A, order, threshold)

Parameters #

Parameter Type Description
A SparseMatrix 一个二维稀疏矩阵,用于获取其 LU 分解。
order Number 符号排序和分析顺序: 0 - 自然排序,不返回置换向量 q。 1 - 矩阵必须是方阵,对 M = A + A' 进行符号排序和分析。 2 - 对 M = A' * A 进行符号排序和分析。丢弃 A' 中的稠密列,从 A' 重建 A。这适用于非对称矩阵的 LU 分解。 3 - 对 M = A' * A 进行符号排序和分析。当矩阵 M 没有稠密行时,这是 LU 分解的最佳选择。稠密行是指条目数超过 10*sqr(列数) 的行。
threshold Number 部分主元阈值(1 表示部分主元法)

Returns #

Type Description
Object 下三角矩阵、上三角矩阵和置换向量。

Throws #

Type | Description —- | ———–

Examples #

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]
// }

另请参阅 #

lup, lsolve, usolve, lusolve

Fork me on GitHub