comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Multiplying a cube by a vector

Re: Multiplying a cube by a vector
type: item
description: 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
creator: thompson
date: 1999-12-09T08:00:00-00:00