Re: Multiplying a cube by a vector [message #18226] |
Thu, 09 December 1999 00:00 |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
Pierre Chanial <pchanial@cea.fr> writes:
> Hi !
> Has anybody written a function that multipies an array by a vector along
> a given dimension?
> For the last dimension, one can do for an array of dimension nx,ny,nz :
> vector_unit = replicate(1, nx*ny)
> newcube = vector ## vector_unit
> newcube = reform(cube,nx*ny, nz) * temporary(newcube)
> newcube = reform(newcube, nx,ny,nz, /overwrite)
> but for the other dimensions ?
> Cheers Pierre
Pierre:
I believe that the following will what you want. If CUBE has the dimensions
(NX,NY,NZ), and VECTOR_Y has the dimensions (NY), then you can multiply the two
with the command
NEWCUBE = REBIN( REFORM(VECTOR_Y, 1,NY,1), NX,NY,NZ)
(I believe that Stein Vidar Haugan first pointed this out.)
William Thompson
|
|
|