sparsax.factor¶
- sparsax.factor(Ai, Aj, Ax, n)[source]¶
Factor SPD
Aonce, returning a reusable factor token.The token is an opaque
int64[2]array carrying a reference to a CHOLMOD numeric factor held in the extension’s cache. Pass it tosolve_factor()andlogdet_factor()to issue an unbounded sequence of solves and a logdet against the same factor — no refactoring and no per-call re-hash ofAx.This is the “hold the factor open” primitive that
factor_solve()cannot express: a recurrenceV_{j+1} = A^{-1}(G V_j)(a shift-invert Krylov basis) needs the previous solve’s output as the next solve’s input, which a single fused call cannot represent. With a token, the basis build is alax.fori_loopofsolve_factor()calls against onefactor.The token is not differentiable. Use
solve()/logdet()when gradients are needed.- Parameters:¶
- Returns:¶
Factor— an opaqueint64[2]token. Not meant to be inspected; pass tosolve_factor()/logdet_factor().
Note
Repeated
factorcalls with identicalAxreuse a cached numeric factor (no refactoring). The cache is per sparsity pattern; callclear_cache()to drop all factors and invalidate outstanding tokens.