pystencils.AssignmentCollection.add_subexpression

pystencils.AssignmentCollection.add_subexpression#

AssignmentCollection.add_subexpression(rhs, lhs=None, topological_sort=True)#

Adds a subexpression to current collection.

Parameters:
  • rhs (Expr) – right hand side of new subexpression

  • lhs (Optional[Symbol]) – optional left hand side of new subexpression. If None a new unique symbol is generated.

  • topological_sort – sort the subexpressions topologically after insertion, to make sure that definition of a symbol comes before its usage. If False, subexpression is appended.

Return type:

Symbol

Returns:

left hand side symbol (which could have been generated)