[Numpy-discussion] Array of Callables
Shane Holloway
shane.holloway@ieee....
Tue Mar 20 11:58:08 CDT 2007
To the vector-processing masters of numpy!
I'm wanting to optimize calling a list (or array) of callable
objects. Consider the following:
vCallables = numpy.array([<python callables: fns, methods, lambdas,
classes, builtin functions>])
vParam1 = numpy.array([<parameters for vCallables>])
vParam2 = numpy.array([<parameters for vCallables>])
vParam3 = numpy.array([<parameters for vCallables>])
vResults = numpy.array([None for e in vCallables])
Is it possible to have numpy call them in a way something like::
for i in xrange(vCallables.shape[0]):
vResults[i] = vCallables[i] ( vParam1[i], vParam2[i], vParam3[i] )
With the core of that loop implemented in C?
Thanks for reading and pondering!
-Shane Holloway
More information about the Numpy-discussion
mailing list