sparsax.lu_solve_factor

sparsax.lu_solve_factor(token, b, trans=False)[source]

Solve A x = b (or A^T x = b) using a pre-computed KLU factor.

Reuses the numeric factor held in token (from lu_factor`()); costs O(nnz(L+U) * n_rhs) triangular solves, no factorization. The factor is not consumed — call lu_solve_factor() as many times as needed against the same token. Not differentiable. Use lu_solve() when gradients are needed.

Parameters:
token

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

b

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

trans=False

if True, solve A^T x = b (the adjoint, used by lu_solve()’s VJP); otherwise A x = b.

Returns:

x with the same shape as b.

Note

Under jax.vmap, vmap(lu_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(lu_factor) followed by vmap(lu_solve_factor) (both batched) produces one factor per batch element. The two nest in either order, as one native call.