On Wed, 17 Mar 2010, dc896148 wrote: > The output will be an array of the same dimension as 'array', the first > argument passed to the subroutine. The output array is the second > argument, 'array1', which will be populated with the smoothed values > according to the subroutine. > I can run the subroutine in R without receiving an error, it's just that > the returned values in 'array1' appear incorrect. I know they are wrong, > because if the subroutine is just averaging nearby elements together, the > results should be of somewhat similar magnitude. However, in the output, I > receive values such as 1.5e+200, which is astronomically huge! > Missing values are REALS and denoted 999.00 in the text file. The output > can and will contain missing values because if there are no values to > average within a nx x ny window, the result returned is missing. > > Hope this makes sense. I also hope someone can get some reasonable output. > I compiled the filter2d.f file with g77, so I don't know if this would be a > problem to. I am trying R CMD SHLIB to re-create the DLL file, but I > haven't had any luck yet. If anyone else is able to, please let me know. > > Thanks in advance.
But you said in your original message: Then I run the Fortran subroutine... out <- .Fortran("filter2d", as.single(array), as.single(array), as.integer(nx), as.integer(ny), as.integer(halfintx), as.integer(halfinty), as.single(mask), as.single(subarray), as.single(subarray1)) So you are overwriting the input array with the output (or was that just a typo?) Ray ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.