stan-dev / stan-dev/stan

Things needed by interfaces for Stan 3.x

Open
#2,360 2 comments 1 reaction 3 assignees View on GitHub

@seantalts is already working on this.

Since Jul 25, 2017.

feature
Dominant language
C++
Stars
2.8k
Forks
388
Avg merge
2d 17h
Merged PRs (30d)
15

Description

Summary:

The class of the C++ model does not have enough functionality for interfaces like RStan and PyStan to implement version 3.x.

Description:

Here are things that I think should exist:

  • An abstract base class that interfaces can be aware of. Currently, the model class inherits from prob_grad but prob_grad is not very useful. The abstract base class should have virtual methods for the things that the generated code is going to define.
  • A static method that returns a std::pair<std::vector<std::string>, std::vector<std::string> > where the first std::vector<std::string> contains the names of the things declared in the data block and the second std::vector<std::string> contains the Stan types of the things declared in the data block. So, if the Stan program were
data {
  int K;
  simplex[K] pi;
}

then it would return a std::pair with "K" and "pi" as the first std::vector<std::string> and "int" and "simplex" as the second std::vector<std::string>.

  • A method to be called after instantiation that returns a std::pair<std::vector<std::string>, std::vector<std::vector<int> > > where the std::vector<std::string> is the same as in the previous method and contains the names of the things declared in the data block and the std::vector<std::vector<int> > > contains the dimensions of the things declared in the data block. In the above example, the second thing would contain 0 and whatever integer K turns out to be.
  • A static method that returns the names and types of the things in the transformed data block
  • A method to be called after instantiation that returns the names and dimensions of the things in the transformed data block
  • A static method that returns the names and types of the things in the parameters block
  • A method to be called after instantiation that returns the names and dimensions of the things in the parameters block
  • A static method that returns the names and types of the things in the transformed parameters block
  • A method to be called after instantiation that returns the names and dimensions of the things in the transformed parameters block
  • A static method that returns the names and types of the things in the generated quantities block
  • A method to be called after instantiation that returns the names and dimensions of the things in the generated quantities block
Reproducible Steps:

Read the generated C++ code; none of these exist currently.

Current Output:

None of these exist currently so there is nothing to output.

Expected Output:

See description section.

Additional Information:
Current Version:

v2.16.0

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.