nifty8.minimization.quadratic_energy module#

class QuadraticEnergy(position, A, b, _grad=None)[source]#

Bases: Energy

The Energy for a quadratic form. The most important aspect of this energy is that its metric must be position-independent.

__init__(position, A, b, _grad=None)[source]#
apply_metric(x)[source]#
Parameters:

x (nifty8.field.Field or nifty8.multi_field.MultiField) – Argument for the metric operator

Returns:

Output of the metric operator

Return type:

nifty8.field.Field or nifty8.multi_field.MultiField

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:

Energy

at_with_grad(position, grad)[source]#

Specialized version of at, taking also a gradient.

This custom method is meant for use within :class:ConjugateGradient` minimizers, which already have the gradient available. It saves time by not recomputing it.

Parameters:
Returns:

Energy object at new position.

Return type:

Energy

property gradient#

The gradient at given position.

Type:

field

property metric#

implicitly defined metric. A positive semi-definite operator or function describing the metric of the potential at the given position.

Type:

LinearOperator

property value#

value of the functional.

The value of the energy functional at given position.

Type:

float