pystencils.sympyextensions.math.count_operations

pystencils.sympyextensions.math.count_operations#

pystencils.sympyextensions.math.count_operations(term, only_type='real')#

Counts the number of additions, multiplications and division.

Parameters:
  • term (Union[Expr, List[Expr], List[Assignment]]) – a sympy expression (term, assignment) or sequence of sympy objects

  • only_type (Optional[str]) – ‘real’ or ‘int’ to count only operations on these types, or None for all

Return type:

Dict[str, int]

Returns:

dict with ‘adds’, ‘muls’ and ‘divs’ keys