Re: [Numpy-discussion] broacasting question

2011-07-01 Thread Charles R Harris
On Fri, Jul 1, 2011 at 6:38 PM, Thomas K Gamble wrote: > > On Thu, Jun 30, 2011 at 11:32 AM, 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:

Re: [Numpy-discussion] broacasting question

2011-07-01 Thread Thomas K Gamble
> On Thu, Jun 30, 2011 at 11:32 AM, 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

Re: [Numpy-discussion] broacasting question

2011-07-01 Thread Charles R Harris
On Thu, Jun 30, 2011 at 11:32 AM, 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 = array

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 wha

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 t

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 t

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 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 = array((256,

Re: [Numpy-discussion] broacasting question

2011-06-30 Thread Olivier Delalleau
2011/6/30 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

[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 = arr