sparsax.lu_factor¶
- sparsax.lu_factor(Ai, Aj, Ax, n)[source]¶
Factor general (non-symmetric)
Aonce via KLU, return a token.The non-symmetric counterpart of
factor(). The token is an opaqueint64[2]array carrying a strong reference to a KLU numeric factor held in the extension’s token table. Pass it tolu_solve_factor()andlu_logdet_factor()to issue an unbounded sequence of solves and a logdet against the same factor — no refactoring and no per-call re-hash ofAx. The per-pattern LRU cannot evict the factor while the token is live.This is the recurrence primitive that
lu_solve()cannot express:V_{j+1} = A^{-1}(G V_j)(a shift-invert Krylov basis for a non-symmetricA) needs the previous solve’s output as the next solve’s input, which a single fused call cannot represent.Not differentiable. Use
lu_solve()when gradients are needed.- Parameters:¶
- Returns:¶
Factor— an opaqueint64[2]token. Not meant to be inspected; pass tolu_solve_factor()/lu_logdet_factor().