bartorch.optim.CG

Contents

bartorch.optim.CG#

class bartorch.optim.CG(lambda_=0.0, *, terms=None, maxiter=30, tol=0.0, cclambda=0.0, precond=None)#

Conjugate gradients for a least-squares problem with quadratic penalties.

Without terms it is min ||A x - y||^2 + lambda_ ||x||^2, which is what pics runs with no regularizer or with -r alone. With terms it is

min ||A x - y||^2 + lambda_ ||x||^2 + sum_i w_i ||G_i x - b_i||^2

which is still a least-squares problem and so still this iteration.

Parameters:
  • lambda (float) – Tikhonov weight on the image itself (pics -r). BART adds it to the normal operator, which is what makes this one match the tool.

  • terms (Tikhonov or iterable of Tikhonov, optional) – Quadratic penalties with an operator, a bias, or both. See Tikhonov.

  • maxiter (int)

  • tol (float) – Stop once the residual of the normal equations is at most tol * ||A^H y||. Zero, BART’s default, runs every iteration.

  • cclambda (float) – Weight of an identity added to the normal operator (pics -q).

Notes

BART’s conjugate gradients takes one weight and nothing else: iter2_conjgrad asserts that it is handed no regularizing operators and no biases, and lsqr2_create builds A^H A + lambda I. So the terms are not passed to it – they are built into the operator it is given, as the stack above, which needs nothing of BART that was not already there.

Examples

>>> CG(maxiter=30)(kspace, A)
>>> CG(terms=Tikhonov(0.1, bias=prior))(kspace, A)
>>> CG(terms=[Tikhonov(0.1, operator=G), Tikhonov(0.01)])(kspace, A)
__init__(lambda_=0.0, *, terms=None, maxiter=30, tol=0.0, cclambda=0.0, precond=None)#

Methods

__init__([lambda_, terms, maxiter, tol, ...])

fixed_point(image_shape, *[, trainable])

This solver as a deep-equilibrium model: the step's fixed point.

in_library(y, A[, x0])

The same as __call__(): conjugate gradients stays BART's.

unrolled(image_shape, *[, trainable])

This solver as a network of maxiter steps, trained end to end.