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 entries \(\Ahat\).

Examples

>>> import numpy as np
>>> A = opinf.operators.LinearOperator()
>>> entries = np.random.random((10, 10))    # Operator entries.
>>> 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

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

save

Save the operator to an HDF5 file.

set_entries

Set the entries attribute.