在 Eigen 库 Compute() 中执行 analyzePattern() 和 factorize() 的成本
The cost of performing analyzePattern() and factorize() in Eigen library Compute()
我指的是 Eigen 文档中的 The Compute Step 部分:
In the compute()
function, the matrix is generally factorized:
....
For this class of solvers precisely,
the compute step is further subdivided into analyzePattern()
and
factorize()
.
The goal of analyzePattern()
is to reorder the nonzero elements of the
matrix, such that the factorization step creates less fill-in. This
step exploits only the structure of the matrix. Hence, the results of
this step can be used for other linear systems where the matrix has
the same structure. ....
In factorize()
, the factors of the coefficient matrix are computed.
This step should be called each time the values of the matrix change.
However, the structural pattern of the matrix should not change
between multiple calls.
的文档
Compute the column permutation to minimize the fill-in
- Apply this permutation to the input matrix -
- Compute the column elimination tree on the permuted matrix
- Postorder the elimination tree and the column permutation
Numerical factorization Interleaved with the symbolic factorization On
exit, info is
= 0: successful factorization
0: if info = i, and i is
<= A->ncol: U(i,i) is exactly zero. The factorization has
been completed, but the factor U is exactly singular,
and division by zero will occur if it is used to solve a
system of equations.
A->ncol: number of bytes allocated when memory allocation
failure occurred, plus A->ncol. If lwork = -1, it is
the estimated amount of space needed, plus A->ncol.
我的问题是,我们知道调用 analyzePattern()
和 factorize()
的相对成本吗?
这个问题对我来说很重要,因为我的应用程序具有稳定的矩阵结构但不断变化的系数矩阵。示例:在 FEM 模型中,FEM 用户经常保持单元连接不变,但总是更改单元尺寸以获得最佳设计。
所以如果 analyzePattern()
比 factorize()
贵很多,那么我可以利用这个事实重写我的代码。如果不是,我可以坚持使用 compute()
函数并在每次元素大小更改时重新运行 analyzePattern()
。
这在很大程度上取决于矩阵的结构。根据我的经验,符号部分通常比数字部分便宜得多,但是,根据对此 的评论,有时情况恰恰相反。所以恐怕你永远不会确定,直到你替补。
我指的是 Eigen 文档中的 The Compute Step 部分:
的文档In the
compute()
function, the matrix is generally factorized:....
For this class of solvers precisely, the compute step is further subdivided into
analyzePattern()
andfactorize()
.The goal of
analyzePattern()
is to reorder the nonzero elements of the matrix, such that the factorization step creates less fill-in. This step exploits only the structure of the matrix. Hence, the results of this step can be used for other linear systems where the matrix has the same structure. ....In
factorize()
, the factors of the coefficient matrix are computed. This step should be called each time the values of the matrix change. However, the structural pattern of the matrix should not change between multiple calls.
Compute the column permutation to minimize the fill-in
- Apply this permutation to the input matrix -
- Compute the column elimination tree on the permuted matrix
- Postorder the elimination tree and the column permutation
Numerical factorization Interleaved with the symbolic factorization On exit, info is
= 0: successful factorization
0: if info = i, and i is
<= A->ncol: U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
A->ncol: number of bytes allocated when memory allocation failure occurred, plus A->ncol. If lwork = -1, it is the estimated amount of space needed, plus A->ncol.
我的问题是,我们知道调用 analyzePattern()
和 factorize()
的相对成本吗?
这个问题对我来说很重要,因为我的应用程序具有稳定的矩阵结构但不断变化的系数矩阵。示例:在 FEM 模型中,FEM 用户经常保持单元连接不变,但总是更改单元尺寸以获得最佳设计。
所以如果 analyzePattern()
比 factorize()
贵很多,那么我可以利用这个事实重写我的代码。如果不是,我可以坚持使用 compute()
函数并在每次元素大小更改时重新运行 analyzePattern()
。
这在很大程度上取决于矩阵的结构。根据我的经验,符号部分通常比数字部分便宜得多,但是,根据对此