[Numpy-discussion] Assigning complex value to real array

sicre hugogilsilva at gmail.com
Thu Oct 7 01:14:02 EDT 2010




Andrew P. Mullhaupt wrote:
> 
> 
> I came across this gem yesterday
> 
> 
>       > >> from numpy import *
>       > >> R = ones((2))
>       > >> R[0] = R[0] * 1j
>       > >> R
>       ...array([ 0., 1.])
>       > >> R = ones((2), 'complex')
>       > >> R[0] = R[0] * 1j
>       > >> R
>       array([ 0.+1.j, 1.+0.j])"
> 
> and I read that this behavior is actually intended for some reason about 
> how Python wants relations between types to be such that this mistake is 
> unavoidable.
> 
> So can we have a new abstract floating type which is a complex, but is 
> implemented so that the numbers where the imaginary part is zero 
> represent and operate on that imaginary part implicitly? By containing 
> all these semantics within one type, then presumably we avoid problems 
> with ideas relationships between types.
> 
> Best regards,
> Andrew Mullhaupt
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
Sorry, but this post is in the wrong topic since it has nothing to do with
my question.
-- 
View this message in context: http://old.nabble.com/Meshgrid-with-Huge-Arrays-tp29902859p29903028.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list