Multi-dimensional distributions

Open
#16 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust
Domain
data

Research direction

Start by reviewing the existing Distribution trait and the discussions in #14 and rust-random/rand#1478. Resolve whether multidimensional distributions belong in a new crate or rand_distr::multi, and whether they need a shared trait or distribution-specific methods. Done means the API and crate placement questions have a decided, implementable direction.

Written by the indexing model from the issue text.

Description

#14 argues the importance of a variable-length input Dirichlet distribution. rust-random/rand#1478 proposes a Multinomial distribution.

It is also questionable whether the existing Distribution trait is appropriate for these; it may be preferable to use a distinct trait like:

pub trait MultiDistribution<F> {
    fn sample<R: Rng + ?Sized>(&mut self, rng: &mut R, output: &mut [F]);
}

Although:

  • The above does not support error checking of the length of output, aside from panic. This may be the most appropriate option anyway, though I would expect at minimum that implementations do assert the length of output is exactly as expected.
  • There is probably no reason to add this trait over simply adding pub fn sample methods to the distribution types.

Questions:

  • Should we start a new rand_multi crate? Or maybe rand_distr::multi module?
  • Should we add a new MultiDistribution trait? Or simply use methods on the distributions without a trait?
Dominant language
Rust
Stars
26
Forks
16
PR merge metrics
No merged PRs in 30d

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.

More from rust-random/rand_distr

All issues in rust-random/rand_distr

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.