GaussNewton

GaussNewton#

class torchsim.GaussNewton(damping=None, *, solve=None, max_iterations=8, gradient_tolerance=1e-8, step_tolerance=1e-8)[source]#

Bases: object

Solve a nonlinear inverse problem by repeated linearization.

Parameters:
  • damping (Schedule or TrustRegion, optional) – Schedule for an iteratively regularized Gauss-Newton, TrustRegion for Levenberg-Marquardt.

  • solve (callable, optional) – The inner solve, called as solve(linearization, rhs, damping, reference). Left out, it is direct() where the model stands alone and iterative() – deepinv’s conjugate gradients – where an encoding operator does not leave independent voxels. A closure around anything else is how a regularizer enters.

  • max_iterations (int, optional) – Most outer steps to take.

  • gradient_tolerance (float, optional) – A voxel is done when its gradient is flat or its step is short relative to where it stands.

  • step_tolerance (float, optional) – A voxel is done when its gradient is flat or its step is short relative to where it stands.

Examples

loop = GaussNewton(Schedule(initial=1.0))
found = loop.minimize(operator, kspace, start, encoding=nufft)
maps = operator.split(found.x)
Raises:

ValueError – If a per-voxel damping is asked for under an encoding operator, which has mixed the voxels together and left no independent rows.

Methods

minimize

Solve for the maps that explain measured.

minimize(operator, measured, initial, *, encoding=None)[source]#

Solve for the maps that explain measured.

Parameters:
  • operator – A ModelOperator.

  • measured – The data. Without an encoding, (..., contrasts) – the contrast images themselves. With one, whatever the encoding produces.

  • initial – (..., channels), where to start. Build it with initial().

  • encoding – Anything with A and A_adjoint – a deepinv LinearPhysics, an mri-nufft operator through its deepinv bridge. It sees the contrast axis first, at axis 1, which is the convention on that side of the line; the maps keep it last, which is the convention on this one.

Return type:

Solution