Re: [Numpy-discussion] broacasting question

2011-07-01 Thread Thomas K Gamble
Right, I forgot to point out that there are at least 2 ways to bring the arrays into compatible shapes (that's the reason broadcasting does not work here, because numpy only does automatic broadcasting if there is an unambiguous way to do so). So the IDL arrays being Fortran-ordered is the

Re: [Numpy-discussion] broacasting question

2011-07-01 Thread Thomas K Gamble
On 30.06.2011, at 11:57PM, Thomas K Gamble wrote: np.add(b.reshape(2048,3136) * c, d, out=a[:,:3136]) But to say whether this is really the equivalent result to what IDL does, one would have to study the IDL manual in detail or directly compare the output (e.g. check what happens to

Re: [Numpy-discussion] broacasting question

2011-07-01 Thread Charles R Harris
On Thu, Jun 30, 2011 at 11:32 AM, Thomas K Gamble tkgam...@windstream.netwrote: I'm trying to convert some IDL code to python/numpy and i'm having some trouble understanding the rules for boradcasting during some operations. example: given the following arrays: a = array((2048,3577),

Re: [Numpy-discussion] broacasting question

2011-07-01 Thread Thomas K Gamble
On Thu, Jun 30, 2011 at 11:32 AM, Thomas K Gamble tkgam...@windstream.netwrote: I'm trying to convert some IDL code to python/numpy and i'm having some trouble understanding the rules for boradcasting during some operations. example: given the following arrays: a =

[Numpy-discussion] broacasting question

2011-06-30 Thread Thomas K Gamble
I'm trying to convert some IDL code to python/numpy and i'm having some trouble understanding the rules for boradcasting during some operations. example: given the following arrays: a = array((2048,3577), dtype=float) b = array((256,25088), dtype=float) c = array((2048,3136), dtype=float) d =

Re: [Numpy-discussion] broacasting question

2011-06-30 Thread Olivier Delalleau
2011/6/30 Thomas K Gamble tkgam...@windstream.net I'm trying to convert some IDL code to python/numpy and i'm having some trouble understanding the rules for boradcasting during some operations. example: given the following arrays: a = array((2048,3577), dtype=float) b = array((256,25088),

Re: [Numpy-discussion] broacasting question

2011-06-30 Thread Derek Homeier
On 30.06.2011, at 7:32PM, Thomas K Gamble wrote: I'm trying to convert some IDL code to python/numpy and i'm having some trouble understanding the rules for boradcasting during some operations. example: given the following arrays: a = array((2048,3577), dtype=float) b =

Re: [Numpy-discussion] broacasting question

2011-06-30 Thread Thomas K Gamble
On 30.06.2011, at 7:32PM, Thomas K Gamble wrote: I'm trying to convert some IDL code to python/numpy and i'm having some trouble understanding the rules for boradcasting during some operations. example: given the following arrays: a = array((2048,3577), dtype=float) b =

Re: [Numpy-discussion] broacasting question

2011-06-30 Thread Derek Homeier
On 30.06.2011, at 11:57PM, Thomas K Gamble wrote: np.add(b.reshape(2048,3136) * c, d, out=a[:,:3136]) But to say whether this is really the equivalent result to what IDL does, one would have to study the IDL manual in detail or directly compare the output (e.g. check what happens to the