stan-dev / stan-dev/stanc3

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

Open
#202 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature good first issue optimization
Dominant language
OCaml
Stars
160
Forks
59
Avg merge
21h 45m
Merged PRs (30d)
26

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the partial evaluator and its handling of array, vector, and row-vector expressions. Trace how the listed functions—size, dims, num_elements, max, min, rows, and cols—are represented and evaluated for the examples in the issue. Done means these functions can be statically evaluated for the stated expressions, with indexed expressions and type-based sizes considered as scope allows.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.