Linked Questions
15 questions linked to/from Which Distributions can be Compiled using RandomVariate
595
votes
19
answers
154k
views
Where can I find examples of good Mathematica programming practice?
I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
176
votes
8
answers
21k
views
List of compilable functions
Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found?
I'd be glad ...
181
votes
6
answers
23k
views
How to compile effectively?
What are the best practices of compiling functions? I understand that this is a vague question, but let me list some aspects that might trigger useful answers. Some of these have already been answered ...
25
votes
4
answers
3k
views
Can Mathematica's random number generation be improved?
Performance on Random Number generation is intolerable. Whenever you need many deviates from the same distribution but with different parameters it takes forever.
Here is a
thread
on Poisson deviates ...
17
votes
4
answers
658
views
Speeding up Gaussian sampling
Edit Greg Hurst answers show how to independently get 3x speed-up using single-threaded MKL implementation and 4x speed-up by using native implementation with multi-threading, can they be combined?
...
22
votes
2
answers
1k
views
Efficient Generation of Random Variates from a Copula Distribution
I have a 7-asset portfolio for which I want to simulate daily log-deltas using a Student T copula. The marginal distributions are all either Stable or TsallisQGaussian. Using NMaximize, I have ...
18
votes
1
answer
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 ...
14
votes
2
answers
1k
views
What's the most "functional" way to do Cholesky decomposition?
I can do Cholesky in a procedural style, such as:
...
12
votes
1
answer
957
views
What function generates random numbers in a compiled function?
I am writing a simulation for 2D random walk. I wrote several version of code, and found that the speed is like this (fastest to slowest): C++, Mathematica compiled procedural code, Mathematica ...
3
votes
1
answer
346
views
Sampling a Dirichlet Distribution efficiently
I'm sampling a DirichletDistribution like so:
...
8
votes
1
answer
283
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:
...
1
vote
1
answer
104
views
Is there any way to compile and export LearnedDistribution?
I use the LearnDistribution function to learn the distribution of some data. Then, I want to export some code to sample from that learned distribution. I tried to use Compile as follows
...
2
votes
0
answers
191
views
How to use Compile? Bivariate Gibbs Sampler
I am trying to use compile to speed up my Gibbs sampler. I know I can use Reap and Sow to speed up tremendously. I have a more complicated Bayesian posterior that I want to speed up with compile so I ...
3
votes
1
answer
126
views
Compiling a function that uses MapThread
I'm looking for tips on quickly applying the following update to $B$ pairs of $(w_i,x_i)$
$$\text{step}(w_i,x_i)=w_i-a x_i \langle w_i, x_i \rangle$$
Below is a readable but very slow version ...
2
votes
0
answers
111
views
Optimization of custom probability distibutions?
Consider the two tests:
Timing[Do[RandomVariate[NormalDistribution[0.5, 0.3]], {200}]]
{0.001188, Null}
...