How to use the pyccel.decorators.types function in pyccel

To help you get started, we’ve selected a few pyccel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyccel / pyccel / tests / epyccel / modules / loops.py View on Github external
@types( int )
def fibonacci( n ):
    x = 0
    y = 1
    for i in range( n ): # pylint: disable=unused-variable
        z = x+y
        x = y
        y = z
    return x
github pyccel / pyccel / tests / epyccel / recognised_functions / test_numpy_funcs.py View on Github external
    @types('int')
    def create_full_val(val):
        from numpy import full
        a = full(3,val)
        return a[0],a[1],a[2]
    @types('int')
github pyccel / pyccel / tests / epyccel / recognised_functions / test_numpy_funcs.py View on Github external
    @types('real')
    def sqrt_return_type_real(x):
        from numpy import sqrt
        a = sqrt(x)
        return a
    @types('complex')
github pyccel / pyccel / tests / epyccel / modules / loops.py View on Github external
@types( int )
def double_loop( n ):
    x = 0
    for i in range( 3, 10 ): # pylint: disable=unused-variable
        x += 1
        y  = n*x
        for j in range( 4, 15 ): # pylint: disable=unused-variable
            z = x-y
    return z
github pyccel / pyccel / tests / epyccel / modules / arrays.py View on Github external
@types( 'real[:,:]', 'real' )
def array_real_2d_C_scalar_mul( x, a ):
    x[:,:] *= a
github pyccel / pyccel / tests / pyccel / scripts / default_args_mod.py View on Github external
@types('real [:]','int')
def f5(x, m1 = 2):
    x[:] = 0.
    for i in range(0, m1):
        x[i] = i * 1.
github pyccel / pyccel / tests / epyccel / recognised_functions / test_numpy_funcs.py View on Github external
    @types('real')
    def floor_call(x):
        from numpy import floor
        return floor(x)
github pyccel / pyccel / tests / epyccel / modules / base.py View on Github external
@types('bool')
def eq_false(a):
    c = False
    if a == False:
        c = True
    return c
github pyccel / pyccel / tests / epyccel / modules / base.py View on Github external
@types('bool')
def eq_true(a):
    c = False
    if a == True:
        c = True
    return c