In python say that I have a numpy array
all items are of the same type and I have a function
and I want to use myfun
. I dont want to write a function that uses a for loop applying myfun
on the elements in myarray
since the for loops are so slow in python on big array 10^N elements. The predefined types and basic operations on these seem to work in vectorized format, so how do I write my own.
I know there is something called ufunc with numpy but I cannot access scipy.org since the site appears to be down now. Vectorize and frompyfunc works but it is much slower that if you can make your own ufunc like.