[moving this to devel now]
Am 24.10.2017 um 15:13 schrieb Artur Tarassow:
Am 24.10.2017 um 14:36 schrieb Sven Schreiber:
> 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.
Good point, Sven. I was also thinking about the purpose for the 2nd
draw. It's actually taken from K. Sheppard's code.
Please show us. From a quick look at what he has online it didn't seem
to me that way.
Are there any theoretical points on this? Of course drawing another
time
costs computational time...
Well it's quite a different thing. And yes, a side effect is more
computational effort.
Yes, we have to call SB() each time. I guess that incorporating the
MC-part (calling SB many times) into the function environment could
speed up things due to reduced transfer costs (copy/return).
As I said, by using the 'const' declaration most of the copy should be
gone I'd hope.
its current form, SB() is very flexible and not limited to some
specific
purpose (some specific time-series model or so).
Well, you could add an optional argument 'numdraws' or something. If
numdraws==1 (the default) everything stays as it is now. Otherwise you
return a matrix with the number of columns equal to numdraws. This might
save you some function call overhead.
Still, the MATLAB example shares the same architecture and is so much
faster.
Yes, it is an interesting comparison in any case. Maybe Matlab is doing
some just-in-time compilation, don't know.
thanks,
sven