Pregunta

Quiero usar la función tensor en el paquete RCPPSIMPLETENSOR (https://github.com/tlamadon/rcppsimpletensor) para calcular una función tridimensional como esta:

DGP <- function( x,y,z ) {
    return((x + y - 5)^2 + (z-5)^2)
}

creo 3 vectores de valores para x, y y z:

xdata <- seq(0,10,length=10)
ydata <- seq(0,10,length=10)
zdata <- seq(0,5,length=15)

Defino la función tensor:

library(RcppSimpleTensor)
RcppVals <- tensorFunction( R[i,j,k] ~ (X[i] + Y[j] - 5)^2 + (Z[k] - 5)^2 )
RcppArray <- RcppVals(xdata,ydata,zdata)

Pero ejecutar esta función le da un error "Error en TMPFUN (X, Y, Z, K, J, I): esperando un solo valor"

¿Qué estoy haciendo mal aquí?

¿Fue útil?

Solución

Esto ahora se fija en la rama principal del código,

mejor,

t.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top