Hi All-
I'm reporting a bug with SnPM5, in which snpm_pi_OneSampT fails when nScan exceeds 54. This is because
[Line 193] PiCond = 2*rem(floor(tmp(:)*pow2(-(nScan-1):0)),2)-1;
will return incorrect values, since rem(x,2) will return 0 for any value of x greater than pow2(53)-1. I believe this is due to the numerical precision limits of matlab. This causes several issues, the first of which is that iCond will never appear in PiCond.
My question is, is this a known bug? Is there any reason the random vectors of -1's and 1's are generated in this way? Would there be any problem with fixing it by replacing the majority of that portion of the script with:
PiCond = [ones(1,nScan); (randint(nPiCond-1,nScan)*2-1)];
?
Thanks!
|