Hi, I encountered a problem which I don't understand:
library(RTMB)
f <- function(par) {
# don't know if these are necessary
"[<-" <- ADoverload("[<-")
"c" <- ADoverload("c")
"diag<-" <- ADoverload("diag<-")
# build Q matrix with special structure from par
N <- as.integer(0.5 + sqrt(0.25 + length(par)), 0)
Q <- diag(N)
Q[!Q] <- exp(par)
diag(Q) <- 0
diag(Q) = -rowSums(Q)
svd_res <- eigen(Q, symmetric = FALSE)
svd_res$values
}
> MakeTape(f, rep(-2, 6))
Error: Not compatible with requested type: [type=S4; target=double].
traceback() gives me no useful information.
I tried out what happens when doing par <- advector(par) and running the code. It seems like then Q has complex entries which eigen() does not like?
But I'm not sure if this is supposed to be that way or something weird is going on here.
Thanks :)