# External C++ Code with Precomputed Gradients

**URL:** <https://discourse.mc-stan.org/t/external-c-code-with-precomputed-gradients/26232>\
**Category:** CmdStan\
**Created:** [February 6, 2022, 4:05am UTC](https://discourse.mc-stan.org/t/external-c-code-with-precomputed-gradients/26232 "2022-02-06T04:05:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [February 6, 2022, 4:37am UTC](https://discourse.mc-stan.org/t/external-c-code-with-precomputed-gradients/26232/2 "2022-02-06T04:37:10Z")

</div>

Hi Miguel, Stan now uses the `make_callback_var` function to specify pre-computed gradients, I put together an example of using this for pre-computed gradients over in this post: [Gamma distribution quantile and inverse quantile function - #42 by andrjohns](https://discourse.mc-stan.org/t/gamma-distribution-quantile-and-inverse-quantile-function/22882/42)

---

_[View the full topic](https://discourse.mc-stan.org/t/external-c-code-with-precomputed-gradients/26232)._
