sparsax.update_solve

sparsax.update_solve(Ai, Aj, Ax, C, b, downdate=False, mode=0, return_logdet=False)[source]

Solve (A ± C C') x = b via a rank-k update of A’s factor.

A (the COO matrix) is factored once and cached; each call rebuilds a working copy of that factor, applies CHOLMOD’s cholmod_updown for the low-rank term C C', and solves. When A is held fixed and only the low-rank term C varies, this is much cheaper than assembling and refactoring A ± C C' from scratch (O(k·nnz(L)) vs. a full factorization). The cached factor of A is never mutated.

Parameters:
Ai

COO of the symmetric positive definite base matrix A, as in solve().

Aj

COO of the symmetric positive definite base matrix A, as in solve().

Ax

COO of the symmetric positive definite base matrix A, as in solve().

C

[n] or [n, k] float64 — the rank-k update columns. A 1D C is treated as a single column (rank-1). May be sparse in content (explicit zeros are dropped before the update).

b

[n] or [n, n_rhs] float64 — right-hand side(s).

downdate=False

if True solve (A - C C') x = b (downdate); otherwise (A + C C') x = b (update).

mode=0

solve mode, as in solve().

return_logdet=False

if True also return log|A ± C C'| (computed from the same updated factor, so it is essentially free).

Returns:

x with the same shape as b, or (x, logdet) if return_logdet is set.

Raises:

Exception – if A is not positive definite, or a downdate drives the updated matrix indefinite. set_options(on_failure="nan") returns NaN instead.