I can help with this.
To help get started with adding the cpp code and gradients check out
- Gamma distribution quantile and inverse quantile function - #37 by andrjohns
- Hoping for some guidance / help with implementing custom log likelihood and gradient for research project (details below) - #14 by rok_cesnovar
- Vector-valued functions with manual gradients in external C++ - #3 by stevebronder