comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to calculate z=f(x,y) with loops
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How to calculate z=f(x,y) with loops [message #3147] Wed, 09 November 1994 07:48
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
buteau@bali.saclay.cea.fr (A.Buteau 62 17) writes:


> I need to calculate the value of z=f(x,y) .
> Z is a 2D array (fltarr(n,n)).
> X and Y are the X and Y indices of this array.

> I'd like to calculate :

> for y=0,n-1 do begin
> for x=0,n-1 do begin
> z(x,y)=...a function of X and Y (the function can be
> of any kind)
> endfor
> endfor



> But I'would like to do it without (or with only one ) for loops
> for performance consideration.


XX = X # REPLICATE(1,N_ELEMENTS(Y))
YY = REPLICATE(1,N_ELEMENTS(X)) # X
Z = funct(XX,YY)

Bill Thompson
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Surface fit or 3d interpolation
Next Topic: arrow keys don't work for PV-WAVE v4.20 on DEC AXP station, OSF/1 v3.0

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:22:44 PDT 2025

Total time taken to generate the page: 0.00368 seconds