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

2009-03-07 Thread Stéfan van der Walt
2009/3/7 Charles R Harris charlesr.har...@gmail.com: a = np.zeros(6) # real b= np.arange(6)*(2+3j) # complex a[1] = b[1] # shouldn't this break? What is the rationale behind this behaviour? The same as this: In [1]: a = zeros(2) In [2]: a[0] = '1' In [3]: a Out[3]: array([ 1.,  0.])

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

2009-03-07 Thread Robert Kern
On Sat, Mar 7, 2009 at 03:30, Stéfan van der Walt ste...@sun.ac.za wrote: 2009/3/7 Charles R Harris charlesr.har...@gmail.com: a = np.zeros(6) # real b= np.arange(6)*(2+3j) # complex a[1] = b[1] # shouldn't this break? What is the rationale behind this behaviour? The same as this: In

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

2009-03-07 Thread Stéfan van der Walt
2009/3/7 Robert Kern robert.k...@gmail.com: In [5]: z = zeros(3, int) In [6]: z[1] = 1.5 In [7]: z Out[7]: array([0, 1, 0]) Blind moment, sorry. So, what is your take -- should this kind of thing pass silently? Regards Stéfan ___

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

2009-03-07 Thread Robert Kern
On Sat, Mar 7, 2009 at 04:10, Stéfan van der Walt ste...@sun.ac.za wrote: 2009/3/7 Robert Kern robert.k...@gmail.com: In [5]: z = zeros(3, int) In [6]: z[1] = 1.5 In [7]: z Out[7]: array([0, 1, 0]) Blind moment, sorry.  So, what is your take -- should this kind of thing pass silently?

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

2009-03-07 Thread Stéfan van der Walt
2009/3/7 Robert Kern robert.k...@gmail.com: On Sat, Mar 7, 2009 at 04:10, Stéfan van der Walt ste...@sun.ac.za wrote: 2009/3/7 Robert Kern robert.k...@gmail.com: In [5]: z = zeros(3, int) In [6]: z[1] = 1.5 In [7]: z Out[7]: array([0, 1, 0]) Blind moment, sorry.  So, what is your take --

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

2009-03-07 Thread Darren Dale
On Sat, Mar 7, 2009 at 5:18 AM, Robert Kern robert.k...@gmail.com wrote: On Sat, Mar 7, 2009 at 04:10, Stéfan van der Walt ste...@sun.ac.za wrote: 2009/3/7 Robert Kern robert.k...@gmail.com: In [5]: z = zeros(3, int) In [6]: z[1] = 1.5 In [7]: z Out[7]: array([0, 1, 0]) Blind

Re: [Numpy-discussion] Build Failure on WIndows Vista

2009-03-07 Thread David Cournapeau
On Sat, Mar 7, 2009 at 5:41 AM, Patrick Marsh patrickmars...@gmail.com wrote: Greetings, I am running Windows Vista Ultimate and trying to build numpy from the SVN branch using MSVC 2003.  I have been able to build previously, but with my latest SVN update I am no longer able to build.  My

[Numpy-discussion] question about ndarray.astype(None)

2009-03-07 Thread Darren Dale
I was wondering about the behavior of ndarray.astype when passed None. Currently this defaults to float64, does anyone know why it doesn't default to the instance's dtype? defaulting to float64 seems too arbitrary. Thanks, Darren ___ Numpy-discussion

Re: [Numpy-discussion] Why using cblas in umath_test ?

2009-03-07 Thread David Cournapeau
On Wed, Mar 4, 2009 at 10:13 PM, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote:    Is there a rationale for using cblas at all ? Why not using straight C functions - it is not like we care about speed for tests, right ? Or am I missing something ? Since nobody reacted, I removed the

Re: [Numpy-discussion] possible bug: __array_wrap__ is not called during arithmetic operations in some cases

2009-03-07 Thread Darren Dale
On Sun, Feb 22, 2009 at 7:01 PM, Darren Dale dsdal...@gmail.com wrote: On Sun, Feb 22, 2009 at 6:35 PM, Darren Dale dsdal...@gmail.com wrote: On Sun, Feb 22, 2009 at 6:28 PM, Pierre GM pgmdevl...@gmail.com wrote: On Feb 22, 2009, at 6:21 PM, Eric Firing wrote: Darren Dale wrote: Does

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread David Cournapeau
On Sat, Mar 7, 2009 at 6:01 AM, Charles R Harris charlesr.har...@gmail.com wrote: Hi David, Currently, bint.i = __STR2INTCST(ABCD); It is probably more portable to just initialize the union     union {         char c[4];         npy_uint32 i;     } bint = {'A','B','C','D'}; Ah,

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread Charles R Harris
On Sat, Mar 7, 2009 at 11:41 AM, David Cournapeau courn...@gmail.comwrote: On Sat, Mar 7, 2009 at 6:01 AM, Charles R Harris charlesr.har...@gmail.com wrote: Hi David, Currently, bint.i = __STR2INTCST(ABCD); It is probably more portable to just initialize the union union {

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread David Cournapeau
On Sun, Mar 8, 2009 at 2:52 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Mar 7, 2009 at 11:41 AM, David Cournapeau courn...@gmail.com wrote: On Sat, Mar 7, 2009 at 6:01 AM, Charles R Harris charlesr.har...@gmail.com wrote: Hi David, Currently, bint.i =

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread Charles R Harris
On Sat, Mar 7, 2009 at 11:02 AM, David Cournapeau courn...@gmail.comwrote: On Sun, Mar 8, 2009 at 2:52 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Mar 7, 2009 at 11:41 AM, David Cournapeau courn...@gmail.com wrote: On Sat, Mar 7, 2009 at 6:01 AM, Charles R Harris

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread Charles R Harris
On Sat, Mar 7, 2009 at 11:20 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Mar 7, 2009 at 11:02 AM, David Cournapeau courn...@gmail.comwrote: On Sun, Mar 8, 2009 at 2:52 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Mar 7, 2009 at 11:41 AM, David

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread David Cournapeau
On Sun, Mar 8, 2009 at 3:20 AM, Charles R Harris charlesr.har...@gmail.com wrote: The macro is ugly, unneeded, and obfuscating. Why construct a number from characters and shifts when you can just *write it down*? The idea was to replace the 'ABCD' multi-byte constant. If you think that

[Numpy-discussion] structured array comparisons?

2009-03-07 Thread Matthew Brett
Hi, I'm having some difficulty understanding how these work and would be grateful for any help. In the simple case, I get what I expect: In [42]: a = np.zeros((), dtype=[('f1', 'f8'),('f2', 'f8')]) In [43]: a == a Out[43]: True If one of the fields is itself an array, and the other is a

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread Charles R Harris
On Sat, Mar 7, 2009 at 11:57 AM, David Cournapeau courn...@gmail.comwrote: On Sun, Mar 8, 2009 at 3:20 AM, Charles R Harris charlesr.har...@gmail.com wrote: The macro is ugly, unneeded, and obfuscating. Why construct a number from characters and shifts when you can just *write it down*?

[Numpy-discussion] np.random.multinomial weird results

2009-03-07 Thread josef . pktd
np.random.multinomial looks weird. Are these bugs, or is there something not correct with the explanation. Josef from the help/ docstring: np.random.multinomial(20, [1/6.]*6, size=2) array([[3, 4, 3, 3, 4, 3], [2, 4, 3, 4, 0, 7]]) For the first run, we threw 3 times 1, 4 times 2, etc.

Re: [Numpy-discussion] np.random.multinomial weird results

2009-03-07 Thread Robert Kern
On Sat, Mar 7, 2009 at 17:29, josef.p...@gmail.com wrote: np.random.multinomial  looks weird. Are these bugs, or is there something not correct with the explanation. I would like to know how you are interpreting the documentation. Josef from the help/ docstring: np.random.multinomial(20,

Re: [Numpy-discussion] np.random.multinomial weird results

2009-03-07 Thread josef . pktd
On Sat, Mar 7, 2009 at 6:57 PM, Robert Kern robert.k...@gmail.com wrote: On Sat, Mar 7, 2009 at 17:29,  josef.p...@gmail.com wrote: np.random.multinomial  looks weird. Are these bugs, or is there something not correct with the explanation. I would like to know how you are interpreting the

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread David Cournapeau
On Sun, Mar 8, 2009 at 4:34 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Mar 7, 2009 at 11:57 AM, David Cournapeau courn...@gmail.com wrote: On Sun, Mar 8, 2009 at 3:20 AM, Charles R Harris charlesr.har...@gmail.com wrote: The macro is ugly, unneeded, and obfuscating.

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread Charles R Harris
On Sat, Mar 7, 2009 at 11:10 PM, David Cournapeau courn...@gmail.comwrote: snip That's strange - I redid the compilation this morning, and I now get the same results as you (modulo the function call - I forced the function call because that's how it would work in numpy), that is the return

Re: [Numpy-discussion] Changeset 6557

2009-03-07 Thread David Cournapeau
On Sun, Mar 8, 2009 at 3:49 PM, Charles R Harris charlesr.har...@gmail.com wrote: So it's off to look at the tickets and trying to fix bugs. Urrgh. Oh, and I suppose I should look into the argmax/argmin functions and see how they handle nans. I think they don't at the moment: they have an