pymor.operators.list

Module Contents

Classes

ListVectorArrayOperatorBase

Interface for Parameter dependent discrete operators.

LinearComplexifiedListVectorArrayOperatorBase

Interface for Parameter dependent discrete operators.

NumpyListVectorArrayMatrixOperator

Variant of NumpyMatrixOperator using ListVectorArray instead of NumpyVectorArray.

class pymor.operators.list.ListVectorArrayOperatorBase[source]

Bases: pymor.operators.interface.Operator

Interface for Parameter dependent discrete operators.

An operator in pyMOR is simply a mapping which for any given parameter values maps vectors from its source VectorSpace to vectors in its range VectorSpace.

Note that there is no special distinction between functionals and operators in pyMOR. A functional is simply an operator with NumpyVectorSpace (1) as its range VectorSpace.

solver_options[source]

If not None, a dict which can contain the following keys:

‘inverse’

solver options used for apply_inverse

‘inverse_adjoint’

solver options used for apply_inverse_adjoint

‘jacobian’

solver options for the operators returned by jacobian (has no effect for linear operators)

If solver_options is None or a dict entry is missing or None, default options are used. The interpretation of the given solver options is up to the operator at hand. In general, values in solver_options should either be strings (indicating a solver type) or dicts of options, usually with an entry 'type' which specifies the solver type to use and further items which configure this solver.

linear[source]

True if the operator is linear.

source[source]

The source VectorSpace.

range[source]

The range VectorSpace.

H[source]

The adjoint operator, i.e.

self.H.apply(V, mu) == self.apply_adjoint(V, mu)

for all V, mu.

_prepare_apply(self, U, mu, kind, least_squares=False)[source]
abstract _apply_one_vector(self, u, mu=None, prepare_data=None)[source]
abstract _apply_inverse_one_vector(self, v, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
abstract _apply_adjoint_one_vector(self, v, mu=None, prepare_data=None)[source]
abstract _apply_inverse_adjoint_one_vector(self, u, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
apply(self, U, mu=None)[source]

Apply the operator to a VectorArray.

Parameters

U

VectorArray of vectors to which the operator is applied.

mu

The parameter values for which to evaluate the operator.

Returns

VectorArray of the operator evaluations.

apply_inverse(self, V, mu=None, initial_guess=None, least_squares=False)[source]

Apply the inverse operator.

Parameters

V

VectorArray of vectors to which the inverse operator is applied.

mu

The parameter values for which to evaluate the inverse operator.

initial_guess

VectorArray with the same length as V containing initial guesses for the solution. Some implementations of apply_inverse may ignore this parameter. If None a 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_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.

apply_adjoint(self, V, mu=None)[source]

Apply the adjoint operator.

For any given linear Operator op, parameter values mu and VectorArrays U, V in the source resp. range we have:

op.apply_adjoint(V, mu).dot(U) == V.inner(op.apply(U, mu))

Thus, when op is represented by a matrix M, apply_adjoint is given by left-multplication of (the complex conjugate of) M with V.

Parameters

V

VectorArray of vectors to which the adjoint operator is applied.

mu

The parameter values for which to apply the adjoint operator.

Returns

VectorArray of the adjoint operator evaluations.

apply_inverse_adjoint(self, U, mu=None, initial_guess=None, least_squares=False)[source]

Apply the inverse adjoint operator.

Parameters

U

VectorArray of vectors to which the inverse adjoint operator is applied.

mu

The parameter values for which to evaluate the inverse adjoint operator.

initial_guess

VectorArray with the same length as U containing initial guesses for the solution. Some implementations of apply_inverse_adjoint may ignore this parameter. If None a 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_options are 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.

class pymor.operators.list.LinearComplexifiedListVectorArrayOperatorBase[source]

Bases: ListVectorArrayOperatorBase

Interface for Parameter dependent discrete operators.

An operator in pyMOR is simply a mapping which for any given parameter values maps vectors from its source VectorSpace to vectors in its range VectorSpace.

Note that there is no special distinction between functionals and operators in pyMOR. A functional is simply an operator with NumpyVectorSpace (1) as its range VectorSpace.

solver_options[source]

If not None, a dict which can contain the following keys:

‘inverse’

solver options used for apply_inverse

‘inverse_adjoint’

solver options used for apply_inverse_adjoint

‘jacobian’

solver options for the operators returned by jacobian (has no effect for linear operators)

If solver_options is None or a dict entry is missing or None, default options are used. The interpretation of the given solver options is up to the operator at hand. In general, values in solver_options should either be strings (indicating a solver type) or dicts of options, usually with an entry 'type' which specifies the solver type to use and further items which configure this solver.

linear[source]

True if the operator is linear.

source[source]

The source VectorSpace.

range[source]

The range VectorSpace.

H[source]

The adjoint operator, i.e.

self.H.apply(V, mu) == self.apply_adjoint(V, mu)

for all V, mu.

abstract _real_apply_one_vector(self, u, mu=None, prepare_data=None)[source]
abstract _real_apply_inverse_one_vector(self, v, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
abstract _real_apply_adjoint_one_vector(self, v, mu=None, prepare_data=None)[source]
abstract _real_apply_inverse_adjoint_one_vector(self, u, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
_apply_one_vector(self, u, mu=None, prepare_data=None)[source]
_apply_inverse_one_vector(self, v, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
_apply_adjoint_one_vector(self, v, mu=None, prepare_data=None)[source]
_apply_inverse_adjoint_one_vector(self, u, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
class pymor.operators.list.NumpyListVectorArrayMatrixOperator(matrix, source_id=None, range_id=None, solver_options=None, name=None)[source]

Bases: ListVectorArrayOperatorBase, pymor.operators.numpy.NumpyMatrixOperator

Variant of NumpyMatrixOperator using ListVectorArray instead of NumpyVectorArray.

This class is mainly intended for performance tests of ListVectorArray. In general NumpyMatrixOperator should be used instead of this class.

Parameters

matrix

The NumPy array which is to be wrapped.

source_id

The id of the operator’s source VectorSpace.

range_id

The id of the operator’s range VectorSpace.

solver_options

The solver_options for the operator.

name

Name of the operator.

_apply_one_vector(self, u, mu=None, prepare_data=None)[source]
_apply_inverse_one_vector(self, v, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
apply_adjoint(self, V, mu=None)[source]

Apply the adjoint operator.

For any given linear Operator op, parameter values mu and VectorArrays U, V in the source resp. range we have:

op.apply_adjoint(V, mu).dot(U) == V.inner(op.apply(U, mu))

Thus, when op is represented by a matrix M, apply_adjoint is given by left-multplication of (the complex conjugate of) M with V.

Parameters

V

VectorArray of vectors to which the adjoint operator is applied.

mu

The parameter values for which to apply the adjoint operator.

Returns

VectorArray of the adjoint operator evaluations.

apply_inverse_adjoint(self, U, mu=None, initial_guess=None, least_squares=False)[source]

Apply the inverse adjoint operator.

Parameters

U

VectorArray of vectors to which the inverse adjoint operator is applied.

mu

The parameter values for which to evaluate the inverse adjoint operator.

initial_guess

VectorArray with the same length as U containing initial guesses for the solution. Some implementations of apply_inverse_adjoint may ignore this parameter. If None a 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_options are 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_lincomb(self, operators, coefficients, identity_shift=0.0, solver_options=None, name=None)[source]

Try to assemble a linear combination of the given operators.

Returns a new Operator which represents the sum

c_1*O_1 + ... + c_N*O_N + s*I

where O_i are Operators, c_i, s scalar coefficients and I the identity.

This method is called in the assemble method of LincombOperator on the first of its operators. 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 returns None to indicate that assembly is not possible.

Parameters

operators

List of Operators O_i whose linear combination is formed.

coefficients

List of the corresponding linear coefficients c_i.

identity_shift

The coefficient s.

solver_options

solver_options for the assembled operator.

name

Name of the assembled operator.

Returns

The assembled Operator if assembly is possible, otherwise None.