LinearOperator#

class LinearOperator(entries=None)[source]#

Linear state operator \(\Ophat_{\ell}(\qhat,\u) = \Ahat\qhat\) where \(\Ahat \in \RR^{r \times r}\).

Parameters:
entries(r, r) ndarray or None

Operator matrix \(\Ahat\).

Examples

>>> import numpy as np
>>> A = opinf.operators.LinearOperator()
>>> entries = np.random.random((10, 10))    # Operator matrix.
>>> A.set_entries(entries)
>>> A.shape
(10, 10)
>>> q = np.random.random(10)                # State vector.
>>> out = A.apply(q)                        # Apply the operator to q.
>>> np.allclose(out, entries @ q)
True
Properties:
entries#

Operator matrix \(\Ahat\).

shape#

Shape \((r, r)\) of the operator matrix \(\Ahat\).

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) = \Ahat\qhat\).

copy

Return a copy of the operator.

datablock

Return the data matrix block corresponding to the operator, the states.

galerkin

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

jacobian

Construct the state Jacobian of the operator: \(\ddqhat\Ophat_{\ell}(\qhat,\u)=\Ahat\).

load

Load an operator from an HDF5 file.

operator_dimension

Column dimension \(r\) of the operator matrix \(\Ahat\).

save

Save the operator to an HDF5 file.

set_entries

Set the operator matrix \(\Ahat\).

verify

Verify consistency between dimension properties and required methods.