sparsax.solve¶
-
sparsax.solve(Ai, Aj, Ax, b, mode=
0)[source]¶ Solve
A x = bfor symmetric positive definite sparseA.Works inside
@jax.jit; the sparsity pattern’s symbolic analysis is computed once and cached across calls.- Parameters:¶
- Ai¶
[n_nz]int32 — COO row indices.- Aj¶
[n_nz]int32 — COO column indices. Entries withAi > Ajare ignored (the matrix is taken from the upper triangle).- Ax¶
[n_nz]float64 — COO values. Duplicates are summed.- b¶
[n]or[n, n_rhs]float64 — right-hand side(s).- mode=
0¶ which system to solve, one of the
MODE_*constants.MODE_A(default) solvesA x = b; other modes expose the factor parts (e.g.MODE_LTforL^T x = b).
- Returns:¶
xwith the same shape asb.- Raises:¶
Exception – if the matrix is not positive definite (raised by the XLA runtime with the CHOLMOD failure column in the message).
set_options(on_failure="nan")returns NaN instead.