Matrix vector views?

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.