Re: [Numpy-discussion] Array of Arrays

2007-03-26 Thread Pauli Virtanen
Alexander Michael kirjoitti: > On 3/23/07, Nadav Horesh <[EMAIL PROTECTED]> wrote: > >> How about >> >> a = empty((5,7,4)) >> c = a[...,-1] >> > > Solely because I want to use the array with code that assumes it is > working with two-dimensional arrays but yet only performs operations > o

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Alexander Michael
On 3/23/07, Sebastian Haase <[EMAIL PROTECTED]> wrote: > Hold on -- aren't the "..." at the *end* always implicit: > I you have > a.shape = (6,5,4,3) > a[3,2] is the same as a[3,2,:,:] is the same as a[3,2,...] > > only if you wanted a[...,3,2] you would have to change your code !? > Am I confus

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Sebastian Haase
On 3/23/07, Alexander Michael <[EMAIL PROTECTED]> wrote: > On 3/23/07, Nadav Horesh <[EMAIL PROTECTED]> wrote: > > How about > > > > a = empty((5,7,4)) > > c = a[...,-1] > > Solely because I want to use the array with code that assumes it is > working with two-dimensional arrays but yet only perf

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Berthold Höllmann
"Alexander Michael" <[EMAIL PROTECTED]> writes: > How can I do something like the following? > > a = empty((5,7), dtype=<4 element array of floats>) > > c = a[:,-1] # last column of 4 element arrays > > a[0,0] = 2.0 > print a[0,0] > [2. 2. 2. 2.] > > a[1,0] = 3.0 > a[0,1] = a[0,0] * a[1,0] > > pri

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Alexander Michael
On 3/23/07, Nadav Horesh <[EMAIL PROTECTED]> wrote: > How about > > a = empty((5,7,4)) > c = a[...,-1] Solely because I want to use the array with code that assumes it is working with two-dimensional arrays but yet only performs operations on the "outer" two-dimensional array that would be consi

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Nadav Horesh
How about a = empty((5,7,4)) c = a[...,-1] . . . Nadav -Original Message- From: [EMAIL PROTECTED] on behalf of Alexander Michael Sent: Fri 23-Mar-07 15:33 To: Discussion of Numerical Python Cc: Subject:[Numpy-discussion] Array of Arrays How can I do something

[Numpy-discussion] Array of Arrays

2007-03-23 Thread Alexander Michael
How can I do something like the following? a = empty((5,7), dtype=<4 element array of floats>) c = a[:,-1] # last column of 4 element arrays a[0,0] = 2.0 print a[0,0] [2. 2. 2. 2.] a[1,0] = 3.0 a[0,1] = a[0,0] * a[1,0] print a[0,1] [6. 6. 6. 6.] etc. As always, thanks for the help! Alex