pymor.algorithms.simplify
¶
Module Contents¶
- class pymor.algorithms.simplify.ContractRules[source]¶
Bases:
pymor.algorithms.rules.RuleTable
Define algorithm by a table of match conditions and corresponding actions.
RuleTable
manages a table ofrules
, stored in therules
attributes, which can beapplied
to given objects.A new table is created by subclassing
RuleTable
and defining new methods which are decorated withmatch_class
,match_generic
or anotherrule
subclass. The order of the method definitions determines the order in which the definedrules
are applied.Parameters
- use_caching
If
True
, cache results ofapply
.
- class pymor.algorithms.simplify.ExpandRules[source]¶
Bases:
pymor.algorithms.rules.RuleTable
Define algorithm by a table of match conditions and corresponding actions.
RuleTable
manages a table ofrules
, stored in therules
attributes, which can beapplied
to given objects.A new table is created by subclassing
RuleTable
and defining new methods which are decorated withmatch_class
,match_generic
or anotherrule
subclass. The order of the method definitions determines the order in which the definedrules
are applied.Parameters
- use_caching
If
True
, cache results ofapply
.
- pymor.algorithms.simplify.contract(obj)[source]¶
Contract linear combinations and concatenations of
Operators
.To any given
Operator
orModel
, the following transformations are applied recursively:Concatenations
of non-parametric linearOperators
are contracted into a singleOperator
when possible. Products of sparse matrices are not computed, however.Non-parametric
linear combinations
of non-parametric operators are merged.
Parameters
Returns
The transformed object.
- pymor.algorithms.simplify.expand(obj)[source]¶
Expand concatenations of LincombOperators.
To any given
Operator
orModel
, the following transformations are applied recursively:Concatenations
ofLincombOperators
are expanded. E.g.(O1 + O2) @ (O3 + O4)
becomes:
O1 @ O3 + O1 @ O4 + O2 @ O3 + O2 @ O4
LincombOperators
insideLincombOperators
are merged into a singleLincombOperator
ConcatenationOperators
insideConcatenationOperators
are merged into a singleConcatenationOperator
.
Parameters
Returns
The transformed object.