Nick Fotopoulos wrote: > Dear all, > > I often make use of numpy.vectorize to make programs read more like > the physics equations I write on paper. numpy.vectorize is basically > a wrapper for numpy.frompyfunc. Reading Travis's Scipy Book (mine is > dated Jan 6 2005) kind of suggests to me that it returns a full- > fledged ufunc exactly like built-in ufuncs. > > First, is this true? Yes, it is true. But, it is a ufunc on Python object data-types. It is calling the underlying Python function at every point in the loop.
> Second, how is the performance? i.e., are my > functions performing approximately as fast as they could be or would > they still gain a great deal of speed by rewriting it in C or some > other compiled python accelerator? > Absolutely the functions could be made faster to avoid the call back into Python at each evaluation stage. I don't think it would be too hard to replace the function-call with something else that could be evaluated more quickly. But, this has not been done yet. > As an aside, I've found the following function decorator to be > helpful for readability, and perhaps others will enjoy it or improve > upon it: > Thanks for the decorator. This should be put on the www.scipy.org wiki. -Travis ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion