matrix exponentials in nimbleFunction

Skip to first unread message

Henry Scharf

Jun 3, 2021, 1:17:13 AMJun 3
to nimble-users
Hello nimble users and developers,

Thanks very much for all your hard work building and maintaining nimble. I'm working with a model involving a multivariate Ornstein-Uhlenbeck process, and I'd like to write a nimbleFunction to do the log likelihood calculation based on a Kalman Filter. To that end, I need to compute matrix exponentials.

Any advice for matrix exponentials with nimble? My plan is to use nimbleRcall to allow me to use the expm R package, but I thought I'd ask first to see if there's a better way.


Chris Paciorek

Jun 4, 2021, 8:17:32 PMJun 4
to Henry Scharf, nimble-users
Hi Henry,

Trying nimbleRcall seems like a good first step. That should at least allow you to prototype. If the overhead of calling back to R is not too much relative to the other computations, that may be all you need. If the overhead is an issue, you might also explore using nimbleExternalCall to directly call out to the C code that underlies the expm calculations for the method you choose to use.


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
To view this discussion on the web visit

Henry Scharf

Jun 4, 2021, 8:47:49 PMJun 4
to nimble-users
Reply all
Reply to author
0 new messages