# Matrix -\> array conversion functions

**URL:** <https://discourse.mc-stan.org/t/matrix-array-conversion-functions/40703>\
**Category:** General\
**Tags:** techniques\
**Created:** [December 3, 2025, 3:25pm UTC](https://discourse.mc-stan.org/t/matrix-array-conversion-functions/40703 "2025-12-03T15:25:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![huffyhenry](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/huffyhenry/32/781_2.png) [@huffyhenry](https://discourse.mc-stan.org/u/huffyhenry)\
**Post date:** [December 3, 2025, 3:25pm UTC](https://discourse.mc-stan.org/t/matrix-array-conversion-functions/40703/1 "2025-12-03T15:25:53Z")

</div>

When working with multivariate data I like representing it as a `matrix` rather than `array[] vector`. This enables linear transformations to be expressed as large matrix multiplications. But when calculating the likelihood, arrays are necessary. I often wish we had `to_vectors` and `to_row_vectors` that take a matrix and give back an array. Is there a reason these functions do not exist other than they’re not a priority? Or maybe there is a trick I’m missing in my workflow?

---

<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:** [December 3, 2025, 4:58pm UTC](https://discourse.mc-stan.org/t/matrix-array-conversion-functions/40703/2 "2025-12-03T16:58:25Z")

</div>

These indeed do not exist, and it is mostly because of priorities, as you say (though there are definitely memory reordering/efficiency concerns)

There is a tracking issue [here](https://github.com/stan-dev/math/issues/3233) for these specifically
