/** * Constructs an Empirical distribution. The probability distribution * function (pdf) is an array of positive real numbers. It need not be * provided in the form of relative probabilities, absolute probabilities * are also accepted. The <tt>pdf</tt> must satisfy both of the following * conditions * <ul> * <li><tt>0.0 <= pdf[i] : 0<=i<=pdf.length-1</tt> * <li><tt>0.0 < Sum(pdf[i]) : 0<=i<=pdf.length-1</tt> * </ul> * * @param pdf * the probability distribution function. * @param interpolationType * can be either <tt>Empirical.NO_INTERPOLATION</tt> or * <tt>Empirical.LINEAR_INTERPOLATION</tt>. * @param randomGenerator * a uniform random number generator. * @throws IllegalArgumentException * if at least one of the three conditions above is violated. */ public EmpiricalWalker(double[] pdf, int interpolationType, DoubleRandomEngine randomGenerator) { setRandomGenerator(randomGenerator); setState(pdf, interpolationType); setState2(pdf); }
/** * Constructs an Empirical distribution. The probability distribution * function (pdf) is an array of positive real numbers. It need not be * provided in the form of relative probabilities, absolute probabilities * are also accepted. The <tt>pdf</tt> must satisfy both of the following * conditions * <ul> * <li><tt>0.0 <= pdf[i] : 0<=i<=pdf.length-1</tt> * <li><tt>0.0 < Sum(pdf[i]) : 0<=i<=pdf.length-1</tt> * </ul> * * @param pdf * the probability distribution function. * @param interpolationType * can be either <tt>Empirical.NO_INTERPOLATION</tt> or * <tt>Empirical.LINEAR_INTERPOLATION</tt>. * @param randomGenerator * a uniform random number generator. * @throws IllegalArgumentException * if at least one of the three conditions above is violated. */ public EmpiricalWalker(double[] pdf, int interpolationType, DoubleRandomEngine randomGenerator) { setRandomGenerator(randomGenerator); setState(pdf, interpolationType); setState2(pdf); }