Exemplo n.º 1
0
def vectorize(func):
    try:
	t = Translate(func)
	t.translate()
	print t.mod
	return t.make_ufunc()
    except:
	print "Warning: Could not create fast version..."
	import numpy
	return numpy.vectorize(func)
Exemplo n.º 2
0
def vectorize(func):
    global __tr_map__
    try:
        if func not in __tr_map__:
            t = Translate(func)
            t.translate()
            __tr_map__[func] = t
        else:
            t = __tr_map__[func]
        return t.make_ufunc()
    except:
        print "Warning: Could not create fast version..."
        import numpy

        return numpy.vectorize(func)
Exemplo n.º 3
0
def vectorize(func):
    global __tr_map__
    try:
        if func not in __tr_map__:
            t = Translate(func)
            t.translate()
            __tr_map__[func] = t
        else:
            t = __tr_map__[func]
        return t.make_ufunc()
    except Exception as msg:
        print "Warning: Could not create fast version...", msg
        import traceback
        traceback.print_exc()
        import numpy
        return numpy.vectorize(func)