pymor.algorithms.image

Classes

CollectOperatorRangeRules

RuleTable for the estimate_image algorithm.

CollectVectorRangeRules

RuleTable for the estimate_image algorithm.

Functions

estimate_image

Estimate the image of given Operators for all mu.

estimate_image_hierarchical

Estimate the image of given Operators for all mu.

class pymor.algorithms.image.CollectOperatorRangeRules(source, image, extends)[source]

Bases: RuleTable

RuleTable for the estimate_image algorithm.

action_BlockRowOperator = @match_class(BlockRowOperator)     def action_BlockRowOperator(self, op):         for j, block in enumerate(op.blocks[0]):             type(self)(self.source.blocks[j], self.image, self.extends).apply(block) [source]
action_ConcatenationOperator = @match_class(ConcatenationOperator)     def action_ConcatenationOperator(self, op):         if len(op.operators) == 1:             self.apply(op.operators[0])         else:             firstrange = op.operators[-1].range.empty()             type(self)(self.source, firstrange, self.extends).apply(op.operators[-1])             type(self)(firstrange, self.image, self.extends).apply(op.with_(operators=op.operators[:-1])) [source]
action_EmpiricalInterpolatedOperator = @match_class(EmpiricalInterpolatedOperator)     def action_EmpiricalInterpolatedOperator(self, op):         if hasattr(op, 'collateral_basis') and not self.extends:             self.image.append(op.collateral_basis) [source]
action_apply_operator = @match_generic(lambda op: op.linear and not op.parametric)     def action_apply_operator(self, op):         self.image.append(op.apply(self.source)) [source]
action_recurse = @match_class(LincombOperator, SelectionOperator)     def action_recurse(self, op):         self.apply_children(op) [source]
rules: list[rule] = [    @match_generic(lambda op: op.linear and not op.parametric)     def action_apply_operator(self, op):         self.image.append(op.apply(self.source)) ,     @match_class(LincombOperator, SelectionOperator)     def action_recurse(self, op):         self.apply_children(op) ,     @match_class(EmpiricalInterpolatedOperator)     def action_EmpiricalInterpolatedOperator(self, op):         if hasattr(op, 'collateral_basis') and not self.extends:             self.image.append(op.collateral_basis) ,     @match_class(ConcatenationOperator)     def action_ConcatenationOperator(self, op):         if len(op.operators) == 1:             self.apply(op.operators[0])         else:             firstrange = op.operators[-1].range.empty()             type(self)(self.source, firstrange, self.extends).apply(op.operators[-1])             type(self)(firstrange, self.image, self.extends).apply(op.with_(operators=op.operators[:-1])) ,     @match_class(BlockRowOperator)     def action_BlockRowOperator(self, op):         for j, block in enumerate(op.blocks[0]):             type(self)(self.source.blocks[j], self.image, self.extends).apply(block) ][source]

list of all defined rules.

class pymor.algorithms.image.CollectVectorRangeRules(image)[source]

Bases: RuleTable

RuleTable for the estimate_image algorithm.

action_ConcatenationOperator = @match_class(ConcatenationOperator)     def action_ConcatenationOperator(self, op):         if len(op.operators) == 1:             self.apply(op.operators[0])         else:             firstrange = op.operators[-1].range.empty()             CollectVectorRangeRules(firstrange).apply(op.operators[-1])             CollectOperatorRangeRules(firstrange, self.image, False).apply(op.with_(operators=op.operators[:-1])) [source]
action_VectorArray = @match_class(VectorArray)     def action_VectorArray(self, obj):         self.image.append(obj) [source]
action_as_range_array = @match_generic(lambda op: op.linear and not op.parametric)     def action_as_range_array(self, op):         self.image.append(op.as_range_array()) [source]
action_recurse = @match_class(LincombOperator, SelectionOperator)     def action_recurse(self, op):         self.apply_children(op) [source]
rules: list[rule] = [    @match_class(VectorArray)     def action_VectorArray(self, obj):         self.image.append(obj) ,     @match_generic(lambda op: op.linear and not op.parametric)     def action_as_range_array(self, op):         self.image.append(op.as_range_array()) ,     @match_class(LincombOperator, SelectionOperator)     def action_recurse(self, op):         self.apply_children(op) ,     @match_class(ConcatenationOperator)     def action_ConcatenationOperator(self, op):         if len(op.operators) == 1:             self.apply(op.operators[0])         else:             firstrange = op.operators[-1].range.empty()             CollectVectorRangeRules(firstrange).apply(op.operators[-1])             CollectOperatorRangeRules(firstrange, self.image, False).apply(op.with_(operators=op.operators[:-1])) ][source]

list of all defined rules.

pymor.algorithms.image.estimate_image(operators=(), vectors=(), domain=None, extends=False, orthonormalize=True, product=None, riesz_representatives=False)[source]

Estimate the image of given Operators for all mu.

Let operators be a list of Operators with common source and range, and let vectors be a list of VectorArrays or vector-like Operators in the range of these operators. Given a VectorArray domain of vectors in the source of the operators, this algorithm determines a VectorArray image of range vectors such that the linear span of image contains:

  • op.apply(U, mu=mu) for all operators op in operators, for all possible Parameters mu and for all VectorArrays U contained in the linear span of domain,

  • U for all VectorArrays in vectors,

  • v.as_range_array(mu) for all Operators in vectors and all possible Parameters mu.

The algorithm will try to choose image as small as possible. However, no optimality is guaranteed. The image estimation algorithm is specified by CollectOperatorRangeRules and CollectVectorRangeRules.

Parameters:
  • operators – See above.

  • vectors – See above.

  • domain – See above. If None, an empty domain VectorArray is assumed.

  • extends – For some operators, e.g. EmpiricalInterpolatedOperator, as well as for all elements of vectors, image is estimated independently from the choice of domain. If extends is True, such operators are ignored. (This is useful in case these vectors have already been obtained by earlier calls to this function.)

  • orthonormalize – Compute an orthonormal basis for the linear span of image using the gram_schmidt algorithm.

  • product – Inner product Operator w.r.t. which to orthonormalize.

  • riesz_representatives – If True, compute Riesz representatives of the vectors in image before orthonormalizing (useful for dual norm computation when the range of the operators is a dual space).

Returns:

The VectorArray image.

Raises:

ImageCollectionError – Is raised when for a given Operator no image estimate is possible.

pymor.algorithms.image.estimate_image_hierarchical(operators=(), vectors=(), domain=None, extends=None, orthonormalize=True, product=None, riesz_representatives=False)[source]

Estimate the image of given Operators for all mu.

This is an extended version of estimate_image, which calls estimate_image individually for each vector of domain.

As a result, the vectors in the returned image VectorArray will be ordered by the domain vector they correspond to (starting with vectors which correspond to the elements of vectors and to Operators for which the image is estimated independently from domain).

This function also returns an image_dims list, such that the first image_dims[i+1] vectors of image correspond to the first i vectors of domain (the first image_dims[0] vectors correspond to vectors and to Operators with fixed image estimate).

Parameters:
Returns:

  • image – See above.

  • image_dims – See above.

Raises:

ImageCollectionError – Is raised when for a given Operator no image estimate is possible.