GaussNewton#
- class torchsim.GaussNewton(damping=None, *, solve=None, max_iterations=8, gradient_tolerance=1e-8, step_tolerance=1e-8)[source]#
Bases:
objectSolve a nonlinear inverse problem by repeated linearization.
- Parameters:
damping (Schedule or TrustRegion, optional) –
Schedulefor an iteratively regularized Gauss-Newton,TrustRegionfor Levenberg-Marquardt.solve (callable, optional) – The inner solve, called as
solve(linearization, rhs, damping, reference). Left out, it isdirect()where the model stands alone anditerative()– 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
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 withinitial().encoding – Anything with
AandA_adjoint– a deepinvLinearPhysics, 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