Commit c3627c40 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

more docs

parent cc7f44e4
Pipeline #25134 passed with stages
......@@ -288,6 +288,11 @@ Of these algorithms, only :class:`RelaxedNewton` requires the energy object to
provide a :attr:`~Energy.curvature` property, the others only need energy
values and gradients.
The flexibility of NIFTy's design allows using externally provided
minimizers. With only small effort, adapters for two SciPy minimizers were
written; they are available under the names :class:`NewtonCG` and
:class:`L_BFGS_B`.
Application to operator inversion
---------------------------------
......@@ -302,5 +307,5 @@ A classical example is the information propagator
which must be applied when calculating a Wiener filter. Only its inverse
application is straightforward; to use it in forward direction, we make use
of NIFTy's :class:`InversionEnabler` class, which internally performs a
minimization of a :class:`QuadraticEnergy` by means of a
minimization of a :class:`QuadraticEnergy` by means of the
:class:`ConjugateGradient` algorithm.
......@@ -9,7 +9,7 @@ from .descent_minimizer import DescentMinimizer
from .steepest_descent import SteepestDescent
from .vl_bfgs import VL_BFGS
from .relaxed_newton import RelaxedNewton
from .scipy_minimizer import NewtonCG, L_BFGS_B
from .scipy_minimizer import ScipyMinimizer, NewtonCG, L_BFGS_B
from .energy import Energy
from .quadratic_energy import QuadraticEnergy
from .line_energy import LineEnergy
......@@ -17,5 +17,5 @@ from .line_energy import LineEnergy
__all__ = ["LineSearch", "LineSearchStrongWolfe", "IterationController",
"GradientNormController",
"Minimizer", "ConjugateGradient", "NonlinearCG", "DescentMinimizer",
"SteepestDescent", "VL_BFGS", "RelaxedNewton", "NewtonCG",
"L_BFGS_B", "Energy", "QuadraticEnergy", "LineEnergy"]
"SteepestDescent", "VL_BFGS", "RelaxedNewton", "ScipyMinimizer",
"NewtonCG", "L_BFGS_B", "Energy", "QuadraticEnergy", "LineEnergy"]
......@@ -104,11 +104,23 @@ class ScipyMinimizer(Minimizer):
def NewtonCG(controller):
"""Returns a ScipyMinimizer object carrying out the Newton-CG algorithm.
See Also
--------
ScipyMinimizer
"""
return ScipyMinimizer(controller, "Newton-CG",
{"xtol": 1e-20, "maxiter": None}, True)
def L_BFGS_B(controller, maxcor=10):
"""Returns a ScipyMinimizer object carrying out the L-BFGS-B algorithm.
See Also
--------
ScipyMinimizer
"""
return ScipyMinimizer(controller, "L-BFGS-B",
{"ftol": 1e-20, "gtol": 1e-20, "maxcor": maxcor},
False)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment