pymor.playground.operators package¶
Submodules¶
numpy module¶

class
pymor.playground.operators.numpy.
NumpyListVectorArrayMatrixOperator
(matrix, functional=False, vector=False, solver_options=None, name=None)[source]¶ Bases:
pymor.operators.numpy.NumpyMatrixOperator
Variant of
NumpyMatrixOperator
usingListVectorArray
instead ofNumpyVectorArray
.Methods
Attributes

apply
(U, ind=None, mu=None)[source]¶ Apply the operator to a
VectorArray
.Parameters
 U
VectorArray
of vectors to which the operator is applied. ind
 The indices of the vectors in
U
to which the operator shall be applied (see theVectorArray
documentation for further details).  mu
 The
Parameter
for which to evaluate the operator.
Returns
VectorArray
of the operator evaluations.

apply_adjoint
(U, ind=None, mu=None, source_product=None, range_product=None)[source]¶ Apply the adjoint operator.
For a linear operator
op
the adjointop^*
ofop
is given by:(op^*(v), u)_s = (v, op(u))_r,
where
( , )_s
and( , )_r
denote the inner products on the source and range space ofop
. Ifop
and the two products are given by the matricesM
,P_s
andP_r
, then:op^*(v) = P_s^(1) * M^T * P_r * v,
with
M^T
denoting the transposed ofM
. Thus, if( , )_s
and( , )_r
are the Euclidean inner products,op^*v
is simply given by multiplication of the matrix ofop
withv
from the left.Parameters
 U
VectorArray
of vectors to which the adjoint operator is applied. ind
 The indices of the vectors in
U
to which the operator shall be applied (see theVectorArray
documentation for further details).  mu
 The
Parameter
for which to apply the adjoint operator.  source_product
 The inner product
Operator
on the source space. IfNone
, the Euclidean product is chosen.  range_product
 The inner product
Operator
on the range space. IfNone
, the Euclidean product is chosen.
Returns
VectorArray
of the adjoint operator evaluations.

apply_inverse
(V, ind=None, mu=None, least_squares=False)[source]¶ Apply the inverse operator.
Parameters
 V
VectorArray
of vectors to which the inverse operator is applied. ind
 The indices of the vectors in
V
to which the inverse operator shall be applied (seeVectorArray
documentation for further details).  mu
 The
Parameter
for which to evaluate the inverse operator.  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_options
are 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.

as_vector
(mu=None)[source]¶ Return a vector representation of a linear functional or vector operator.
This method may only be called on linear functionals, i.e. linear
Operators
withNumpyVectorSpace
(1)
asrange
, or on operators describing vectors, i.e. linearOperators
withNumpyVectorSpace
(1)
assource
.In the case of a functional, the identity
self.as_vector(mu).dot(U) == self.apply(U, mu)
holds, whereas in the case of a vectorlike operator we have
self.as_vector(mu) == self.apply(NumpyVectorArray(1), mu).
Parameters
 mu
 The
Parameter
for which to return the vector representation.
Returns
 V
VectorArray
of length 1 containing the vector representation.V
belongs toself.source
for functionals and toself.range
for vectorlike operators.

assemble_lincomb
(operators, coefficients, solver_options=None, name=None)[source]¶ Try to assemble a linear combination of the given operators.
This method is called in the
assemble
method ofLincombOperator
on the first of its operator. If an assembly of the given linear combination is possible, e.g. the linear combination of the system matrices of the operators can be formed, then the assembled operator is returned. Otherwise, the method returnsNone
to indicate that assembly is not possible.Parameters
 operators
 List of
Operators
whose linear combination is formed.  coefficients
 List of the corresponding linear coefficients.
 solver_options
solver_options
for the assembled operator. name
 Name of the assembled operator.
Returns
The assembled
Operator
if assembly is possible, otherwiseNone
.
