Class SobolSequenceGenerator

    • Constructor Detail

      • SobolSequenceGenerator

        public SobolSequenceGenerator​(int dimension)
                               throws MathIllegalArgumentException
        Construct a new Sobol sequence generator for the given space dimension.
        Parameters:
        dimension - the space dimension
        Throws:
        MathIllegalArgumentException - if the space dimension is outside the allowed range of [1, 1000]
      • SobolSequenceGenerator

        public SobolSequenceGenerator​(int dimension,
                                      InputStream is)
                               throws MathIllegalArgumentException,
                                      MathIllegalStateException,
                                      IOException
        Construct a new Sobol sequence generator for the given space dimension with direction vectors loaded from the given stream.

        The expected format is identical to the files available from Stephen Joe and Frances Kuo. The first line will be ignored as it is assumed to contain only the column headers. The columns are:

        • d: the dimension
        • s: the degree of the primitive polynomial
        • a: the number representing the coefficients
        • m: the list of initial direction numbers
        Example:
         d       s       a       m_i
         2       1       0       1
         3       2       1       1 3
         

        The input stream must be an ASCII text containing one valid direction vector per line.

        Parameters:
        dimension - the space dimension
        is - the stream to read the direction vectors from
        Throws:
        MathIllegalArgumentException - if the space dimension is < 1
        MathIllegalArgumentException - if the space dimension is outside the range [1, max], where max refers to the maximum dimension found in the input stream
        MathIllegalStateException - if the content in the stream could not be parsed successfully
        IOException - if an error occurs while reading from the input stream
    • Method Detail

      • nextVector

        public double[] nextVector()
        Generate a random vector.
        Specified by:
        nextVector in interface RandomVectorGenerator
        Returns:
        a random vector as an array of double.
      • skipTo

        public double[] skipTo​(int index)
                        throws MathIllegalArgumentException
        Skip to the i-th point in the Sobol sequence.

        This operation can be performed in O(1).

        Parameters:
        index - the index in the sequence to skip to
        Returns:
        the i-th point in the Sobol sequence
        Throws:
        MathIllegalArgumentException - if index < 0
      • getNextIndex

        public int getNextIndex()
        Returns the index i of the next point in the Sobol sequence that will be returned by calling nextVector().
        Returns:
        the index of the next point