Ejemplo n.º 1
0
def add_basic_gfunc(root, types, kernel_roots = None):
    if kernel_roots is None:
        kernel_roots = [root]
    global __all__
    f = gfunc.elwise(root)
    globals()[root] = f
    __all__.append(root)
    for r in kernel_roots:
        for t in types:
            name = r + '_' + t
            f.add_kernel(elwise_kernels.__dict__[name])
Ejemplo n.º 2
0
add_basic_gfunc('add', types)
add_basic_gfunc('subtract', types)
add_basic_gfunc('multiply', types)
add_basic_gfunc('divide', types)
#add_basic_gfunc('maximum', types, ['maximum2', 'maximum3'])
#add_basic_gfunc('minimum', types, ['minimum2', 'minimum3'])
add_basic_gfunc('maximum', types, ['maximum2'])
add_basic_gfunc('minimum', types, ['minimum2'])
add_basic_gfunc('square', types)
add_basic_gfunc('abs', types)
add_basic_gfunc('floor', types)
add_basic_gfunc('ceil', types)

if sys.platform == 'win32':
    fmod = gfunc.elwise('fmod')
    fmod.add_kernel(elwise_kernels.fmod)

    pow = gfunc.elwise('pow')
    pow.add_kernel(elwise_kernels.pow)

    sqrt = gfunc.elwise('sqrt')
    sqrt.add_kernel(elwise_kernels.sqrt)

    exp = gfunc.elwise('exp')
    exp.add_kernel(elwise_kernels.exp)

    log = gfunc.elwise('log')
    log.add_kernel(elwise_kernels.log)

    log10 = gfunc.elwise('log10')