Skip to content

num::inverse_diagonal

Defined in header <linear/factorization/inverse_diagonal.hpp>, <linear/factorization/probed_inverse_diagonal.hpp>, <linear/factorization/reuse.hpp>

template <sized_factorization F>
void inverse_diagonal(const F &factor, vec<real> &result,
                      inverse_diagonal_workspace &workspace, idx block_size = 64);  // (1)

template <sized_factorization F>
vec<real> inverse_diagonal(const F &factor, idx block_size = 64);  // (2)

vec<real> inverse_diagonal(const spmat &matrix, view<const real> symmetrizer,
                           inverse_diagonal_options options = {});  // (3)

vec<real> inverse_diagonal(const spmat &matrix, view<const real> symmetrizer,
                           const grounded_approx_chol_factor &approximate,
                           inverse_diagonal_options options = {});  // (4)

template <factorization F>
vec<real> inverse_diagonal(const F &factor, const spmat &matrix,
                           view<const real> symmetrizer = {},
                           inverse_diagonal_options options = {});  // (5)

friend vec<real> inverse_diagonal(const corrected_factor &Z, idx n);  // (6)

(1) Compute the diagonal of the inverse from a factorization, by blocks of identity columns: \(\mathrm{diag}(A^{-1})\).

(2) Compute the diagonal of the inverse from a factorization: \(\mathrm{diag}(A^{-1})\). Allocates.

(3) Estimate the diagonal of the inverse of an M-matrix from random probes and Lanczos: \(\mathrm{diag}(A^{-1})\).

(4) Estimate the diagonal of the inverse of a reversible M-matrix, reusing an approximate factor.

(5) Estimate the diagonal of the inverse from random probes: \((A^{-1})_{jj} \approx \frac{1}{p} \sum_k (R z_k)_j^2\). symmetrizer is \(\sqrt{\pi}\) when \(A\) is symmetrizable by it, else empty.

(6) Undocumented.

Exceptions

  • std::invalid_argument: If no probes are requested.
  • std::runtime_error: If matrix is not a nonsingular M-matrix.