# `pymor.algorithms.simplify`¶

## Module Contents¶

class pymor.algorithms.simplify.ContractRules[source]

Define algorithm by a table of match conditions and corresponding actions.

`RuleTable` manages a table of `rules`, stored in the `rules` attributes, which can be `applied` to given objects.

A new table is created by subclassing `RuleTable` and defining new methods which are decorated with `match_class`, `match_generic` or another `rule` subclass. The order of the method definitions determines the order in which the defined `rules` are applied.

Parameters

use_caching

If `True`, cache results of `apply`.

rules[source]

`list` of all defined `rules`.

action_ConcatenationOperator(self, op)[source]
action_LincombOperator(self, op)[source]
action_recurse(self, op)[source]
class pymor.algorithms.simplify.ExpandRules[source]

Define algorithm by a table of match conditions and corresponding actions.

`RuleTable` manages a table of `rules`, stored in the `rules` attributes, which can be `applied` to given objects.

A new table is created by subclassing `RuleTable` and defining new methods which are decorated with `match_class`, `match_generic` or another `rule` subclass. The order of the method definitions determines the order in which the defined `rules` are applied.

Parameters

use_caching

If `True`, cache results of `apply`.

rules[source]

`list` of all defined `rules`.

action_ConcatenationOperator(self, op)[source]
action_LincombOperator(self, op)[source]
action_recurse(self, op)[source]
pymor.algorithms.simplify.contract(obj)[source]

Contract linear combinations and concatenations of `Operators`.

To any given `Operator` or `Model`, the following transformations are applied recursively:

Parameters

obj

Either a `Model` or an `Operator` to which the contraction rules are applied recursively for all `children`.

Returns

The transformed object.

pymor.algorithms.simplify.expand(obj)[source]

Expand concatenations of LincombOperators.

To any given `Operator` or `Model`, the following transformations are applied recursively:

Parameters

obj

Either a `Model` or an `Operator` to which the expansion rules are applied recursively for all `children`.

Returns

The transformed object.