# Matrix vector views?

**URL:** <https://discourse.mc-stan.org/t/matrix-vector-views/245>\
**Category:** Developers\
**Created:** [February 8, 2017, 8:55pm UTC](https://discourse.mc-stan.org/t/matrix-vector-views/245 "2017-02-08T20:55:12Z")\
**Posts on this page:** 1\
**Page:** 1

<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:** [February 8, 2017, 8:55pm UTC](https://discourse.mc-stan.org/t/matrix-vector-views/245/1 "2017-02-08T20:55:12Z")

</div>

Sean and I are trying to refactor vector views and running into the problem that the underlying code in the Stan repos is not documented so it’s not clear what it’s supposed to be doing.

Inside the stan-dev/math library, it’s possible to do this

```
MatrixXd y(2, 2);
normal_lpdf(y, 0, 1);

```

But in the language, it’s not possible to do this:

```
matrix y[2, 2];
...
y ~ normal(0, 1);

```

The particular cases we’re worrying about are

- Should we allow the above in the language, `matrix ~ normal(matrix, matrix)` and the like?

- Should we allow `VectorView` of a `MatrixXd`? That is, treating a matrix like a simple sequence?

- Should `scalar_type<vector<MatrixXd> >::type` be `MatrixXd` (as it is now) or `double`, as I would’ve expected from the naming and the fact that `scalar_type<vector<vector<double> > >::type` is `double`.
