Here's a summary of how to implement a gradient function manually in Stan 2.10 in order to override autodiff. I wanted to do this because my run-times were long, and I knew I could save some time by hard-coding my gradient function. That being said, autodiff is great, and is almost always fast enough.
Two reasons to do this:
- This will allow you to easily generate a .cpp file that will contain the basic structure you need.
- Great for testing to make sure your hacked code gives identical output to what you would get using Stan.