矩阵求逆还是Cholesky? [英] Matrix inversion or Cholesky?
问题描述
我正在开发一种解决 Ax = b 的算法,其中已知 A 和 b .
I am developing an algorithm which solves Ax= b, where A and b are known.
有两种方法可以执行 x = A -1 b 或使用Cholesky.我知道矩阵将始终是正方形且为正定,尽管det( A )可能为零.在极少数情况下,我可以忽略它.但是从计算和效率的角度来看,创建逆矩阵是否效率太低?
There are two ways to do this x= A-1 b or using Cholesky. I know the matrix will always be square and positive definite although the det(A) maybe zero. In those rare cases I can just ignore it. But from a computation point of view and efficiency, is creating an inverse matrix too inefficient?
推荐答案
通常,您总是想使用求解器.实际求解器的运行速度应与乘以逆运算的速度一样快.与进行分解相比,计算逆矩阵不仅效率低下,而且使用逆矩阵还具有可避免分解/求解器方法的精度问题.
In general, you always want to use a solver; the actual solver should run about as fast as multiplying by an inverse. Not only is computing an inverse matrix inefficient compared to doing a decomposition, using an inverse matrix has precision problems that a decompose/solver approach avoids.
如果您有对称矩阵,那么 Cholesky分解是一个合理的选择.密切相关的 LDL分解具有相当的精度,同时还避免了平方根的需要.
If you have a symmetric matrix, a Cholesky decomposition is a reasonable choice. The closely-related LDL decomposition has comparable precision, while also avoiding the need for square roots.
如果矩阵不对称,则不能使用Cholesky或LDL分解-使用 LU分解方法.
If your matrix is not symmetric, you can't use Cholesky or LDL decompositions -- use the LU decomposition method instead.
这篇关于矩阵求逆还是Cholesky?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!