pymor.playground.operators package¶
Submodules¶
numpy module¶
-
class
pymor.playground.operators.numpy.
NumpyListVectorArrayMatrixOperator
(matrix, source_id=None, range_id=None, solver_options=None, name=None)[source]¶ Bases:
pymor.operators.numpy.NumpyMatrixOperator
Variant of
NumpyMatrixOperator
usingListVectorArray
instead ofNumpyVectorArray
.Methods
apply
,apply_adjoint
,apply_inverse
,as_range_array
,as_source_array
apply_inverse_adjoint
,assemble
,from_file
disable_logging
,enable_logging
,has_interface_name
,implementor_names
,implementors
Attributes
-
apply
(U, mu=None)[source]¶ Apply the operator to a
VectorArray
.Parameters
- U
VectorArray
of vectors to which the operator is applied.- mu
The
Parameter
for 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
Operator
op
,Parameter
mu
andVectorArrays
U
,V
in thesource
resp.range
we have:op.apply_adjoint(V, mu).dot(U) == V.dot(op.apply(U, mu))
Thus, when
op
is represented by a matrixM
,apply_adjoint
is given by left-multplication of (the complex conjugate of)M
withV
.Parameters
- V
VectorArray
of vectors to which the adjoint operator is applied.- mu
The
Parameter
for which to apply the adjoint operator.
Returns
VectorArray
of the adjoint operator evaluations.
-
apply_inverse
(V, mu=None, least_squares=False)[source]¶ Apply the inverse operator.
Parameters
- V
VectorArray
of vectors to which the inverse operator is applied.- 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.- check_finite
Test if solution only contains finite values.
- default_sparse_solver_backend
Default sparse solver backend to use (scipy, pyamg, generic).
Returns
VectorArray
of the inverse operator evaluations.Raises
- InversionError
The operator could not be inverted.
Defaults
check_finite, default_sparse_solver_backend (see
pymor.core.defaults
)
-
as_range_array
(mu=None)[source]¶ Return a
VectorArray
representation of the operator in its range space.In the case of a linear operator with
NumpyVectorSpace
assource
, this method returns for everyParameter
mu
aVectorArray
V
in the operator’srange
, such thatV.lincomb(U.to_numpy()) == self.apply(U, mu)
for all
VectorArrays
U
.Parameters
- mu
The
Parameter
for which to return theVectorArray
representation.
Returns
- V
The
VectorArray
defined above.
-
as_source_array
(mu=None)[source]¶ Return a
VectorArray
representation of the operator in its source space.In the case of a linear operator with
NumpyVectorSpace
asrange
, this method returns for everyParameter
mu
aVectorArray
V
in the operator’ssource
, such thatself.range.make_array(V.dot(U).T) == self.apply(U, mu)
for all
VectorArrays
U
.Parameters
- mu
The
Parameter
for which to return theVectorArray
representation.
Returns
- V
The
VectorArray
defined above.
-