warp.optim.linear.LinearSolverState#
- class warp.optim.linear.LinearSolverState(
- A,
- b,
- x,
- tol=None,
- atol=None,
- maxiter=0,
- M=None,
- callback=None,
- check_every=10,
- use_cuda_graph=True,
Pre-allocated state for a linear iterative solver.
Holds all temporary buffers required by the solver plus a reference to the original system (
A,b,x, optionalM). Calling the state runs the solver, optionally substituting a new compatible matrix, right-hand-side, solution vector, or preconditioner. This avoids repeated buffer allocation when the same solver is applied many times to systems that share the same shape, batch count, dtype, and device.- Parameters:
A (array | BsrMatrix | LinearOperator) – the linear system’s left-hand-side
b (array) – the linear system’s right-hand-side
x (array) – initial guess and solution vector
tol (float | None) – relative tolerance for the residual, as a ratio of the right-hand-side norm
atol (float | None) – absolute tolerance for the residual
maxiter (float | None) – maximum number of iterations to perform before aborting. Defaults to the system size.
M (array | BsrMatrix | LinearOperator | None) – optional preconditioner.
callback (Callable | None) – function to be called every
check_everyiteration with the current iteration number, residual and tolerance.check_every (int) – number of iterations every which to call
callbackand check the residual against the tolerance.use_cuda_graph (bool) – whether to capture the solver iteration as a CUDA graph for reduced launch overhead.
Instances are not directly constructible — use the solver-specific subclasses
CG,CR,BiCGSTAB, andGMRES, or obtain one by calling the corresponding solver function (cg(),cr(),bicgstab(),gmres()) withrun=False.- __init__(
- A,
- b,
- x,
- tol=None,
- atol=None,
- maxiter=0,
- M=None,
- callback=None,
- check_every=10,
- use_cuda_graph=True,
Methods
__init__(A, b, x[, tol, atol, maxiter, M, ...])