sparsax.logdet

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

Log-determinant of a symmetric positive definite sparse matrix.

Computed from the Cholesky factor’s diagonal, sharing the factorization cache with solve(): a solve and a logdet with identical values factorize only once.

Differentiable in Ax (reverse mode). Since d log|A| / dA = A^{-1}, the gradient is the selinv() selected inverse at the COO positions (with off-diagonal entries doubled for the symmetric pair), so it costs one selected-inversion pass over the factor — no dense inverse. This makes logdet usable inside a JAX log-density for gradient-based inference (e.g. HMC/NUTS via numpyro/blackjax, or empirical-Bayes optimization of the matrix values), pairing with solve()’s VJP for the quadratic-form term.

Parameters:
Ai

COO matrix as in solve().

Aj

COO matrix as in solve().

Ax

COO matrix as in solve().

n

matrix dimension (static Python int).

Returns:

Scalar float64 log(det(A)).