sparsax.lu_solve_factor¶
-
sparsax.lu_solve_factor(token, b, trans=
False)[source]¶ Solve
A x = b(orA^T x = b) using a pre-computed KLU factor.Reuses the numeric factor held in
token(fromlu_factor`()); costsO(nnz(L+U) * n_rhs)triangular solves, no factorization. The factor is not consumed — calllu_solve_factor()as many times as needed against the same token. Not differentiable. Uselu_solve()when gradients are needed.- Parameters:¶
- token¶
Factorfromlu_factor()(an opaqueint64[2]array).- b¶
[n]or[n, n_rhs]float64 — right-hand side(s).- trans=
False¶ if
True, solveA^T x = b(the adjoint, used bylu_solve()’s VJP); otherwiseA x = b.
- Returns:¶
xwith the same shape asb.
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+1solves), run as one multi-column solve.vmap(lu_factor)followed byvmap(lu_solve_factor)(both batched) produces one factor per batch element. The two nest in either order, as one native call.