Re: Multiply matrix [message #52637] |
Mon, 19 February 2007 01:27 |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
Oeps, indgen(nz) must be filter.
On Mon, 19 Feb 2007 10:26:36 +0100, Wox <nomail@hotmail.com> wrote:
> z*=rebin(reform(indgen(nz),1,1,nz),nx,ny,nz,/sample)
|
|
|
Re: Multiply matrix [message #52638 is a reply to message #52637] |
Mon, 19 February 2007 01:26  |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
This:
FOR I=0,nz-1 DO
z[indgen(nx),indgen(ny),I]=Z[indgen(nx),indgen(ny),I]*filter
can be done like this:
z*=rebin(reform(indgen(nz),1,1,nz),nx,ny,nz,/sample)
However, is this really what you want? i have the feeling you want to
do something else here, or is it just me :-)?
On 18 Feb 2007 07:12:05 -0800, "L. Testut" <gaillac.spam@free.fr>
wrote:
> Sorry it doesn't work in my case I want to avoid this loop:
>
> FOR I=0,nz-1 DO
> z[indgen(nx),indgen(ny),I]=Z[indgen(nx),indgen(ny),I]*filter
>
> I have a H[nx,ny,nz] where nz is the time. So i have nz field in time
> that i want to multiply by a filter of size nz.
>
> Is it possible to avoid this loop ?
|
|
|
Re: Multiply matrix [message #52642 is a reply to message #52638] |
Sun, 18 February 2007 07:12  |
L. Testut
Messages: 16 Registered: January 2006
|
Junior Member |
|
|
On 16 fév, 21:36, "hradilv" <hrad...@yahoo.com> wrote:
> On Feb 16, 2:24 pm, "Bob Crawford" <Snowma...@gmail.com> wrote:> > filter = [[filter*0],[filter*0],[filter]]
>>> hnew = h*filter
>
>> That would zero out all the lat & lon values wouldn't it?
>
>> filter = [[filter/filter],[filter/filter],[filter]]
>
>> should retain the lat & lon values.
>
> Of course, I was trying to do two things at once...
Sorry it doesn't work in my case I want to avoid this loop:
FOR I=0,nz-1 DO
z[indgen(nx),indgen(ny),I]=Z[indgen(nx),indgen(ny),I]*filter
I have a H[nx,ny,nz] where nz is the time. So i have nz field in time
that i want to multiply by a filter of size nz.
Is it possible to avoid this loop ?
Thanks
Laurent
|
|
|
Re: Multiply matrix [message #52649 is a reply to message #52642] |
Fri, 16 February 2007 13:36  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Feb 16, 2:24 pm, "Bob Crawford" <Snowma...@gmail.com> wrote:
>> filter = [[filter*0],[filter*0],[filter]]
>> hnew = h*filter
>
> That would zero out all the lat & lon values wouldn't it?
>
> filter = [[filter/filter],[filter/filter],[filter]]
>
> should retain the lat & lon values.
Of course, I was trying to do two things at once...
|
|
|
Re: Multiply matrix [message #52650 is a reply to message #52649] |
Fri, 16 February 2007 12:24  |
Bob[3]
Messages: 60 Registered: December 2006
|
Member |
|
|
> filter = [[filter*0],[filter*0],[filter]]
> hnew = h*filter
That would zero out all the lat & lon values wouldn't it?
filter = [[filter/filter],[filter/filter],[filter]]
should retain the lat & lon values.
|
|
|
Re: Multiply matrix [message #52651 is a reply to message #52650] |
Fri, 16 February 2007 12:08  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Feb 16, 1:26 pm, "L. Testut" <gaillac.s...@free.fr> wrote:
> Hi all,
> A simple question. I want to multiply the third dimension of a matrix
> whitout using loop
>
> H[lon,lat,time]*filter along the time dimension for all lat,lon
>
> Thanks,
> L.
Does this work:
filter = [[filter*0],[filter*0],[filter]]
hnew = h*filter
|
|
|