loki.expression.operations

Sub-classes of Pymbolic’s native operations that allow us to express niche things like mathematically irrelevant parenthesis that nevertheless change code results.

Classes

ParenthesisedAdd(*args, **kwargs)

Specialised version of Sum that always pretty-prints and code-generates with explicit parentheses.

ParenthesisedDiv(*args, **kwargs)

Specialised version of Quotient that always pretty-prints and code-generates with explicit parentheses.

ParenthesisedMul(*args, **kwargs)

Specialised version of Product that always pretty-prints and code-generates with explicit parentheses.

ParenthesisedPow(*args, **kwargs)

Specialised version of Power that always pretty-prints and code-generates with explicit parentheses.

StringConcat(*args, **kwargs)

Implements string concatenation in a way similar to Sum.

class ParenthesisedAdd(*args, **kwargs)

Bases: Sum

Specialised version of Sum that always pretty-prints and code-generates with explicit parentheses.

mapper_method = 'map_parenthesised_add'
make_stringifier(originating_stringifier=None)

Return a LokiStringifyMapper instance that can be used to generate a human-readable representation of self.

This is used as common abstraction for the make_stringifier() method in Pymbolic expression nodes.

class ParenthesisedMul(*args, **kwargs)

Bases: Product

Specialised version of Product that always pretty-prints and code-generates with explicit parentheses.

mapper_method = 'map_parenthesised_mul'
make_stringifier(originating_stringifier=None)

Return a LokiStringifyMapper instance that can be used to generate a human-readable representation of self.

This is used as common abstraction for the make_stringifier() method in Pymbolic expression nodes.

class ParenthesisedDiv(*args, **kwargs)

Bases: Quotient

Specialised version of Quotient that always pretty-prints and code-generates with explicit parentheses.

mapper_method = 'map_parenthesised_div'
make_stringifier(originating_stringifier=None)

Return a LokiStringifyMapper instance that can be used to generate a human-readable representation of self.

This is used as common abstraction for the make_stringifier() method in Pymbolic expression nodes.

class ParenthesisedPow(*args, **kwargs)

Bases: Power

Specialised version of Power that always pretty-prints and code-generates with explicit parentheses.

mapper_method = 'map_parenthesised_pow'
make_stringifier(originating_stringifier=None)

Return a LokiStringifyMapper instance that can be used to generate a human-readable representation of self.

This is used as common abstraction for the make_stringifier() method in Pymbolic expression nodes.

class StringConcat(*args, **kwargs)

Bases: ExprMetadataMixin, _MultiChildExpression

Implements string concatenation in a way similar to Sum.

mapper_method = 'map_string_concat'