if (any(cond)) {
idraw = which.min(cond) - 1 #max(ind)
rho = detval1[idraw]#FIXME: This sometimes fail...
}
Afaik the idea of this step (as implemented in MATLAB) is to get the position of the last TRUE value (ind = find(den <= rnd); idraw = max(ind);).
This differs from the logic here - i.e. looking for the first FALSE and returning the prior position. I'm unsure whether this actually occurs, but if we have cond == c(FALSE, TRUE, TRUE, TRUE, FALSE) this fails. If we want the last TRUE value max(which(cond)) seems more appropriate. The approach here will yield 0 and fail subsequently.
Apparently the Griddy Gibbs step sometimes fails:
Afaik the idea of this step (as implemented in MATLAB) is to get the position of the last
TRUE
value (ind = find(den <= rnd); idraw = max(ind);
).This differs from the logic here - i.e. looking for the first
FALSE
and returning the prior position. I'm unsure whether this actually occurs, but if we havecond == c(FALSE, TRUE, TRUE, TRUE, FALSE)
this fails. If we want the lastTRUE
valuemax(which(cond))
seems more appropriate. The approach here will yield 0 and fail subsequently.