Linked Questions

47
votes
3answers
1k views

Why is the new PositionIndex horribly slow?

This issue has largely been mitigated in 10.0.1. New timings for the final test below are: ...
32
votes
4answers
2k views

Which Distributions can be Compiled using RandomVariate

Recently, Oleksandr kindly showed a list of Mathematica commands that can be compiled. RandomVariate was part of that list. However, whether this can be compiled depends upon the distribution that is ...
13
votes
4answers
1k views

Why is Poisson Random Deviate Generation so slow?

I am generating Poisson deviates for some numerical work. Mathematica 9.0.1 is very slow in generating these random numbers, as can be seen below. ...
18
votes
1answer
2k views

Speed up adding Poisson noise to an image

I'm simulating some images corrupted with Poisson noise, but I'm encountering a few problems with performance. According to the documentation on ImageEffect, one ...
3
votes
2answers
601 views

Speed up RandomVariate on a custom probability distribution

I have created a custom probability distribution: ...
3
votes
1answer
222 views

Sampling a Dirichlet Distribution efficiently

I'm sampling a DirichletDistribution like so: ...
7
votes
1answer
222 views

Why is Random faster than RandomReal?

As of version 6, Random[] was superseded by RandomReal[ ] etc, but both still work perfectly well. Playing with some timing ...
1
vote
1answer
498 views

Calling C++ from Mathematica Mac OS X

I am trying to call and run the C++ code at the bottom of this post which must be stored in a file called poissonvariate.cpp. I am getting the following error message which I will display here before ...
8
votes
1answer
237 views

Speeding Up RandomVariate

Consider the following code where we first take 1000 independent samples from a Poisson distribution, and then take 1000 independent samples from 1000 different Poisson distributions: ...
6
votes
1answer
209 views

Why is Compile + RandomReal faster than random real?

In the process of playing around with Compile, I discovered something surprising. RandomReal[{-1, 1}, 3] is a lot slower than <...
3
votes
3answers
261 views

Performance on Multinomial Deviate is slow

Most of the time in my program is spent on this single line of code: out = RandomVariate[MultinomialDistribution[nt, tmp]]; ...
2
votes
1answer
272 views

Performance on Binomial Deviate is slow

I hope I won't get spanked for reposting. This is related to a previous question discussed here: Performance on Multinomial Deviate is slow. but this version is simpler because it is a binomial ...
2
votes
0answers
102 views

Optimization of custom probability distibutions?

Consider the two tests: Timing[Do[RandomVariate[NormalDistribution[0.5, 0.3]], {200}]] {0.001188, Null} ...
2
votes
1answer
79 views

Evaluation Time of RandomVariate Function

This question is about the runtime of the function RandomVariate. Take a simple normalized Gaussian distribution G on the real line, I tried to generate N random ...