Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Re: Can anyone show me how to do this without loops?
>>>> > "Liam" == Liam Gumley <liamg@ssec.wisc.edu> writes: In article <3vilva$5uq@spool.cs.wisc.edu> Liam Gumley <liamg@ssec.wisc.edu> writes: Liam> Can anyone show me how to code this algorithm without loops? Liam> Data types are: Liam> degree is an integer Liam> i = degree + 1 Liam> j = degree + 1 Liam> kx = fltarr( i, j ) ; contains polynomial coefficients Liam> ky = fltarr( i, j ) ; contains polynomial coefficients Liam> x0, y0, xi, yi are float variables or vectors Liam> Here is the code: Liam> xi = 0.0 Liam> yi = 0.0 Liam> for i = 0, degree do begin Liam> for j = 0, degree do begin Liam> xi = xi + kx( i, j ) * x0 ^ j * y0 ^ i Liam> yi = yi + ky( i, j ) * x0 ^ j * y0 ^ i Liam> endfor Liam> endfor Try this: x = x0^indgen(degree+1) ; Unfortunately IDL does not have a recursive y = y0^indgen(degree+1) ; filter operator (AR) to efficiently do this. xi = y # (kx # x) yi = y # (ky # x) Chris -- =============================== Bldg 24-E188 The Applied Physics Laboratory The Johns Hopkins University Laurel, MD 20723-6099 (301)953-6000 x8529 chris.chase@jhuapl.edu