ConstantOperator#

class ConstantOperator(entries=None)[source]#

Constant operator \(\Ophat_{\ell}(\qhat,\u) = \chat \in \RR^{r}\).

Parameters:
entries(r,) ndarray or None

Operator vector \(\chat\).

Examples

>>> import numpy as np
>>> c = opinf.operators.ConstantOperator()
>>> entries = np.random.random(10)          # Operator vector.
>>> c.set_entries(np.random.random(10))
>>> c.shape
(10,)
>>> out = c.apply()                         # "Apply" the operator.
>>> np.allclose(out, entries)
True
Properties:
entries#

Operator vector \(\chat\).

shape#

Shape \((r,)\) of the operator vector \(\chat\).

state_dimension#

Dimension \(r\) of the state \(\qhat\) that the operator acts on.

Methods:

apply

Apply the operator to the given state / input: \(\Ophat_{\ell}(\qhat,\u) = \chat\).

copy

Return a copy of the operator.

datablock

Return the data matrix block corresponding to the operator, a row vector of ones.

galerkin

Return the Galerkin projection of the operator, \(\chat = (\Wr\trp\Vr)^{-1}\Wr\trp\c\).

jacobian

Construct the state Jacobian of the operator.

load

Load an operator from an HDF5 file.

operator_dimension

Column dimension of the operator vector (always 1).

save

Save the operator to an HDF5 file.

set_entries

Set the operator vector \(\chat\).

verify

Verify consistency between dimension properties and required methods.