[Numpy-discussion] Vectorizing a function
Wed Jan 30 02:49:44 CST 2008
I've got some questions on the numpy.vectorize function.
Currently, i'm doing this kind of work :
def calc_0d(x, y):
""" make complexe calculation using two scalars x and y """
[ ... ]
return res1, res2, res 3
# vectorize the function
calc = vectorize(calc_0d)
res1, res_2, res_3 = calc(array_x, array_y)
This works fine. Really impressive. Good work for this !
My problem is that the complexe calculations made in calc_0d use some
parameters, which are currently defined at the head of my python file.
This is not very nice and I can't define a module containing theses
two functions and call them with different parameters.
I would like to make this cleaner and pass theses parameter as
keyword argument, but this don't seems to be possible with vectorize.
Indeed, some of theses parameters are array parameters and only the x
and y arguments should be interpreted with the broadcasting rules....
What is the "good way" for doing this ?
More information about the Numpy-discussion