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(children)

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

ParenthesisedDiv(numerator[, denominator])

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

ParenthesisedMul(children)

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

ParenthesisedPow(base, exponent)

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

StringConcat(children)

Implements string concatenation in a way similar to Sum.

class ParenthesisedAdd(children)

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(children)

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(numerator, denominator=1)

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(base, exponent)

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(children)

Bases: _MultiChildExpression

Implements string concatenation in a way similar to Sum.

mapper_method = 'map_string_concat'