[Numpy-discussion] Assigning complex values to a real array

Dr. Phillip M. Feldman pfeldman@verizon....
Tue Dec 8 12:17:20 CST 2009

David Warde-Farley-2 wrote:
> A less harmful solution (if a solution is warranted, which is for the
> Council of the Elders to  
> decide) would be to treat the Python complex type as a special case, so
> that the .real attribute is accessed instead of trying to cast to float.

There are two even less harmful solutions: (1) Raise an exception.  (2)
Provide the user with a top-level flag to control whether the attempt to
downcast a NumPy complex to a float should be handled by raising an
exception, by throwing away the imaginary part, or by taking the magnitude.

P.S. As things stand now, I do not regard NumPy as a reliable platform for
scientific computing.
View this message in context: http://old.nabble.com/Assigning-complex-values-to-a-real-array-tp22383353p26698253.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.

More information about the NumPy-Discussion mailing list