[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Array multiplication: implicit loop query
"Bill B." wrote:
> email@example.com (george Millward) wrote in message
> > It
> > would seem that, to get this to work I need to make
> > Pres=fltarr(30,91,40).
> IDL> a = indgen(20,20)
> IDL> b = indgen(20)
> IDL> c = b * a
> IDL> help, c
> C INT = Array
> I believe you need to REPLICATE 'Pres' as needed.
> -Bill B.
I've been converted to REBIN, myself.
(see the group archives for the dimensional juggling tutorial by JD
Smith this past spring)
IDL> Pres_expan = REBIN(Pres, 30, 91, 40)
IDL> help, Pres_expan
PRES_EXPAN FLOAT = Array[30, 91, 40]
This gives you the correct dimensions and avoids loops. You can even
resize inline if you dislike having the extra variable around:
DEN_H = MMR_H * REBIN(Pres, 30, 91, 40) * RMT / $
( atomic_mass_H * Gas_constant * TN )