Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for multivariate distributions #496

Open
vks opened this issue Jun 5, 2018 · 2 comments
Open

Better support for multivariate distributions #496

vks opened this issue Jun 5, 2018 · 2 comments
Labels
E-question Participation: opinions wanted P-low Priority: Low T-distributions Topic: distributions X-discussion Type: discussion

Comments

@vks
Copy link
Collaborator

vks commented Jun 5, 2018

The Distribution trait does not work well for multivariate distributions, because impl Distribution<Vec<f64>> for Multivariate requires an allocation for every sample (see #485 for an example). Maybe we should add another trait:

pub trait MultivariateDistribution<T> {                                                         
    fn sample_multi<R: Rng + ?Sized>(&self, rng: &mut R, buffer: &mut [T]);
}

With SIMD in mind, this might even make sense for univariate distribution. So we might want to add sample_multi to the Distribution trait.

@dhardy
Copy link
Member

dhardy commented Jun 6, 2018

This is a good point. My preference is to postpone this until we resolve #290 or have more multi-variate distributions.

As mentioned in #485 there might be another solution, if fixing the number of variables at compile-time is sufficient: using generic consts (rust-lang/rust#44580).

@dhardy dhardy added E-question Participation: opinions wanted T-distributions Topic: distributions P-low Priority: Low X-discussion Type: discussion labels Jun 6, 2018
@vks
Copy link
Collaborator Author

vks commented Jun 6, 2018

Nice, I did not know const generics were so close!

rust-lang/rust#51192 (comment)

Given that const generics on nightly might be only a month away, my vote would be to wait...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-question Participation: opinions wanted P-low Priority: Low T-distributions Topic: distributions X-discussion Type: discussion
Projects
None yet
Development

No branches or pull requests

2 participants