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 andnterms
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
, interpretentries
as a horizontal concatenation of arrays; ifFalse
(default), interpretentries
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 the operator to the given state and input at the specified parameter value, \(\Ophat_\ell(\qhat,\u;\bfmu)\).
Evaluate the coefficient functions for each term of the affine expansion for a given parameter vector.
Return a copy of the operator.
Return the data matrix block corresponding to the operator.
Evaluate the operator at the given parameter value.
Project this operator to a low-dimensional linear space.
Construct the state Jacobian of the operator, \(\ddqhat\Ophat_\ell(\qhat,\u;\bfmu)\).
Load an affine parametric operator from an HDF5 file.
Number of columns in the concatenated operator matrix.
Save the operator to an HDF5 file.
Set the operator matrices for each term of the affine expansion.
Verify dimension attributes and
evaluate()
.