pymor.operators.block¶
Module Contents¶
- class pymor.operators.block.BlockColumnOperator(blocks, name=None)[source]¶
Bases:
BlockOperatorBaseA column vector of arbitrary
Operators.
- class pymor.operators.block.BlockDiagonalOperator(blocks, name=None)[source]¶
Bases:
BlockOperatorBlock diagonal
Operatorof arbitraryOperators.This is a specialization of
BlockOperatorfor the block diagonal case.Methods
Apply the operator to a
VectorArray.Apply the adjoint operator.
Apply the inverse operator.
Apply the inverse adjoint operator.
Assemble the operator for given
parameter values.- apply(U, mu=None)[source]¶
Apply the operator to a
VectorArray.- Parameters:
U –
VectorArrayof vectors to which the operator is applied.mu – The
parameter valuesfor which to evaluate the operator.
- Returns:
|VectorArray| of the operator evaluations.
- apply_adjoint(V, mu=None)[source]¶
Apply the adjoint operator.
For any given linear
Operatorop,parameter valuesmuandVectorArraysU,Vin thesourceresp.rangewe have:op.apply_adjoint(V, mu).dot(U) == V.inner(op.apply(U, mu))
Thus, when
opis represented by a matrixM,apply_adjointis given by left-multiplication of (the complex conjugate of)MwithV.- Parameters:
V –
VectorArrayof vectors to which the adjoint operator is applied.mu – The
parameter valuesfor which to apply the adjoint operator.
- Returns:
|VectorArray| of the adjoint operator evaluations.
- apply_inverse(V, mu=None, initial_guess=None, least_squares=False)[source]¶
Apply the inverse operator.
- Parameters:
V –
VectorArrayof vectors to which the inverse operator is applied.mu – The
parameter valuesfor which to evaluate the inverse operator.initial_guess –
VectorArraywith the same length asVcontaining initial guesses for the solution. Some implementations ofapply_inversemay ignore this parameter. IfNonea solver-dependent default is used.least_squares –
If
True, solve the least squares problem:u = argmin ||op(u) - v||_2.
Since for an invertible operator the least squares solution agrees with the result of the application of the inverse operator, setting this option should, in general, have no effect on the result for those operators. However, note that when no appropriate
solver_optionsare set for the operator, most implementations will choose a least squares solver by default which may be undesirable.
- Returns:
|VectorArray| of the inverse operator evaluations.
- Raises:
InversionError – The operator could not be inverted.
- apply_inverse_adjoint(U, mu=None, initial_guess=None, least_squares=False)[source]¶
Apply the inverse adjoint operator.
- Parameters:
U –
VectorArrayof vectors to which the inverse adjoint operator is applied.mu – The
parameter valuesfor which to evaluate the inverse adjoint operator.initial_guess –
VectorArraywith the same length asUcontaining initial guesses for the solution. Some implementations ofapply_inverse_adjointmay ignore this parameter. IfNonea solver-dependent default is used.least_squares –
If
True, solve the least squares problem:v = argmin ||op^*(v) - u||_2.
Since for an invertible operator the least squares solution agrees with the result of the application of the inverse operator, setting this option should, in general, have no effect on the result for those operators. However, note that when no appropriate
solver_optionsare set for the operator, most operator implementations will choose a least squares solver by default which may be undesirable.
- Returns:
|VectorArray| of the inverse adjoint operator evaluations.
- Raises:
InversionError – The operator could not be inverted.
- assemble(mu=None)[source]¶
Assemble the operator for given
parameter values.The result of the method strongly depends on the given operator. For instance, a matrix-based operator will assemble its matrix, a
LincombOperatorwill try to form the linear combination of its operators, whereas an arbitrary operator might simply return aFixedParameterOperator. The only assured property of the assembled operator is that it no longer depends on aParameter.- Parameters:
mu – The
parameter valuesfor which to assemble the operator.- Returns:
Parameter-independent, assembled |Operator|.
- class pymor.operators.block.BlockEmbeddingOperator(block_space, component, name=None)[source]¶
Bases:
BlockColumnOperatorA column vector of arbitrary
Operators.
- class pymor.operators.block.BlockOperator(blocks, name=None)[source]¶
Bases:
BlockOperatorBaseA matrix of arbitrary
Operators.This operator can be
appliedto a compatibleBlockVectorArrays.- Parameters:
blocks – Two-dimensional array-like where each entry is an
OperatororNone.
- class pymor.operators.block.BlockOperatorBase(blocks, name=None)[source]¶
Bases:
pymor.operators.interface.OperatorBase block
Operator.Methods
Apply the operator to a
VectorArray.Apply the adjoint operator.
Return a
VectorArrayrepresentation of the operator in its range space.Return a
VectorArrayrepresentation of the operator in its source space.Assemble the operator for given
parameter values.Return the operator's derivative with respect to a given parameter.
Return the operator's Jacobian as a new
Operator.- apply(U, mu=None)[source]¶
Apply the operator to a
VectorArray.- Parameters:
U –
VectorArrayof vectors to which the operator is applied.mu – The
parameter valuesfor which to evaluate the operator.
- Returns:
|VectorArray| of the operator evaluations.
- apply_adjoint(V, mu=None)[source]¶
Apply the adjoint operator.
For any given linear
Operatorop,parameter valuesmuandVectorArraysU,Vin thesourceresp.rangewe have:op.apply_adjoint(V, mu).dot(U) == V.inner(op.apply(U, mu))
Thus, when
opis represented by a matrixM,apply_adjointis given by left-multiplication of (the complex conjugate of)MwithV.- Parameters:
V –
VectorArrayof vectors to which the adjoint operator is applied.mu – The
parameter valuesfor which to apply the adjoint operator.
- Returns:
|VectorArray| of the adjoint operator evaluations.
- as_range_array(mu=None)[source]¶
Return a
VectorArrayrepresentation of the operator in its range space.In the case of a linear operator with
NumpyVectorSpaceassource, this method returns for givenparameter valuesmuaVectorArrayVin the operator’srange, such thatV.lincomb(U.to_numpy()) == self.apply(U, mu)
for all
VectorArraysU.- Parameters:
mu – The
parameter valuesfor which to return theVectorArrayrepresentation.- Returns:
V – The
VectorArraydefined above.
- as_source_array(mu=None)[source]¶
Return a
VectorArrayrepresentation of the operator in its source space.In the case of a linear operator with
NumpyVectorSpaceasrange, this method returns for givenparameter valuesmuaVectorArrayVin the operator’ssource, such thatself.range.make_array(V.inner(U)) == self.apply(U, mu)
for all
VectorArraysU.- Parameters:
mu – The
parameter valuesfor which to return theVectorArrayrepresentation.- Returns:
V – The
VectorArraydefined above.
- assemble(mu=None)[source]¶
Assemble the operator for given
parameter values.The result of the method strongly depends on the given operator. For instance, a matrix-based operator will assemble its matrix, a
LincombOperatorwill try to form the linear combination of its operators, whereas an arbitrary operator might simply return aFixedParameterOperator. The only assured property of the assembled operator is that it no longer depends on aParameter.- Parameters:
mu – The
parameter valuesfor which to assemble the operator.- Returns:
Parameter-independent, assembled |Operator|.
- d_mu(parameter, index=0)[source]¶
Return the operator’s derivative with respect to a given parameter.
- Parameters:
parameter – The parameter w.r.t. which to return the derivative.
index – Index of the parameter’s component w.r.t which to return the derivative.
- Returns:
New |Operator| representing the partial derivative.
- jacobian(U, mu)[source]¶
Return the operator’s Jacobian as a new
Operator.- Parameters:
U – Length 1
VectorArraycontaining the vector for which to compute the Jacobian.mu – The
parameter valuesfor which to compute the Jacobian.
- Returns:
Linear |Operator| representing the Jacobian.
- class pymor.operators.block.BlockProjectionOperator(block_space, component, name=None)[source]¶
Bases:
BlockRowOperatorA row vector of arbitrary
Operators.
- class pymor.operators.block.BlockRowOperator(blocks, name=None)[source]¶
Bases:
BlockOperatorBaseA row vector of arbitrary
Operators.
- class pymor.operators.block.SecondOrderModelOperator(alpha, beta, A, B, name=None)[source]¶
Bases:
BlockOperatorBlockOperator appearing in SecondOrderModel.to_lti().
This represents a block operator
\[\begin{split}\mathcal{A} = \begin{bmatrix} \alpha I & \beta I \\ B & A \end{bmatrix},\end{split}\]which satisfies
\[\begin{split}\mathcal{A}^H &= \begin{bmatrix} \overline{\alpha} I & B^H \\ \overline{\beta} I & A^H \end{bmatrix}, \\ \mathcal{A}^{-1} &= \begin{bmatrix} (\alpha A - \beta B)^{-1} A & -\beta (\alpha A - \beta B)^{-1} \\ -(\alpha A - \beta B)^{-1} B & \alpha (\alpha A - \beta B)^{-1} \end{bmatrix}, \\ \mathcal{A}^{-H} &= \begin{bmatrix} A^H (\alpha A - \beta B)^{-H} & -B^H (\alpha A - \beta B)^{-H} \\ -\overline{\beta} (\alpha A - \beta B)^{-H} & \overline{\alpha} (\alpha A - \beta B)^{-H} \end{bmatrix}.\end{split}\]Methods
Apply the operator to a
VectorArray.Apply the adjoint operator.
Apply the inverse operator.
Apply the inverse adjoint operator.
Assemble the operator for given
parameter values.- apply(U, mu=None)[source]¶
Apply the operator to a
VectorArray.- Parameters:
U –
VectorArrayof vectors to which the operator is applied.mu – The
parameter valuesfor which to evaluate the operator.
- Returns:
|VectorArray| of the operator evaluations.
- apply_adjoint(V, mu=None)[source]¶
Apply the adjoint operator.
For any given linear
Operatorop,parameter valuesmuandVectorArraysU,Vin thesourceresp.rangewe have:op.apply_adjoint(V, mu).dot(U) == V.inner(op.apply(U, mu))
Thus, when
opis represented by a matrixM,apply_adjointis given by left-multiplication of (the complex conjugate of)MwithV.- Parameters:
V –
VectorArrayof vectors to which the adjoint operator is applied.mu – The
parameter valuesfor which to apply the adjoint operator.
- Returns:
|VectorArray| of the adjoint operator evaluations.
- apply_inverse(V, mu=None, initial_guess=None, least_squares=False)[source]¶
Apply the inverse operator.
- Parameters:
V –
VectorArrayof vectors to which the inverse operator is applied.mu – The
parameter valuesfor which to evaluate the inverse operator.initial_guess –
VectorArraywith the same length asVcontaining initial guesses for the solution. Some implementations ofapply_inversemay ignore this parameter. IfNonea solver-dependent default is used.least_squares –
If
True, solve the least squares problem:u = argmin ||op(u) - v||_2.
Since for an invertible operator the least squares solution agrees with the result of the application of the inverse operator, setting this option should, in general, have no effect on the result for those operators. However, note that when no appropriate
solver_optionsare set for the operator, most implementations will choose a least squares solver by default which may be undesirable.
- Returns:
|VectorArray| of the inverse operator evaluations.
- Raises:
InversionError – The operator could not be inverted.
- apply_inverse_adjoint(U, mu=None, initial_guess=None, least_squares=False)[source]¶
Apply the inverse adjoint operator.
- Parameters:
U –
VectorArrayof vectors to which the inverse adjoint operator is applied.mu – The
parameter valuesfor which to evaluate the inverse adjoint operator.initial_guess –
VectorArraywith the same length asUcontaining initial guesses for the solution. Some implementations ofapply_inverse_adjointmay ignore this parameter. IfNonea solver-dependent default is used.least_squares –
If
True, solve the least squares problem:v = argmin ||op^*(v) - u||_2.
Since for an invertible operator the least squares solution agrees with the result of the application of the inverse operator, setting this option should, in general, have no effect on the result for those operators. However, note that when no appropriate
solver_optionsare set for the operator, most operator implementations will choose a least squares solver by default which may be undesirable.
- Returns:
|VectorArray| of the inverse adjoint operator evaluations.
- Raises:
InversionError – The operator could not be inverted.
- assemble(mu=None)[source]¶
Assemble the operator for given
parameter values.The result of the method strongly depends on the given operator. For instance, a matrix-based operator will assemble its matrix, a
LincombOperatorwill try to form the linear combination of its operators, whereas an arbitrary operator might simply return aFixedParameterOperator. The only assured property of the assembled operator is that it no longer depends on aParameter.- Parameters:
mu – The
parameter valuesfor which to assemble the operator.- Returns:
Parameter-independent, assembled |Operator|.