[R] Fast evaluation of functions in 3D domains

Lluis.Hurtado at uv.es Lluis.Hurtado at uv.es
Mon Mar 23 11:44:59 CET 2015

Dear all,

I am currently working with the spatstat package with 3D samples. I am trying to 
evaluate a non analytical function over the window that encloses the sample and I 
need to know which is the fastest way of doing it.

The function input is a 3 coordinate position in the window (x,y,z) and a list of 
parameters (a,b,c). The output is a numerical value. 

n <- function(x,y,z,a,b,c)

But I need to do it over the whole volume.

For 2 dimensions it can be done with

A <- as.im(function,window,parameters)
norm <- integral.im(A)

For 3 dimensions I have tried to pass an array of a grid covering the window (like a 
quadrature scheme) and then summing up the output array, but I would like to know if 
there is any faster way of integrating the function.

Thank you very much,

Lluís Hurtado

More information about the R-help mailing list