-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
Looking into a program I wrote I found the limiting factor was the multinomial sampling:
let mut rng = SmallRng::from_entropy();
let result = Multinomial::new(&weights, 100000).unwrap();
let counts = result.sample(&mut rng);
Specifically the sampling portion of the above code, the SmallRng call is small in comparison.
I rewrote this particular portion of my code in python using numpy.random.multinomial and found an ~400x speed increase. It appears the C code numpy calls on uses an implementation that chains many binomial calls together, whereas the statsrs implementation uses a cdf.
Wonder if there's any plans to change this?
Metadata
Metadata
Assignees
Labels
No labels