stanc3 icon indicating copy to clipboard operation
stanc3 copied to clipboard

Extend partial evaluator with common functions on arrays and (row)vectors

Open VMatthijs opened this issue 5 years ago • 0 comments

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

  1. generate more efficient code for Rstanarm
  2. 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.

VMatthijs avatar Jun 25 '19 20:06 VMatthijs