# Release of CmdStan 2.40.0

**URL:** <https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606>\
**Category:** Announcements\
**Created:** [September 16, 2026, 3:47pm UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606 "2026-09-16T15:47:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![WardBrian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wardbrian/32/12078_2.png) [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Post date:** [September 16, 2026, 3:47pm UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/1 "2026-09-16T15:47:29Z")

</div>

We are very happy to announce that CmdStan 2.40.0 is out!

This release cycle brings new 1-D integration functions, quality of life improvements, and many bug fixes.

For details, see the blog post: [Release of CmdStan 2.40 – The Stan Blog](https://blog.mc-stan.org/2026/09/16/release-of-cmdstan-2-40/)

---

<div class="post-metadata">

**Author:** ![mhollanders](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mhollanders/32/17623_2.png) [@mhollanders](https://discourse.mc-stan.org/u/mhollanders)\
**Post date:** [September 17, 2026, 1:10am UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/2 "2026-09-17T01:10:47Z")

</div>

Thanks a lot! The new `to_(row)vector_array` and `to_matrix` functions are very welcome.

---

<div class="post-metadata">

**Author:** ![WardBrian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wardbrian/32/12078_2.png) [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Post date:** [September 17, 2026, 1:34am UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/3 "2026-09-17T01:34:12Z")

</div>

Those were added by a first time contributor, **[fatimmajumder](https://github.com/fatimmajumder)** on github!

---

<div class="post-metadata">

**Author:** ![wds15](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wds15/32/908_2.png) [@wds15](https://discourse.mc-stan.org/u/wds15)\
**Post date:** [September 17, 2026, 9:15am UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/4 "2026-09-17T09:15:24Z")

</div>

variadic integrate 1d functions… finally… great.

---

<div class="post-metadata">

**Author:** ![mhollanders](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mhollanders/32/17623_2.png) [@mhollanders](https://discourse.mc-stan.org/u/mhollanders)\
**Post date:** [September 18, 2026, 4:41am UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/5 "2026-09-18T04:41:51Z")

</div>

@seantalts, any chance we can get these new functions into stanli?

---

<div class="post-metadata">

**Author:** ![seantalts](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/seantalts/32/32_2.png) [@seantalts](https://discourse.mc-stan.org/u/seantalts)\
**Post date:** [September 18, 2026, 5:46am UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/6 "2026-09-18T05:46:17Z")

</div>

Oh nice, will do! Thanks for the ping.

Edit: out in the latest stanli release now. Lmk if you have any issues.

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [September 18, 2026, 10:15am UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/7 "2026-09-18T10:15:54Z")

</div>

> [@wds15](#):
>
> variadic integrate 1d functions… finally… great.

Are you using them in the model block, that is, would you benefit from faster gradients? There is a way to make the gradient computation faster, but priority of making PR depends on whether anyone cares

---

<div class="post-metadata">

**Author:** ![wds15](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wds15/32/908_2.png) [@wds15](https://discourse.mc-stan.org/u/wds15)\
**Post date:** [September 18, 2026, 11:06am UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/8 "2026-09-18T11:06:09Z")

</div>

Not at the moment, but faster gradients for this function would be very useful for sure. I have somewhat avoided its use for rare cases given that it was not variadic - but that will change. Which issue or PR is it?

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [September 18, 2026, 2:34pm UTC](https://discourse.mc-stan.org/t/release-of-cmdstan-2-40-0/41606/9 "2026-09-18T14:34:10Z")

</div>

For `integrate_1d_gauss_kronrod` there is a PR [integrate\_1d\_gauss\_kronrod performance fix by avehtari · Pull Request #3403 · stan-dev/math · GitHub](https://github.com/stan-dev/math/pull/3403) (which did not make to 2.40), which fixes one perfomance issue has big impact only sometimes.

That PR mentions possible follow-up

> `integrate_1d_adjoint` runs one quadrature per var scalar and does a full reverse sweep at each node while keeping a single adjoint. Batching them onto one shared partition is a further ~8× on this model and needs no additional Boost change, but it touches adjoint code shared with `integrate_1d`, so maybe another PR?

The same batching for `integrate_1d_double_exponential` would be also possible, but would require modifying Boost code, so I did not propose that yet.
