nifty7.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.

apply_metric(x)[source]#
Parameters:

x (Field or MultiField) – Argument for the metric operator

Returns:

Output of the metric operator

Return type:

Field or MultiField

at(position)[source]#

Returns a new Energy object, initialized at position.

Parameters:

position (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:
  • position (Field) – Location in parameter space for the new Energy object.

  • grad (Field) – Energy gradient at the new position.

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