ConstantOperator#

class ConstantOperator(entries=None)[source]#

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

Parameters
entries(r,) ndarray or None

Operator entries \(\chat\).

Examples

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

Properties

entries

Discrete representation of the operator, the matrix \(\Ohat\).

shape

Shape of the operator entries array.

state_dimension

Dimension 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\c\).

jacobian

Construct the state Jacobian of the operator.

load

Load an operator from an HDF5 file.

operator_dimension

Column dimension of the operator entries (always 1).

save

Save the operator to an HDF5 file.

set_entries

Set the entries attribute.