sparsax.update_solve¶
-
sparsax.update_solve(Ai, Aj, Ax, C, b, downdate=
False, mode=0, return_logdet=False)[source]¶ Solve
(A ± C C') x = bvia a rank-k update ofA’s factor.A(the COO matrix) is factored once and cached; each call rebuilds a working copy of that factor, applies CHOLMOD’scholmod_updownfor the low-rank termC C', and solves. WhenAis held fixed and only the low-rank termCvaries, this is much cheaper than assembling and refactoringA ± C C'from scratch (O(k·nnz(L))vs. a full factorization). The cached factor ofAis never mutated.- Parameters:¶
- Ai¶
COO of the symmetric positive definite base matrix
A, as insolve().- Aj¶
COO of the symmetric positive definite base matrix
A, as insolve().- Ax¶
COO of the symmetric positive definite base matrix
A, as insolve().- C¶
[n]or[n, k]float64 — the rank-k update columns. A 1DCis 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
Truesolve(A - C C') x = b(downdate); otherwise(A + C C') x = b(update).- mode=
0¶ solve mode, as in
solve().- return_logdet=
False¶ if
Truealso returnlog|A ± C C'|(computed from the same updated factor, so it is essentially free).
- Returns:¶
xwith the same shape asb, or(x, logdet)ifreturn_logdetis set.- Raises:¶
Exception – if
Ais not positive definite, or a downdate drives the updated matrix indefinite.set_options(on_failure="nan")returns NaN instead.