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

Scott Ransom sransom@nrao....
Wed Dec 9 20:10:12 CST 2009


On Wed, Dec 09, 2009 at 05:54:07PM -0800, Dr. Phillip M. Feldman wrote:
> 
> Pauli Virtanen-3 wrote:
> > 
> > Nevertheless, I can't really regard dropping the imaginary part a
> > significant issue.
> > 
> 
> I am amazed that anyone could say this.  For anyone who works with Fourier
> transforms, or with electrical circuits, or with electromagnetic waves,
> dropping the imaginary part is a huge issue because we get answers that are
> totally wrong.
> 
> When I recently tried to validate a code, the answers were wrong, and it
> took two full days to track down the cause.  I am now forced to reconsider
> carefully whether Python/NumPy is a suitable platform for serious scientific
> computing.

You've now said this a couple times.  And it is fine if that is your
opinion.  However, I think it is incorrect.  

I've been using numeric/numarray/numpy for about 12 years as my main
scientific computing platform.  And I do extensive work with Fourier
Transforms and other complex numbers.  I have not once run into this
issue and in fact, my use of numpy has improved my scientific
productivity dramatically.

Most of the casting rules were set a very long time ago and are there
for very good reasons.  While it is certainly possibly that there
could be bugs in corner cases of some of them, or that those rules
surprise some people due to their familiarity with other behaviours,
but that does not change the fact that most of them are in place in
numpy for good reasons.

Scott

-- 
Scott M. Ransom            Address:  NRAO
Phone:  (434) 296-0320               520 Edgemont Rd.
email:  sransom@nrao.edu             Charlottesville, VA 22903 USA
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989


More information about the NumPy-Discussion mailing list