I have an old piece of code i am trying to optimize. It has been
taken it down to this current state of affairs
I would like to turn the last for loop into some kind of array
operation.
Unfortunately my brain cant seem to come up with the solution
pro splin2,x1a,x2a,ya,y2a,m,n,x1,x2,y
;+
; splin2
;
; Given X1A, X2A, YA, M, N as described in SPLIE2.PRO and Y2A as
produced by
; that routine, and given a desired interpolating point X1, X2, this
routine
; returns an interpolated function value Y by bicubic spline
interpolation.
;
; SOURCE:
; Numerical Recipes, 1986. (page 101)
;
; CALLING SEQUENCE:
; splin2,x1a,x2a,ya,y2a,m,n,x1,x2,y
;
; INPUTS:
; x1a - independent variable vector (first dimension)
; x2a - independent variable vector (second dimension)
; ya - dependent variable array
; y2a - second derivative array (as produced by SPLIE2.PRO)
; m - length of first dimension
; n - length of second dimension
; x1 - first coordinate of interpolating point
; x2 - second coordinate of interpolating point
;
; OUTPUTS:
; y - bicubic spline interpolated function value
;
; HISTORY:
; converted to IDL, D. Neill, October, 1991
;-
;ytmp = fltarr(n)
;y2tmp = fltarr(n)
yytmp = fltarr(n)
for j=0,m-1 do begin
splint,x2a,ya[j,*],y2a[j,*],n,x2,yyt
yytmp(j)=yyt
endfor
; Construct the one-dimensional column spline and evaluate it.
;
;print,y2tmp, "ytmp before"
splinf,x1a,yytmp,m,1.e30,1.e30,y2tmp
;print, "y2tmp is = : " , y2tmp
splint,x1a,yytmp,y2tmp,m,x1,y
;print, " y is = : ", y
;
return
end ; splin2.pro
|