fm_qinv {fmesher} | R Documentation |
Sparse partial inverse
Description
Compute sparse partial matrix inverse. As of 0.2.0.9010
, an R
implementation of the Takahashi recursion method, unless a special build of
the fmesher
package is used.
Usage
fm_qinv(A)
Arguments
A |
A sparse symmetric positive definite matrix |
Value
A sparse symmetric matrix, with the elements of the inverse of A
for the non-zero pattern of A
plus potential Cholesky in-fill locations.
Examples
A <- Matrix::Matrix(
c(2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2),
4,
4
)
# Partial inverse:
(S <- fm_qinv(A))
# Full inverse (not guaranteed to be symmetric):
(S2 <- solve(A))
# Matrix symmetry:
c(sum((S - Matrix::t(S))^2), sum((S2 - Matrix::t(S2))^2))
# Accuracy (not that S2 is non-symmetric, and S may be more accurate):
sum((S - S2)[S != 0]^2)
[Package fmesher version 0.5.0 Index]