[not sure if gretl-users is the right place for this...]
Am 24.10.2017 um 09:01 schrieb Artur Tarassow:
Dear all,
I made a little experiment this morning as I was a bit puzzled that the
SB() function ...
Artur, first a thing that hasn't to do with speed. Are you sure the
following code from SB() is doing what it's intended to do:
<SB>
if randgen1(u,0,1)<1/b
u[t] = ceil(n*randgen1(u,0,1))
</SB>
Because each call to randgen1() should be giving you a new random
number, if you know what I mean. In the original code (now in SBslow())
this looks different.
Then, about speed:
AFAICS each call to SB() is giving you only a single resampled draw, so
also for practical purposes you have to call SB() many times, which
means many copies of the input data x. Since x isn't altered within SB()
(right?), you might experiment with declaring the function argument as
constant, as in: 'const matrix x "Data to be resampled"'. Then the data
copy in memory should be avoided. (I don't think this is going to give
you such a big speed boost though.)
HTH,
sven