sparsax.solve_factor

sparsax.solve_factor(token, b, mode=0)[source]

Solve A x = b using a pre-computed factor (no refactor).

Reuses the numeric factor held in token (from factor()); costs O(nnz(L) * n_rhs) triangular solves, no factorization. The factor is not consumed — call solve_factor() as many times as needed against the same token.

Not differentiable. Use solve() when gradients are needed.

Parameters:
token

Factor from factor() (an opaque int64[2] array).

b

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

mode=0

which factor-part system to solve (MODE_A by default), one of the MODE_* constants, matching solve().

Returns:

x with the same shape as b.

Note

Under jax.vmap, vmap(solve_factor, in_axes=(None, 0)) reuses one factor across a batch of RHS — the key Krylov-recurrence shape (one factor, m+1 solves), run as one multi-column solve. vmap(factor) followed by vmap(solve_factor) (both batched) produces one factor per batch element, matching factor_solve()’s batch semantics. The two nest in either order, as one native call.