pyccel.complexity.arithmetic module

pyccel.complexity.arithmetic module#

This module provides us with functions and objects that allow us to compute the arithmetic complexity a of a program.

Example

>>> code = '''
... n = 10
... for i in range(0,n):
...     for j in range(0,n):
...         x = pow(i,2) + pow(i,3) + 3*i
...         y = x / 3 + 2* x
... '''
>>> from pyccel.complexity.memory import MemComplexity
>>> M = OpComplexity(code)
>>> d = M.cost()
>>> print "f = ", d['f']
f =  n**2*(2*ADD + DIV + 2*MUL + 2*POW)
class pyccel.complexity.arithmetic.OpComplexity(filename_or_text)[source]#

Bases: Complexity

class for Operation complexity computation.

cost()[source]#

Computes the complexity of the given code.

verbose: bool

talk more

pyccel.complexity.arithmetic.count_ops(expr, visual=None)[source]#