On Wed, 16 Nov 2016, Sven Schreiber wrote:
My impression is that it's an additional package
("RcppZiggurat"?),
which then perhaps provides this function zrnorm() on slide 22.
I've now looked into this in detail.
The speed with which a program generates normal variates depends on
two factors: the speed of the underlying uniform generator and the
speed of conversion to normal.
In Jack's tests of gretl against Octave -- which set us off on
revising the gretl RNG -- it transpired that gretl's uniform generator
(SFMT) was faster than Octave's but our Ziggurat conversion was
slower, making us somewhat slower overall for normals. Now that we've
switched to Bateman's Ziggurat implementation we're a bit faster
overall.
Now for RcppZiggurat: I've experimented with two of Dirk's functions,
zrnorm() and zrnormR(). The first of these is overall very fast, due
to the fact that the uniform generator he's using, SHR3, is very fast.
However, it has a rather short period by today's standards, 2^32-1 as
against 2^19937-1 for the MT variant used by gretl. The second
function uses the same Ziggurat code but employs R's standard MT
uniform generator, which makes it a bit slower.
Here's what I'm seeing for timings of 200 replications of generating 1
million normals (Nehalem CPU):
gretl: 3.978 seconds
Octave: 5.185
R, zrnorm: 3.275
R, zrnormR: 4.995
So in this comparison class we have the best time for MT + Ziggurat,
though RcppZiggurat is faster with SHR3 + Ziggurat.
Allin