sparsax.umf_logdet

sparsax.umf_logdet(Ai, Aj, Ax, n)[source]

Log-determinant of a general (non-symmetric) sparse matrix via UMFPACK.

The UMFPACK counterpart of lu_logdet(), and the reason this backend carries a logdet at all: umfpack_*_get_determinant returns the determinant of A directly from the LU factors and permutations, in mantissa/exponent form. lu_logdet() has to reconstruct the same quantity from U’s diagonal and the row scale factors as a sum of n logarithms; both are overflow-safe, but UMFPACK’s accumulates no rounding over n terms and is the more accurate at large n. This is the SAR Jacobian log|I - rho W| for a directed W.

Shares the per-pattern LRU factor cache with umf_solve(), so an umf_solve and an umf_logdet at identical values factorize once.

Not differentiable — the non-symmetric logdet gradient is the full selected inverse, which neither LU backend exposes. Use logdet() for symmetric A when a gradient is needed.

Parameters:
Ai

[n_nz] int32 — COO row/column indices (full matrix, no upper-triangle folding).

Aj

[n_nz] int32 — COO row/column indices (full matrix, no upper-triangle folding).

Ax

[n_nz] float64 — COO values. Duplicates are summed.

n

matrix dimension (static Python int).

Returns:

Scalar float64 log(abs(det(A))).

Raises:

Exception – if A is singular or holds a non-finite value. set_options(on_failure="nan") returns NaN instead.