Commit 24147f38 authored by Torsten Ensslin's avatar Torsten Ensslin
Browse files

Merge branch 'NIFTy_5' into 'docstrings_torsten'

# Conflicts:
#   nifty5/operators/energy_operators.py
parents 9a8c07ff 9c813309
...@@ -11,6 +11,7 @@ setup.cfg ...@@ -11,6 +11,7 @@ setup.cfg
.svn/ .svn/
*.csv *.csv
.pytest_cache/ .pytest_cache/
*.png
# from https://github.com/github/gitignore/blob/master/Python.gitignore # from https://github.com/github/gitignore/blob/master/Python.gitignore
......
...@@ -46,32 +46,32 @@ if __name__ == '__main__': ...@@ -46,32 +46,32 @@ if __name__ == '__main__':
mode = 1 mode = 1
position_space = ift.RGSpace([128, 128]) position_space = ift.RGSpace([128, 128])
harmonic_space = position_space.get_default_codomain()
ht = ift.HarmonicTransformOperator(harmonic_space, position_space)
power_space = ift.PowerSpace(harmonic_space)
# Set up an amplitude operator for the field # Set up an amplitude operator for the field
# The parameters mean: dct = {
# 64 spectral bins 'target': power_space,
# 'n_pix': 64, # 64 spectral bins
# Spectral smoothness (affects Gaussian process part) # Spectral smoothness (affects Gaussian process part)
# 3 = relatively high variance of spectral curbvature 'a': 3, # relatively high variance of spectral curbvature
# 0.4 = quefrency mode below which cepstrum flattens 'k0': .4, # quefrency mode below which cepstrum flattens
#
# Power-law part of spectrum: # Power-law part of spectrum:
# -5 = preferred power-law slope 'sm': -5, # preferred power-law slope
# 0.5 = low variance of power-law slope 'sv': .5, # low variance of power-law slope
# 0.4 = y-intercept mean 'im': .4, # y-intercept mean
# 0.3 = relatively high y-intercept variance 'iv': .3 # relatively high y-intercept variance
A = ift.AmplitudeOperator(position_space, 64, 3, 0.4, -5., 0.5, 0.4, 0.3) }
A = ift.AmplitudeOperator(**dct)
# Build the operator for a correlated signal # Build the operator for a correlated signal
harmonic_space = position_space.get_default_codomain()
ht = ift.HarmonicTransformOperator(harmonic_space, position_space)
power_space = A.target[0]
power_distributor = ift.PowerDistributor(harmonic_space, power_space) power_distributor = ift.PowerDistributor(harmonic_space, power_space)
vol = harmonic_space.scalar_dvol**-0.5
vol = ift.ScalingOperator(harmonic_space.scalar_dvol**(-0.5), xi = ift.ducktape(harmonic_space, None, 'xi')
harmonic_space) correlated_field = ht(vol*power_distributor(A)*xi)
correlated_field = ht(
vol(power_distributor(A))*ift.ducktape(harmonic_space, None, 'xi'))
# Alternatively, one can use: # Alternatively, one can use:
# correlated_field = ift.CorrelatedField(position_space, A) # correlated_field = ift.CorrelatedField(position_space, A)
......
sphinx-apidoc -l -e -d 2 -o docs/source/mod nifty5 sphinx-apidoc -e -o docs/source/mod nifty5
sphinx-build -b html docs/source/ docs/build/ sphinx-build -b html docs/source/ docs/build/
...@@ -89,16 +89,17 @@ NIFTy comes with several concrete subclasses of :class:`StructuredDomain`: ...@@ -89,16 +89,17 @@ NIFTy comes with several concrete subclasses of :class:`StructuredDomain`:
.. currentmodule:: nifty5.domains .. currentmodule:: nifty5.domains
- :class:`rg_space.RGSpace` represents a regular Cartesian grid with an arbitrary - :class:`~rg_space.RGSpace` represents a regular Cartesian grid with an arbitrary
number of dimensions, which is supposed to be periodic in each dimension. number of dimensions, which is supposed to be periodic in each dimension.
- :class:`hp_space.HPSpace` and :class:`gl_space.GLSpace` describe pixelisations of the - :class:`~hp_space.HPSpace` and :class:`~gl_space.GLSpace` describe pixelisations of the
2-sphere; their counterpart in harmonic space is :class:`lm_space.LMSpace`, which 2-sphere; their counterpart in harmonic space is :class:`~lm_space.LMSpace`, which
contains spherical harmonic coefficients. contains spherical harmonic coefficients.
- :class:`power_space.PowerSpace` is used to describe one-dimensional power spectra. - :class:`~power_space.PowerSpace` is used to describe one-dimensional power spectra.
Among these, :class:`rg_space.RGSpace` can be harmonic or not (depending on constructor arguments), :class:`gl_space.GLSpace`, :class:`hp_space.HPSpace`, and :class:`power_space.PowerSpace` are Among these, :class:`~rg_space.RGSpace` can be harmonic or not (depending on
pure position domains (i.e. nonharmonic), and :class:`lm_space.LMSpace` is always constructor arguments), :class:`~gl_space.GLSpace`, :class:`~hp_space.HPSpace`,
harmonic. and :class:`~power_space.PowerSpace` are pure position domains (i.e.
nonharmonic), and :class:`~lm_space.LMSpace` is always harmonic.
Combinations of domains Combinations of domains
...@@ -110,27 +111,31 @@ field on a product of elementary domains instead of a single one. ...@@ -110,27 +111,31 @@ field on a product of elementary domains instead of a single one.
More sophisticated operators also require a set of several such fields. More sophisticated operators also require a set of several such fields.
Some examples are: Some examples are:
- sky emission depending on location and energy. This could be represented by - sky emission depending on location and energy. This could be represented by a
a product of an :class:`HPSpace` (for location) with an :class:`RGSpace` product of an :class:`~hp_space.HPSpace` (for location) with an
(for energy). :class:`~rg_space.RGSpace` (for energy).
- a polarized field, which could be modeled as a product of any structured - a polarized field, which could be modeled as a product of any structured
domain (representing location) with a four-element domain (representing location) with a four-element
:class:`UnstructuredDomain` holding Stokes I, Q, U and V components. :class:`~unstructured_domain.UnstructuredDomain` holding Stokes I, Q, U and V components.
- a model for the sky emission, which holds both the current realization - a model for the sky emission, which holds both the current realization
(on a harmonic domain) and a few inferred model parameters (e.g. on an (on a harmonic domain) and a few inferred model parameters (e.g. on an
unstructured grid). unstructured grid).
Consequently, NIFTy defines a class called :class:`DomainTuple` holding .. currentmodule:: nifty5
a sequence of :class:`Domain` objects, which is used to specify full field
domains. In principle, a :class:`DomainTuple` can even be empty, which implies
that the field living on it is a scalar.
A :class:`DomainTuple` supports iteration and indexing, and also provides the Consequently, NIFTy defines a class called :class:`~domain_tuple.DomainTuple`
properties :attr:`~DomainTuple.shape`, :attr:`~DomainTuple.size` in analogy to holding a sequence of :class:`~domains.domain.Domain` objects, which is used to
the elementary :class:`Domain`. specify full field domains. In principle, a :class:`~domain_tuple.DomainTuple`
can even be empty, which implies that the field living on it is a scalar.
An aggregation of several :class:`DomainTuple` s, each member identified by a A :class:`~domain_tuple.DomainTuple` supports iteration and indexing, and also
name, is described by the :class:`MultiDomain` class. provides the properties :attr:`~domain_tuple.DomainTuple.shape`,
:attr:`~domain_tuple.DomainTuple.size` in analogy to the elementary
:class:`~domains.domain.Domain`.
An aggregation of several :class:`~domain_tuple.DomainTuple` s, each member
identified by a name, is described by the :class:`~multi_domain.MultiDomain`
class.
Fields Fields
====== ======
...@@ -138,9 +143,9 @@ Fields ...@@ -138,9 +143,9 @@ Fields
Fields on a single DomainTuple Fields on a single DomainTuple
------------------------------ ------------------------------
A :class:`Field` object consists of the following components: A :class:`~field.Field` object consists of the following components:
- a domain in form of a :class:`DomainTuple` object - a domain in form of a :class:`~domain_tuple.DomainTuple` object
- a data type (e.g. numpy.float64) - a data type (e.g. numpy.float64)
- an array containing the actual values - an array containing the actual values
...@@ -152,7 +157,7 @@ Fields support a wide range of arithmetic operations, either involving two ...@@ -152,7 +157,7 @@ Fields support a wide range of arithmetic operations, either involving two
fields with equal domains, or a field and a scalar. fields with equal domains, or a field and a scalar.
Contractions (like summation, integration, minimum/maximum, computation of Contractions (like summation, integration, minimum/maximum, computation of
statistical moments) can be carried out either over an entire field (producing statistical moments) can be carried out either over an entire field (producing
a scalar result) or over sub-domains (resulting in a field living on a smaller a scalar result) or over sub-domains (resulting in a field defined on a smaller
domain). Scalar products of two fields can also be computed easily. domain). Scalar products of two fields can also be computed easily.
There is also a set of convenience functions to generate fields with constant There is also a set of convenience functions to generate fields with constant
...@@ -168,67 +173,77 @@ result. ...@@ -168,67 +173,77 @@ result.
Fields defined on a MultiDomain Fields defined on a MultiDomain
------------------------------- -------------------------------
The :class:`MultiField` class can be seen as a dictionary of individual The :class:`~multi_field.MultiField` class can be seen as a dictionary of
:class:`Field` s, each identified by a name, which is defined on a individual :class:`~field.Field` s, each identified by a name, which is defined
:class:`MultiDomain`. on a :class:`~multi_domain.MultiDomain`.
Operators Operators
========= =========
All transformations between different NIFTy fields are expressed (explicitly All transformations between different NIFTy fields are expressed in the form of
or implicitly) in the form of :class:`Operator` objects. The interface of this :class:`~operators.operator.Operator` objects. The interface of this class is
class is very minimalistic: it has a property called :class:`domain` which returns rather minimalistic: it has a property called
a :class:`DomainTuple` or :class:`MultiDomain` object specifying the structure of the :attr:`~operators.operator.Operator.domain` which returns a
:class:`Field` s or :class:`MultiField` s it expects as input, another property :class:`target` :class:`~domain_tuple.DomainTuple` or :class:`~multi_domain.MultiDomain` object
describing its output, and finally an overloaded `apply` method, which can specifying the structure of the :class:`~field.Field` or
take :class:`~multi_field.MultiField` it expects as input, another property
:attr:`~operators.operator.Operator.target` describing its output, and finally
- a :class:`Field`/:class:`MultiField` object, in which case it returns the transformed an overloaded :attr:`~operators.operator.Operator.apply` method, which can take:
:class:`Field`/:class:`MultiField`
- a :class:`Linearization` object, in which case it returns the transformed - a :class:`~field.Field`/:class:`~multi_field.MultiField` object, in which case
:class:`Linearization` it returns the transformed :class:`~field.Field`/:class:`~multi_field.MultiField`.
- a :class:`~linearization.Linearization` object, in which case it returns the
This is the interface that all objects derived from :class:`Operator` must implement. transformed :class:`~linearization.Linearization`.
In addition, :class:`Operator` objects can be added/subtracted, multiplied, chained
(via the :class:`__call__` method and the `@` operator) and support pointwise This is the interface that all objects derived from
application of functions like :class:`~operators.operator.Operator` must implement. In addition,
:class:`exp()`, :class:`log()`, :class:`sqrt()`, :class:`conjugate()` etc. :class:`~operators.operator.Operator` objects can be added/subtracted,
multiplied, chained (via the :attr:`__call__` method or the `@` operator) and
support point-wise application of functions like :class:`exp()`, :class:`log()`,
:class:`sqrt()`, :class:`conjugate()`.
Advanced operators Advanced operators
------------------ ------------------
NIFTy provides a library of more sophisticated operators which are used for more NIFTy provides a library of commonly employed operators which can be used for
specific inference problems. Currently these are: specific inference problems. Currently these are:
- :class:`AmplitudeOperator`, which returns a smooth power spectrum. .. currentmodule:: nifty5.library
- :class:`InverseGammaOperator`, which models point sources which follow a inverse gamma distribution.
- :class:`CorrelatedField`, which models a diffuse log-normal field. It takes an amplitude operator to specify the correlation structure of the field. - :class:`~amplitude_operator.AmplitudeOperator`, which returns a smooth power spectrum.
- :class:`~inverse_gamma_operator.InverseGammaOperator`, which models point sources which are
distributed according to a inverse-gamma distribution.
- :class:`~correlated_fields.CorrelatedField`, which models a diffuse log-normal field. It takes an
amplitude operator to specify the correlation structure of the field.
Linear Operators Linear Operators
================ ================
A linear operator (represented by NIFTy5's abstract :class:`LinearOperator` .. currentmodule:: nifty5.operators
class) is derived from `Operator` and can be interpreted as an
(implicitly defined) matrix. Since its operation is linear, it can provide some A linear operator (represented by NIFTy5's abstract
additional functionality which is not available for the more generic :class:`Operator` :class:`~linear_operator.LinearOperator` class) is derived from
class. :class:`~operator.Operator` and can be interpreted as an (implicitly defined)
matrix. Since its operation is linear, it can provide some additional
functionality which is not available for the more generic
:class:`~operator.Operator` class.
Linear Operator basics Linear Operator basics
---------------------- ----------------------
There are four basic ways of applying an operator :math:`A` to a field :math:`f`: There are four basic ways of applying an operator :math:`A` to a field :math:`s`:
- direct application: :math:`A\cdot f` - direct application: :math:`A(s)`
- adjoint application: :math:`A^\dagger \cdot f` - adjoint application: :math:`A^\dagger (s)`
- inverse application: :math:`A^{-1}\cdot f` - inverse application: :math:`A^{-1} (s)`
- adjoint inverse application: :math:`(A^\dagger)^{-1}\cdot f` - adjoint inverse application: :math:`(A^\dagger)^{-1} (s)`
(Because of the linearity, inverse adjoint and adjoint inverse application Note: The inverse of the adjoint of a linear map and the adjoint of the inverse
are equivalent.) of a linear map (if all those exist) are the same.
These different actions of a linear operator ``Op`` on a field ``f`` can be These different actions of a linear operator ``Op`` on a field ``f`` can be
invoked in various ways: invoked in various ways:
...@@ -240,33 +255,45 @@ invoked in various ways: ...@@ -240,33 +255,45 @@ invoked in various ways:
Operator classes defined in NIFTy may implement an arbitrary subset of these Operator classes defined in NIFTy may implement an arbitrary subset of these
four operations. This subset can be queried using the four operations. This subset can be queried using the
:attr:`~LinearOperator.capability` property. :attr:`~linear_operator.LinearOperator.capability` property.
If needed, the set of supported operations can be enhanced by iterative If needed, the set of supported operations can be enhanced by iterative
inversion methods; inversion methods; for example, an operator defining direct and adjoint
for example, an operator defining direct and adjoint multiplication could be multiplication could be enhanced by this approach to support the complete set.
enhanced by this approach to support the complete set. This functionality is This functionality is provided by NIFTy's
provided by NIFTy's :class:`InversionEnabler` class, which is itself a linear :class:`~inversion_enabler.InversionEnabler` class, which is itself a linear
operator. operator.
.. currentmodule:: nifty5.operators.linear_operator
Direct multiplication and adjoint inverse multiplication transform a field Direct multiplication and adjoint inverse multiplication transform a field
living on the operator's :attr:`~LinearOperator.domain` to one living on the operator's :attr:`~LinearOperator.target`, whereas adjoint multiplication defined on the operator's :attr:`~LinearOperator.domain` to one defined on the
and inverse multiplication transform from :attr:`~LinearOperator.target` to :attr:`~LinearOperator.domain`. operator's :attr:`~LinearOperator.target`, whereas adjoint multiplication and
inverse multiplication transform from :attr:`~LinearOperator.target` to
:attr:`~LinearOperator.domain`.
.. currentmodule:: nifty5.operators
Operators with identical domain and target can be derived from Operators with identical domain and target can be derived from
:class:`EndomorphicOperator`; typical examples for this category are the :class:`ScalingOperator`, which simply multiplies its input by a scalar :class:`~endomorphic_operator.EndomorphicOperator`. Typical examples for this
value, and :class:`DiagonalOperator`, which multiplies every value of its input category are the :class:`~scaling_operator.ScalingOperator`, which simply
field with potentially different values. multiplies its input by a scalar value, and
:class:`~diagonal_operator.DiagonalOperator`, which multiplies every value of
its input field with potentially different values.
.. currentmodule:: nifty5
Further operator classes provided by NIFTy are Further operator classes provided by NIFTy are
- :class:`HarmonicTransformOperator` for transforms from a harmonic domain to - :class:`~operators.harmonic_operators.HarmonicTransformOperator` for
its counterpart in position space, and their adjoint transforms from a harmonic domain to its counterpart in position space, and
- :class:`PowerDistributor` for transforms from a :class:`PowerSpace` to their adjoint
an associated harmonic domain, and their adjoint - :class:`~operators.distributors.PowerDistributor` for transforms from a
- :class:`GeometryRemover`, which transforms from structured domains to :class:`~domains.power_space.PowerSpace` to an associated harmonic domain, and
unstructured ones. This is typically needed when building instrument response their adjoint.
operators. - :class:`~operators.simple_linear_operators.GeometryRemover`, which transforms
from structured domains to unstructured ones. This is typically needed when
building instrument response operators.
Syntactic sugar Syntactic sugar
...@@ -274,12 +301,14 @@ Syntactic sugar ...@@ -274,12 +301,14 @@ Syntactic sugar
Nifty5 allows simple and intuitive construction of altered and combined Nifty5 allows simple and intuitive construction of altered and combined
operators. operators.
As an example, if ``A``, ``B`` and ``C`` are of type :class:`LinearOperator` As an example, if ``A``, ``B`` and ``C`` are of type :class:`~operators.linear_operator.LinearOperator`
and ``f1`` and ``f2`` are of type :class:`Field`, writing:: and ``f1`` and ``f2`` are of type :class:`~field.Field`, writing::
X = A(B.inverse(A.adjoint)) + C X = A(B.inverse(A.adjoint)) + C
f2 = X(f1) f2 = X(f1)
.. currentmodule:: nifty5.operators.linear_operator
will perform the operation suggested intuitively by the notation, checking will perform the operation suggested intuitively by the notation, checking
domain compatibility while building the composed operator. domain compatibility while building the composed operator.
The combined operator infers its domain and target from its constituents, The combined operator infers its domain and target from its constituents,
...@@ -289,62 +318,6 @@ The properties :attr:`~LinearOperator.adjoint` and ...@@ -289,62 +318,6 @@ The properties :attr:`~LinearOperator.adjoint` and
were the original operator's adjoint or inverse, respectively. were the original operator's adjoint or inverse, respectively.
Operators
=========
Operator classes (represented by NIFTy5's abstract :class:`Operator` class) are used to construct
the equations of a specific inference problem.
Most operators are defined via a position, which is a :class:`MultiField` object,
their value at this position, which is again a :class:`MultiField` object and a Jacobian derivative,
which is a :class:`LinearOperator` and is needed for the minimization procedure.
Using the existing basic operator classes one can construct more complicated operators, as
NIFTy allows for easy and self-consinstent combination via point-wise multiplication,
addition and subtraction. The operator resulting from these operations then automatically
contains the correct Jacobians, positions and values.
Notably, :class:`Constant` and :class:`Variable` allow for an easy way to turn
inference of specific quantities on and off.
The basic operator classes also allow for more complex operations on operators such as
the application of :class:`LinearOperators` or local non-linearities.
As an example one may consider the following combination of ``x``, which is an operator of type
:class:`Variable` and ``y``, which is an operator of type :class:`Constant`::
z = x*x + y
``z`` will then be an operator with the following properties::
z.value = x.value*x.value + y.value
z.position = Union(x.position, y.position)
z.jacobian = 2*makeOp(x.value)
Basic operators
---------------
# FIXME All this is outdated!
Basic operator classes provided by NIFTy are
- :class:`Constant` contains a constant value and has a zero valued Jacobian.
Like other operators, it has a position, but its value does not depend on it.
- :class:`Variable` returns the position as its value, its derivative is one.
- :class:`LinearModel` applies a :class:`LinearOperator` on the model.
- :class:`LocalModel` applies a non-linearity locally on the model.
value and Jacobian are combined into corresponding :class:`MultiFields` and operators.
Advanced operators
------------------
NIFTy also provides a library of more sophisticated operators which are used for more
specific inference problems. Currently these are:
- :class:`AmplitudeOperator`, which returns a smooth power spectrum.
- :class:`InverseGammaOperator`, which models point sources which follow a inverse gamma distribution.
- :class:`CorrelatedField`, which models a diffuse log-normal field. It takes an amplitude operator
to specify the correlation structure of the field.
.. _minimization: .. _minimization:
...@@ -354,29 +327,32 @@ Minimization ...@@ -354,29 +327,32 @@ Minimization
Most problems in IFT are solved by (possibly nested) minimizations of Most problems in IFT are solved by (possibly nested) minimizations of
high-dimensional functions, which are often nonlinear. high-dimensional functions, which are often nonlinear.
.. currentmodule:: nifty5.minimization
Energy functionals Energy functionals
------------------ ------------------
In NIFTy5 such functions are represented by objects of type :class:`Energy`. In NIFTy5 such functions are represented by objects of type
These hold the prescription how to calculate the function's :class:`~energy.Energy`. These hold the prescription how to calculate the
:attr:`~Energy.value`, :attr:`~Energy.gradient` and function's :attr:`~energy.Energy.value`, :attr:`~energy.Energy.gradient` and
(optionally) :attr:`~Energy.metric` at any given :attr:`~Energy.position` (optionally) :attr:`~energy.Energy.metric` at any given
in parameter space. :attr:`~energy.Energy.position` in parameter space. Function values are
Function values are floating-point scalars, gradients have the form of fields floating-point scalars, gradients have the form of fields defined on the energy's
living on the energy's position domain, and metrics are represented by position domain, and metrics are represented by linear operator objects.
linear operator objects.
.. currentmodule:: nifty5
Energies are classes that typically have to be provided by the user when Energies are classes that typically have to be provided by the user when
tackling new IFT problems. tackling new IFT problems. An example of concrete energy classes delivered with
Some examples of concrete energy classes delivered with NIFTy5 are NIFTy5 is :class:`~minimization.quadratic_energy.QuadraticEnergy` (with
:class:`QuadraticEnergy` (with position-independent metric, mainly used with position-independent metric, mainly used with conjugate gradient minimization).
conjugate gradient minimization) and :class:`~nifty5.library.WienerFilterEnergy`.
Iteration control Iteration control
----------------- -----------------
.. currentmodule:: nifty5.minimization.iteration_controllers
Iterative minimization of an energy reqires some means of Iterative minimization of an energy reqires some means of
checking the quality of the current solution estimate and stopping once checking the quality of the current solution estimate and stopping once
it is sufficiently accurate. In case of numerical problems, the iteration needs it is sufficiently accurate. In case of numerical problems, the iteration needs
...@@ -399,50 +375,61 @@ for their specific applications. ...@@ -399,50 +375,61 @@ for their specific applications.
Minimization algorithms Minimization algorithms
----------------------- -----------------------
.. currentmodule:: nifty5.minimization
All minimization algorithms in NIFTy inherit from the abstract All minimization algorithms in NIFTy inherit from the abstract
:class:`Minimizer` class, which presents a minimalistic interface consisting :class:`~minimizer.Minimizer` class, which presents a minimalistic interface
only of a :meth:`~Minimizer.__call__` method taking an :class:`Energy` object consisting only of a :meth:`~minimizer.Minimizer.__call__()` method taking an
and optionally a preconditioning operator, and returning the energy at the :class:`~energy.Energy` object and optionally a preconditioning operator, and
discovered minimum and a status code. returning the energy at the discovered minimum and a status code.
For energies with a quadratic form (i.e. which For energies with a quadratic form (i.e. which can be expressed by means of a
can be expressed by means of a :class:`QuadraticEnergy` object), an obvious :class:`~quadratic_energy.QuadraticEnergy` object), an obvious choice of
choice of algorithm is the :class:`ConjugateGradient` minimizer. algorithm is the :class:`~conjugate_gradient.ConjugateGradient` minimizer.
A similar algorithm suited for nonlinear problems is provided by A similar algorithm suited for nonlinear problems is provided by
:class:`NonlinearCG`. :class:`~nonlinear_cg.NonlinearCG`.
Many minimizers for nonlinear problems can be characterized as Many minimizers for nonlinear problems can be characterized as
- first deciding on a direction for the next step - First deciding on a direction for the next step.
- then finding a suitable step length along this direction, resulting in the - Then finding a suitable step length along this direction, resulting in the
next energy estimate. next energy estimate.
This family of algorithms is encapsulated in NIFTy's :class:`DescentMinimizer` This family of algorithms is encapsulated in NIFTy's
class, which currently has three concrete implementations: :class:`~descent_minimizers.DescentMinimizer` class, which currently has three
:class:`SteepestDescent`, :class:`VL_BFGS`, and :class:`RelaxedNewton`. concrete implementations: :class:`~descent_minimizers.SteepestDescent`,
Of these algorithms, only :class:`RelaxedNewton` requires the energy object to :class:`~descent_minimizers.RelaxedNewton`,
provide a :attr:`~Energy.metric` property, the others only need energy :class:`~descent_minimizers.NewtonCG`, :class:`~descent_minimizers.L_BFGS` and
values and gradients. :class:`~descent_minimizers.VL_BFGS`. Of these algorithms, only
:class:`~descent_minimizers.RelaxedNewton` requires the energy object to provide
The flexibility of NIFTy's design allows using externally provided a :attr:`~energy.Energy.metric` property, the others only need energy values and
minimizers. With only small effort, adapters for two SciPy minimizers were gradients.
written; they are available under the names :class:`NewtonCG` and
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:`~scipy_minimizer.ScipyCG` and
:class:`L_BFGS_B`. :class:`L_BFGS_B`.
Application to operator inversion Application to operator inversion
--------------------------------- ---------------------------------
It is important to realize that the machinery presented here cannot only be .. currentmodule:: nifty5
used for minimizing IFT Hamiltonians, but also for the numerical inversion of
linear operators, if the desired application mode is not directly available. The machinery presented here cannot only be used for minimizing functionals
A classical example is the information propagator derived from IFT, but also for the numerical inversion of linear operators, if
the desired application mode is not directly available. A classical example is
the information propagator whose inverse is defined as:
:math:`D = \left(R^\dagger N^{-1} R + S^{-1}\right)^{-1}`, :math:`D^{-1} = \left(R^\dagger N^{-1} R + S^{-1}\right)`.
which must be applied when calculating a Wiener filter. Only its inverse It needs to be applied in forward direction in order to calculate the Wiener
application is straightforward; to use it in forward direction, we make use filter solution. Only its inverse application is straightforward; to use it in
of NIFTy's :class:`InversionEnabler` class, which internally performs a forward direction, we make use of NIFTy's
minimization of a :class:`QuadraticEnergy` by means of the :class:`~operators.inversion_enabler.InversionEnabler` class, which internally
:class:`ConjugateGradient` algorithm. performs a minimization of a
:class:`~minimization.quadratic_energy.QuadraticEnergy` by means of the
:class:`~minimization.conjugate_gradient.ConjugateGradient` algorithm. An
example is provided in
:func:`~ļibrary.wiener_filter_curvature.WienerFilterCurvature`.
...@@ -10,6 +10,9 @@ master_doc = 'index' ...@@ -10,6 +10,9 @@ master_doc = 'index'