AffineConstantOperator#

class AffineConstantOperator(coeffs, nterms: int = None, entries=None, fromblock: bool = False)[source]#

Affine-parametric constant operator \(\Ophat_{\ell}(\qhat,\u;\bfmu) = \chat_{\ell}(\bfmu) = \sum_{a=0}^{A_{\ell}-1}\theta_\ell^{(a)}\!(\bfmu)\,\chat_{\ell}^{(a)}.\)

Here, each \(\theta_\ell^{(a)}:\RR^{p}\to\RR\) is a scalar-valued function of the parameter vector and each \(\chat_{\ell}^{(a)} \in \RR^r\) is a constant vector, see opinf.operators.ConstantOperator.

Parameters:
coeffscallable, (iterable of callables), or int

Coefficient functions for the terms of the affine expansion.

  • If callable, it should receive a parameter vector \(\bfmu\) and return the vector of affine coefficients, \([~\theta_{\ell}^{(0)}(\bfmu) ~~\cdots~~\theta_{\ell}^{(A_{\ell}-1)}(\bfmu)~]\trp\). In this case, nterms is a required argument.

  • If an iterable, each entry should be a callable representing a single affine coefficient function \(\theta_{\ell}^{(a)}\).

  • If an integer \(p\), set \(A_{\ell} = p\) and define \(\theta_{\ell}^{(i)}\!(\bfmu) = \mu_i\). This is equivalent to using coeffs=lambda mu: mu, except the parameter dimension is also captured and nterms is not required.

entrieslist of ndarrays, or None

Operator vectors for each term of the affine expansion, i.e., \(\chat_{\ell}^{(0)},\ldots,\chat_{\ell}^{(A_{\ell}-1)}.\) If not provided in the constructor, use set_entries() later.

fromblockbool

If True, interpret entries as a horizontal concatenation of arrays; if False (default), interpret entries as a list of arrays.

Properties:
entries#

Operator matrices for each term of the affine expansion, i.e., \(\Ohat_{\ell}^{(0)},\ldots,\Ohat_{\ell}^{(A_{\ell}-1)}.\)

nterms#

Number of terms \(A_{\ell}\) in the affine expansion.

parameter_dimension#

Dimension \(p\) of the parameter vector \(\bfmu\) that the operator matrix depends on.

shape#

Shape of the operator matrix when evaluated at a parameter value.

state_dimension#

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

Methods:

apply

Apply the operator to the given state and input at the specified parameter value, \(\Ophat_\ell(\qhat,\u;\bfmu)\).

coeffs

Evaluate the coefficient functions for each term of the affine expansion for a given parameter vector.

copy

Return a copy of the operator.

datablock

Return the data matrix block corresponding to the operator.

evaluate

Evaluate the operator at the given parameter value.

galerkin

Project this operator to a low-dimensional linear space.

jacobian

Construct the state Jacobian of the operator, \(\ddqhat\Ophat_\ell(\qhat,\u;\bfmu)\).

load

Load an affine parametric operator from an HDF5 file.

operator_dimension

Number of columns in the concatenated operator matrix.

save

Save the operator to an HDF5 file.

set_entries

Set the operator matrices for each term of the affine expansion.

verify

Verify dimension attributes and evaluate().