stanc3
stanc3 copied to clipboard
Extend partial evaluator with common functions on arrays and (row)vectors
It would be useful to add support for statically evaluating functions like size, dims, num_elements, max, min, rows, cols when called on array, vector and row-vector expressions like
{4, 2, 1}
and
[123, 2, 46, 3].
Such functions are used, for example, to determine sizes of containers in Rstanarm, so it would be useful to be able to statically evaluate them in order to
- generate more efficient code for Rstanarm
- auto-generate datasets for testing Rstanarm.
A smarter implementation of this would even be able to evaluate dimensions and lengths of many containers that are not array or row_vector expressions: the sizes should often be stored in the type information. We can use a possibly_sized_type for this.
We can even evaluate indexed row_vector and array expressions.