Nimble Functions in Model Code

25 views
Skip to first unread message

philipcindamix

unread,
Sep 15, 2023, 5:16:50 AM9/15/23
to nimble-users
Hi,

I have a question regarding the implementation of nimbleFunctions within model codes.

If I have a custom function and I include it in a nimbleCode does this function get automatically compiled to C++ when I run  nimbleMCMC? 

My understanding from the reading of ?nimbleMCMC is yes but I'm not sure.

MyFunc <- nimbleFunction(
   run = function(arg = double()) {    
      ....
   }
)

code <- nimbleCode({
   ...
   y <-  MyFunc(arg)
})

mod_res <- nimbleMCMC(code,...)



Thanks,
Philip 

Matthijs Hollanders

unread,
Sep 15, 2023, 5:29:08 AM9/15/23
to philipcindamix, nimble-users
Yes, because the function gets compiled when the model gets compiled as a step in nimbleMCMC. 😁

--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/e86e8d1d-2002-4d78-bc89-bf29dc1ba243n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages