Should numpy.sqrt(-1) return 1j rather than nan?
haase at msg.ucsf.edu
Thu Oct 12 13:30:34 CDT 2006
On Thursday 12 October 2006 10:49, Christopher Barker wrote:
> As someone on this list (sorry to quick with the delete button) said:
I think I might agree with everything (!) you that - very well written .
> Travis Oliphant wrote:
> > Now, it would be possible to give ufuncs a dtype keyword argument that
> > allowed you to specify which underlying loop was to be used for the
> > calculation.
> > sqrt(a, dtype=complex).
> I like this OK, and isn't is similar to the dtype argument in the
> accumulating methods? (sum, etc.). However, it's probably not worth the
> C-api change -- is it that different than calling:
> sqrt(a.astype(complex)) ?
It is very late in the game - obvious ! (one week before the announced final
release). But I think adding the dtype argument to ufuncs would be a very
useful addition !!
It is very nice to look at ! And it saves (temporary) memory and should be
noticeably faster than "sqrt(a.astype(complex))".
This dtype addition might address many of the issues I have raised before on
Travis, be courageous and change the C-API one last time before putting it
in stone for 1.0 final !!!
> As for scipy, I heartily agree that scipy should be a superset of numpy,
> and NOT change the behavior of numpy functions and methods. We're taking
> the opportunity at this point for numpy to break backward compatibility
> with Numeric/numarray -- this is probably the best time to do the same
> for scipy.
> couldn't we at least introduce new names?
> for instance?
It has to be very well documented what the 12 functions (the last 3%) are were
scipy and numpy differ. --- if at all possible I would prefer a name change
like csqrt (or better sqrtc - I always like seen things together when sorted
alphabetically ;-) ) [by the way: I like sqrt(-1) == nan just fine]
Thanks for the great work.
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
More information about the Numpy-discussion