Christopher Jackson
unread,10:24 AM (7 hours ago) 10:24 AMSign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nimble-users
Hi,
I am keen to use derivative-based algorithms in NIMBLE, but am having trouble getting models to compile with buildDerivs turned on in user-defined functions.
A minimal example of the kind of thing that breaks is below. It works with the integer() argument changed to a double(). But the manual had given me the impression that the auto-differentiator would just ignore any integer arguments? What have I missed?
Thanks,
Chris
fn <- nimbleFunction(
run = function(mu = double(),
x = integer()){
return(0.0)
returnType(double())
},
buildDerivs = TRUE
)
ncode <- nimbleCode({
y <- fn(mu, x)
})
nmod <- nimbleModel(code = ncode, data=list(mu=1,x=0), buildDerivs=TRUE)
nmodc <- compileNimble(nmod)
printErrors()
[...snip]
P_61_ncode_MID_53_nfCode.cpp: In member function 'virtual CppAD::AD<double> y_L1_UID_1256::calculate_ADproxyModel(const indexedNodeInfo&) const':
P_61_ncode_MID_53_nfCode.cpp:73:28: error: cannot convert 'std::conditional<true, CppAD::AD<double>, void>::type' {aka 'CppAD::AD<double>'} to 'int' in assignment
73 | Interm_4081 = stoch_ind_get((**ADproxyModel_x), 0);