[Numpy-discussion] Assigning complex value to real array

Andrew P. Mullhaupt doc@zen-pharaohs....
Thu Oct 7 14:38:03 CDT 2010

  On 10/7/2010 1:01 PM, Pauli Virtanen wrote:
> to, 2010-10-07 kello 12:08 -0400, Andrew P. Mullhaupt kirjoitti:
> [clip]
> But to implement this, you'd have to rewrite large parts of Numpy since
> the separated storage of re/im conflicts with its memory model.

You wouldn't want to rewrite any of numpy, just add a new class.

> I believe this will simply not be done, since there seems to be little
> need for such a feature

No, there is a big need to get the feature in sooner rather than later. 
By having this behavior, Python is filtering out a lot of potential 
users. So you will not get a lot of complaints - because people will 
just walk away and use Matlab, Scilab, or R, etc. Given this behavior 
one is strongly tempted to declare everything complex and deprecate the 
reals. Unfortunately that is going to run afoul of some things in 
subsidiary libraries.

This idea of "need". What does log(int(2)) return? I guess someone 
"needed" that one. But not log(int(-2)). Well, who needs physics and 
electrical engineering.

I agree it will not be done, but mainly because people who are in a 
position to do it will find an excuse to not do it, not for any better 
reason. But it is important to inform everyone that it is not for lack 
of a better alternative that we have this problem. It is for lack of 
effort. Let's just fess up about why it's not going to be done.

Best regards,
Andrew Mullhaupt

More information about the NumPy-Discussion mailing list