[Numpy-discussion] vectorized function inside a class

Anne Archibald peridot.faceted@gmail....
Wed Aug 8 15:53:28 CDT 2007


On 08/08/2007, mark <markbak@gmail.com> wrote:
> Thanks for the ideas to circumvent vectorization.
> But the real function I need to vectorize is quite a bit more
> complicated.
> So I would really like to use vectorize.
> Are there any reasons against vectorization? Is it slow?
> The way Tim suggests I expect to be slow as there are two functions
> calls.

vectorize() is just shorthand for a for loop, basically; it won't win
you anything on speed over looping yourself. It does win on
convenience, but if you can write your function to act on arrays it
will run much faster.

Anne


More information about the Numpy-discussion mailing list