/** * Sets the mean. */ public void setMean(double mean) { if (mean != this.mean) { this.mean = mean; if (mean == -1.0) return; // not defined if (mean < SWITCH_MEAN) { this.cached_g = Math.exp(-mean); } else { this.cached_sq = Math.sqrt(2.0 * mean); this.cached_alxm = Math.log(mean); this.cached_g = mean * cached_alxm - logGamma(mean + 1.0); } } }
/** * Sets the mean. */ public void setMean(double mean) { if (mean != this.mean) { this.mean = mean; if (mean == -1.0) return; // not defined if (mean < SWITCH_MEAN) { this.cached_g = Math.exp(-mean); } else { this.cached_sq = Math.sqrt(2.0 * mean); this.cached_alxm = Math.log(mean); this.cached_g = mean * cached_alxm - logGamma(mean + 1.0); } } }
em = (int) (em); // faster than em = Math.floor(em); t = 0.9 * (1.0 + y * y) * Math.exp(em * alxm - logGamma(em + 1.0) - g); } while (rand.raw() > t); return (int) em;
em = (int) (em); // faster than em = Math.floor(em); t = 0.9 * (1.0 + y * y) * Math.exp(em * alxm - logGamma(em + 1.0) - g); } while (rand.raw() > t); return (int) em;