/** * Skip to the i-th point in the Halton sequence. * <p> * This operation can be performed in O(1). * * @param index the index in the sequence to skip to * @return the i-th point in the Halton sequence * @throws NotPositiveException if index < 0 */ public double[] skipTo(final int index) throws NotPositiveException { count = index; return nextVector(); }
/** {@inheritDoc} */ public double[] nextVector() { final double[] v = new double[dimension]; for (int i = 0; i < dimension; i++) { int index = count; double f = 1.0 / base[i]; int j = 0; while (index > 0) { final int digit = scramble(i, j, base[i], index % base[i]); v[i] += f * digit; index /= base[i]; // floor( index / base ) f /= base[i]; } } count++; return v; }
/** * Skip to the i-th point in the Halton sequence. * <p> * This operation can be performed in O(1). * * @param index the index in the sequence to skip to * @return the i-th point in the Halton sequence * @throws NotPositiveException if index < 0 */ public double[] skipTo(final int index) throws NotPositiveException { count = index; return nextVector(); }
/** {@inheritDoc} */ public double[] nextVector() { final double[] v = new double[dimension]; for (int i = 0; i < dimension; i++) { int index = count; double f = 1.0 / base[i]; int j = 0; while (index > 0) { final int digit = scramble(i, j, base[i], index % base[i]); v[i] += f * digit; index /= base[i]; // floor( index / base ) f /= base[i]; } } count++; return v; }
/** * Skip to the i-th point in the Halton sequence. * <p> * This operation can be performed in O(1). * * @param index the index in the sequence to skip to * @return the i-th point in the Halton sequence * @throws NotPositiveException if index < 0 */ public double[] skipTo(final int index) throws NotPositiveException { count = index; return nextVector(); }
/** {@inheritDoc} */ public double[] nextVector() { final double[] v = new double[dimension]; for (int i = 0; i < dimension; i++) { int index = count; double f = 1.0 / base[i]; int j = 0; while (index > 0) { final int digit = scramble(i, j, base[i], index % base[i]); v[i] += f * digit; index /= base[i]; // floor( index / base ) f /= base[i]; } } count++; return v; }