[R] Help running a Fortran subroutine from R

dc896148 cyr.derek at gmail.com
Wed Mar 17 03:26:41 CET 2010


Another issue with this is how 'mask' is declared within the filter2d
subroutine as well as 'subarray' and 'subarray1'

integer ijx,ijy,ix,iy,jx,jy,icx,icy
	integer nx,ny,halfintx,halfinty
	real count
	logical missing
	real array(nx,ny),array1(nx,ny),miss
	real
subarray(2*halfintx+1,2*halfinty+1),subarray1(2*halfinty+1,2*halfintx+1)
c	real subarray(3,3),subarray1(3,3)
	real mask(-halfintx:halfintx,-halfinty:halfinty)
	data miss/999./

I'm not sure what the definition for 'mask' means, but I don't if my
specifications in my call to .Fortran are correct for these parameters. 
This is what I have now:
out <- .Fortran("filter2d",
array=as.matrix(array),
array1=matrix(single(nx*ny),nx,ny),
nx=as.integer(nx),
ny=as.integer(ny),
halfintx=as.integer(halfintx),
halfinty=as.integer(halfinty),
mask=as.single(mask),
subarray=as.single(subarray),
subarray1=as.single(subarray1))

I'm not sure how to correctly specify all of the parameters, especially the
mask, subarray, and subarray1, since the subroutine uses them as arrays. 
Does anyone have some advice?

Thanks in advance

-- 
View this message in context: http://n4.nabble.com/Help-running-a-Fortran-subroutine-from-R-tp1595641p1595861.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list