PCG API¶
Matrix-free preconditioned conjugate gradients on JAX pytrees.
- class solvax.pcg.PCGSolution(x, residual_norm, relative_residual_norm, iterations, converged, status, residual_history)¶
Result of
pcg()with fixed-shape, JIT-safe diagnostics.- Parameters:
- class solvax.pcg.PCGDiagnostics(residual_norm, relative_residual_norm, iterations, converged, status, residual_history)¶
Fixed-shape PCG diagnostics carried through an implicit solve.
- Parameters:
- solvax.pcg.pcg(matvec, b, *, x0=None, precond=None, rtol=1e-08, atol=0.0, max_steps=500, single_reduction=False)¶
Solve a symmetric positive-definite pytree system with matrix-free PCG.
matvecandprecondoperate on a pytree with the same structure asb. Setsingle_reduction=Trueto batch the three independent inner products in an algebraically equivalent recurrence. The residual history always has shape(max_steps + 1,); entries after termination repeat the final norm, which keeps the result compatible withjitandvmapwithout dynamic allocation.
- solvax.pcg.pcg_linear_solve(matvec, b, *, x0=None, precond=None, rtol=1e-08, atol=0.0, max_steps=500, single_reduction=False, transpose_precond=None, transpose_rtol=None, transpose_atol=None, transpose_max_steps=None)¶
Implicitly differentiable PCG with retained forward diagnostics.
The primal and transpose solves use
jax.lax.custom_linear_solve(), so derivatives do not trace through iteration-count branches. The operator is assumed Hermitian positive definite; the transpose preconditioner defaults to the primal preconditioner, while transpose tolerances may be controlled independently.- Parameters:
- Return type: