rbchan / unmarked

R package for hierarchical models in ecological research
https://rbchan.github.io/unmarked/
36 stars 25 forks source link

Add C engine for gmultmix #118

Closed kenkellner closed 5 years ago

kenkellner commented 5 years ago

Adds C++ engine for gmultmix and makes it the default. In my tests it's about 8-13x faster than the R engine. It works for both Poisson and negative binomial but only for the two built-in piFun options (removal, double). If the user provides a custom piFun it gives a warning and drops back to the R engine. I think you can use an arbitrary R function in C++ via Rcpp but at that point you probably lose most of the speed advantage, so I didn't try to implement that.

I added tests and also had to update the vignette for gmultmix since it uses a custom piFun.

Here's an R script to benchmark the C engine: gmultmix_C_example.txt