# Vectorizing power function

**URL:** <https://discourse.mc-stan.org/t/vectorizing-power-function/1516>\
**Category:** Modeling\
**Tags:** performance\
**Created:** [August 8, 2017, 2:52pm UTC](https://discourse.mc-stan.org/t/vectorizing-power-function/1516 "2017-08-08T14:52:29Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [August 14, 2017, 2:45pm UTC](https://discourse.mc-stan.org/t/vectorizing-power-function/1516/4 "2017-08-14T14:45:56Z")

</div>

It would make it faster in the `pow(real, vector)` because the first parameter is shared and we can cut down on the expression graph size, but there’s no speed gain to be had in the `pow(vector, vector)` case.

It looks like Rayleigh is done with the `pow(vector, vector)` versions, but not the broadcasting ones that take `pow(real, vector)` or `pow(vector, real)`.

---

_[View the full topic](https://discourse.mc-stan.org/t/vectorizing-power-function/1516)._
