nifty8.minimization.energy module#
- class Energy(position)[source]#
Bases:
object
Provides the functional used by minimization schemes.
The Energy object is an implementation of a scalar function including its gradient and metric at some position.
- Parameters:
position (
nifty8.field.Field
) – The input parameter of the scalar function.
Notes
An instance of the Energy class is defined at a certain location. If one is interested in the value, gradient or metric of the abstract energy functional one has to ‘jump’ to the new position using the at method. This method returns a new energy instance residing at the new position. By this approach, intermediate results from computing e.g. the gradient can safely be reused for e.g. the value or the metric.
Memorizing the evaluations of some quantities minimizes the computational effort for multiple calls.
- apply_metric(x)[source]#
- Parameters:
x (
nifty8.field.Field
ornifty8.multi_field.MultiField
) – Argument for the metric operator- Returns:
Output of the metric operator
- Return type:
- at(position)[source]#
Returns a new Energy object, initialized at position.
- Parameters:
position (
nifty8.field.Field
) – Location in parameter space for the new Energy object.- Returns:
Energy object at new position.
- Return type:
- property gradient#
The gradient at given position.
- Type:
field
- property gradient_norm#
L2-norm of the gradient at given position.
- Type:
float
- longest_step(direction)[source]#
Returns the longest allowed step size along direction
- Parameters:
direction (
nifty8.field.Field
) – the search direction- Returns:
the longest allowed step when starting from self.position along direction. If None, the step size is not limited.
- Return type:
float or None
- property metric#
implicitly defined metric. A positive semi-definite operator or function describing the metric of the potential at the given position.
- Type:
- property position#
selected location in parameter space.
The Field location in parameter space where value, gradient and metric are evaluated.
- Type:
field
- property value#
value of the functional.
The value of the energy functional at given position.
- Type:
float