Skip to content

num::inverse_diagonal

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

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

void inverse_diagonal(const cholesky_result &factor, vec<real> &result,
                      inverse_diagonal_workspace &workspace, idx block_size = 64);  // (2)

void inverse_diagonal(const klu_factorization &factor, vec<real> &result,
                      inverse_diagonal_workspace &workspace, idx block_size = 64);  // (3)

void inverse_diagonal(const auto_linear_solver &factor, vec<real> &result,
                      inverse_diagonal_workspace &workspace, idx block_size = 64);  // (4)

vec<real> inverse_diagonal(const auto_linear_solver &factor, idx block_size = 64);  // (5)

template <class F>
vec<real> inverse_diagonal(const F &Z, idx n);  // (6)

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

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

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

(1) Compute diag(A^-1) through blocked identity solves.

(2) Compute diag(A^-1) from a Cholesky factor using blocked identity solves.

(3) Compute diag(A^-1) from a KLU factor using blocked identity solves.

(4) Compute diag(A^-1) from an automatically selected reusable factor.

(5) Convenience overload owning its result and workspace.

Allocates; prefer the workspace form in hot loops.

(6) Undocumented.

(7) Estimate the inverse diagonal of a reversible nonsingular M-matrix.

The supplied similarity weights make the problem symmetric, so this path uses only an approximate Cholesky factor, Gaussian probes, and inverse-square-root Lanczos actions.

(8) Reuse an approximate Cholesky factor of the symmetrized grounded matrix.

(9) Estimate \(\operatorname{diag}(A^{-1})\) for a nonsingular M-matrix from one block of Gaussian probes, without one solve per entry.

A diagonal similarity makes the symmetric part positive definite, so each entry is a squared row norm, estimated without bias by the probe mean square.

Parameters

  • factor: A retained factorization of matrix.
  • matrix: The nonsingular M-matrix A, in CSR form.
  • symmetrizer: \(\sqrt{\pi}\) when A is similar to a symmetric matrix through \(\operatorname{Diag}(\sqrt{\pi})\), which saves the two scaling solves. Empty otherwise.
  • options: Probe count, Krylov depth, tolerance, and seed.

Exceptions

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