optim.cg#
- bartorch.optim.cg()#
Solve a linear least-squares problem by conjugate gradients.
Minimizes \(\| A x - y \|^2 + \lambda \| x \|^2\), and with quadratic penalties \(\sum_i w_i \| G_i x - b_i \|^2\) alongside it. Takes
Tikhonovpenalties throughterms=; proximal regularizers are not accepted.- Parameters:
y (tensor) – Data of
A.oshape.A (LinearOperator) – The encoding operator.
lambda (float, default=0.0) – Tikhonov weight on the image itself.
x0 (tensor, default=None) – Warm start of
A.ishape; without one the iteration starts at zero.**settings – Settings of
CG, among themterms,maxiter(30) andtol.
- Returns:
Complex64 solution of
A.ishape.- Return type:
torch.Tensor
Notes
The solve is recorded for autograd when
yrequires a gradient; the backward pass is a second solve with the same normal operator.