lsqr#
- deepinv.optim.utils.lsqr(A, AT, b, eta=0.0, x0=None, tol=1e-6, conlim=1e8, max_iter=100, parallel_dim=0, verbose=False, **kwargs)[source]#
LSQR algorithm for solving linear systems.
Code adapted from SciPy’s implementation of LSQR: scipy/scipy
The function solves the linear system \(\min_x \|Ax-b\|^2 + \eta \|x-x_0\|^2\) in the least squares sense using the LSQR algorithm from
Paige, C. C. and M. A. Saunders, “LSQR: An Algorithm for Sparse Linear Equations And Sparse Least Squares,” ACM Trans. Math. Soft., Vol.8, 1982, pp. 43-71.
- Parameters:
A (Callable) – Linear operator as a callable function.
AT (Callable) – Adjoint operator as a callable function.
b (torch.Tensor) – input tensor of shape (B, …)
eta (float) – damping parameter \(eta \geq 0\).
x0 (None, torch.Tensor) – Optional \(x_0\), which is also used as the initial guess.
tol (float) – relative tolerance for stopping the LSQR algorithm.
conlim (float) – maximum value of the condition number of the system.
max_iter (int) – maximum number of LSQR iterations.
parallel_dim (None, int, List[int]) – dimensions to be considered as batch dimensions. If None, all dimensions are considered as batch dimensions.
verbose (bool) – Output progress information in the console.
- Retrun:
(
torch.Tensor
) \(x\) of shape (B, …), (torch.Tensor
) condition number of the system.