SSJ
V. labo.

umontreal.iro.lecuyer.hups
Class PointSet

java.lang.Object
  extended by umontreal.iro.lecuyer.hups.PointSet
Direct Known Subclasses:
CachedPointSet, ContainerPointSet, CycleBasedPointSet, DigitalNet, HaltonSequence, HammersleyPointSet, PaddedPointSet, Rank1Lattice, SubsetOfPointSet

public abstract class PointSet
extends Object

PointSet

This abstract class defines the basic methods for accessing and manipulating point sets. A point set can be represented as a two-dimensional array, whose element (i, j) contains ui, j, the coordinate j of point i. Each coordinate ui, j is assumed to be in the unit interval [0, 1]. Whether the values 0 and 1 can occur may depend on the actual implementation of the point set.

All points have the same number of coordinates (their dimension) and this number can be queried by getDimension. The number of points is queried by getNumPoints. The points and coordinates are both numbered starting from 0 and their number can actually be infinite.

The iterator method provides a point set iterator which permits one to enumerate the points and their coordinates. Several iterators over the same point set can coexist at any given time. These iterators are instances of a hidden inner-class that implements the PointSetIterator interface. The default implementation of iterator provided here relies on the method getCoordinate to access the coordinates directly. However, this approach is rarely efficient. Specialized implementations that dramatically improve the performance are provided in subclasses of PointSet. The PointSetIterator interface actually extends the RandomStream interface, so that the iterator can also be seen as a RandomStream and used wherever such a stream is required for generating uniform random numbers. This permits one to easily replace pseudorandom numbers by the coordinates of a selected set of highly-uniform points, i.e., to replace Monte Carlo by quasi-Monte Carlo in a simulation program.

This abstract class has only one abstract method: getCoordinate. Providing an implementation for this method is already sufficient for the subclass to work. However, in many cases, efficiency can be dramatically improved by overwriting iterator to provide a custom iterator that does not necessarily rely on getCoordinate. In fact, direct use of getCoordinate to access the coordinates is generally discouraged. One should access the points and coordinates via the iterators.


\begin{detailed}%
 The built-in range checks require some extra time and also
 ass...
 ...(stream)} methods abstract,
 or make them do nothing by default.}
 \end{detailed}


Constructor Summary
PointSet()
           
 
Method Summary
 void addRandomShift()
          Deprecated. 
 void addRandomShift(int d1, int d2)
          Deprecated. 
 void addRandomShift(int d1, int d2, RandomStream stream)
          Deprecated. 
 void addRandomShift(RandomStream stream)
          Deprecated. 
 void clearRandomShift()
          Deprecated. 
 String formatPoints()
          .
 String formatPoints(int n, int d)
          .
 String formatPoints(PointSetIterator iter)
          .
 String formatPoints(PointSetIterator iter, int n, int d)
          .
 String formatPointsBase(int b)
          .
 String formatPointsBase(int n, int d, int b)
          .
 String formatPointsBase(PointSetIterator iter, int b)
          .
 String formatPointsBase(PointSetIterator iter, int n, int d, int b)
          .
 String formatPointsNumbered()
          .
 String formatPointsNumbered(int n, int d)
          .
abstract  double getCoordinate(int i, int j)
          .
 int getDimension()
          .
 int getNumPoints()
          .
 RandomStream getStream()
          .
 PointSetIterator iterator()
          .
 void randomize()
          Deprecated. 
 void randomize(int d1, int d2)
          Deprecated. 
 void randomize(int fromDim, int toDim, RandomStream stream)
          .
 void randomize(PointSetRandomization rand)
          .
 void randomize(RandomStream stream)
          .
 void setStream(RandomStream stream)
          .
 String toString()
          .
 void unrandomize()
          .
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointSet

public PointSet()
Method Detail

getDimension

public int getDimension()
. \begin{tabb}
 Returns the dimension (number of available coordinates) of the poi...
 ...nsion is actually infinite, \texttt{Integer.MAX\_VALUE} is returned.
 \end{tabb}
the dimension of the point set or Integer.MAX_VALUE if it is infinite


getNumPoints

public int getNumPoints()
. \begin{tabb}
 Returns the number of points.
 If this number is actually infinite, \texttt{Integer.MAX\_VALUE} is returned.
 \end{tabb}
the number of points in the point set or Integer.MAX_VALUE if the point set has an infinity of points.


getCoordinate

public abstract double getCoordinate(int i,
                                     int j)
. \begin{tabb}
 Returns $u_{i,j}$, the coordinate $j$\ of the point $i$.
 \richard{...
 ...xttt{getCoordinate} impl\'ementent le random shift
 quand il existe?}
 \end{tabb}
iindex of the point to look for jindex of the coordinate to look for the value of ui, j


iterator

public PointSetIterator iterator()
. \begin{tabb}
 Constructs and returns a point set iterator.
 The default implemen...
 ...oordinates, but subclasses can reimplement it
 for better efficiency.
 \end{tabb}
point set iterator for the point set


setStream

public void setStream(RandomStream stream)
. \begin{tabb}
 Sets the random stream used to generate random shifts to \texttt{stream}.
 \end{tabb}
streamthe new random stream


getStream

public RandomStream getStream()
. \begin{tabb}
 Returns the random stream used to generate random shifts.
 \end{tabb}
the random stream used


randomize

public void randomize(PointSetRandomization rand)
. \begin{tabb}
 Randomizes the point set using the given \texttt{rand}.
 \end{tabb}
randPointSetRandomization to use


addRandomShift

@Deprecated
public void addRandomShift(int d1,
                                      int d2,
                                      RandomStream stream)
Deprecated. 

. \begin{tabb}This method does nothing for this generic class.
 In some subclasses...
 ...te the random numbers,
 for coordinates \texttt{d1} to \texttt{d2-1}.
 \end{tabb}


addRandomShift

@Deprecated
public void addRandomShift(RandomStream stream)
Deprecated. 

. \begin{tabb}This method does nothing for this generic class.
 Similar to \texttt...
 ...tream)},
 with \texttt{d2} the dimension of the current random shift.
 \end{tabb}

 


addRandomShift

@Deprecated
public void addRandomShift(int d1,
                                      int d2)
Deprecated. 

. \begin{tabb}Similar to \texttt{addRandomShift(d1, d2, stream)}, with
 the current random stream.% This method does nothing for this generic class.
 \end{tabb}


addRandomShift

@Deprecated
public void addRandomShift()
Deprecated. 

. \begin{hide}
 \par
 \begin{tabb}Similar to \texttt{addRandomShift(0, d2, stream)}
 ...
 ...om shift.% This method does nothing for this generic class.
 \end{tabb}\end{hide}


clearRandomShift

@Deprecated
public void clearRandomShift()
Deprecated. 

. \begin{tabb}
 Erases the current random shift, if any.
 \end{tabb}


randomize

public void randomize(int fromDim,
                      int toDim,
                      RandomStream stream)
. \begin{tabb}By default, this method simply calls
 \texttt{addRandomShift (fromDim, toDim, stream)}, which does nothing.
 \end{tabb}


randomize

public void randomize(RandomStream stream)
. \begin{tabb}By default, this method simply calls
 \method{randomize (0, dim, stream)}.
 \end{tabb}

 


randomize

@Deprecated
public void randomize(int d1,
                                 int d2)
Deprecated. 

. \begin{tabb}By default, this method simply calls \texttt{addRandomShift(d1, d2)}.
 \end{tabb}


randomize

@Deprecated
public void randomize()
Deprecated. 

. \begin{hide}
 \par
 \begin{tabb}By default, this method simply calls \texttt{addRandomShift()}.
 \end{tabb}\end{hide}


unrandomize

public void unrandomize()
. \begin{tabb}By default, this method simply calls
 \texttt{clearRandomShift()}.
 \end{tabb}


toString

public String toString()
. \begin{tabb}
 Formats a string that contains information about the point set.
 \end{tabb}
string representation of the point set information

Overrides:
toString in class Object

formatPoints

public String formatPoints()
. \begin{tabb}
 Same as invoking \method{formatPoints}{int,int}\texttt{(n, d)} wit...
 ...the
 number of points and the dimension of this object, respectively.
 \end{tabb}
string representation of all the points in the point set UnsupportedOperationExceptionif the number of points or dimension of the point set is infinite


formatPoints

public String formatPoints(int n,
                           int d)
. \begin{tabb}
 Formats a string that displays the same information as returned by...
 ...rator
 repeatedly.
 % \hpierre{Could perhaps just print what exists.}
 \end{tabb}
nnumber of points ddimension string representation of first d coordinates of first n points in the point set


formatPoints

public String formatPoints(PointSetIterator iter)
. \begin{tabb}
 Same as invoking \method{formatPoints}{PointSetIterator,int,int}\t...
 ...d $d$\ equal to the number of points and the dimension, respectively.
 \end{tabb}
iteriterator associated to the point set string representation of all the points in the point set UnsupportedOperationExceptionif the number of points or dimension of the point set is infinite


formatPoints

public String formatPoints(PointSetIterator iter,
                           int n,
                           int d)
. \begin{tabb}
 Same as invoking \method{formatPoints}{int,int}\texttt{(n, d)}, bu...
 ...s may be different than the one resulting from the
 default iterator.
 \end{tabb}
iteriterator associated to the point set nnumber of points ddimension string representation of first d coordinates of first n points in the point set


formatPointsBase

public String formatPointsBase(int b)
. \begin{tabb}
 Similar to \method{formatPoints}{}\texttt{()}, but the
 points coordinates are printed in base $b$.
 \end{tabb}
bbase string representation of all the points in the point set UnsupportedOperationExceptionif the number of points or dimension of the point set is infinite


formatPointsBase

public String formatPointsBase(int n,
                               int d,
                               int b)
. \begin{tabb}
 Similar to \method{formatPoints}{int,int}\texttt{(n, d)}, but the
 points coordinates are printed in base $b$.
 \end{tabb}
nnumber of points ddimension bbase string representation of first d coordinates of first n points in the point set


formatPointsBase

public String formatPointsBase(PointSetIterator iter,
                               int b)
. \begin{tabb}
 Similar to
 \method{formatPoints}{PointSetIterator}\texttt{(iter)},
 but the points coordinates are printed in base $b$.
 \end{tabb}
iteriterator associated to the point set bbase string representation of all the points in the point set UnsupportedOperationExceptionif the number of points or dimension of the point set is infinite


formatPointsBase

public String formatPointsBase(PointSetIterator iter,
                               int n,
                               int d,
                               int b)
. \begin{tabb}
 Similar to
 \method{formatPoints}{PointSetIterator,int,int}\texttt{(iter, n, d)},
 but the points coordinates are printed in base $b$.
 \end{tabb}
iteriterator associated to the point set nnumber of points ddimension bbase string representation of first d coordinates of first n points in the point set


formatPointsNumbered

public String formatPointsNumbered()
. \begin{tabb}
 Same as invoking \method{formatPointsNumbered}{int,int}{\texttt{(n...
 ... $d$\ equal to the number of points and the dimension,
 respectively.
 \end{tabb}
string representation of all the points in the point set UnsupportedOperationExceptionif the number of points or dimension of the point set is infinite


formatPointsNumbered

public String formatPointsNumbered(int n,
                                   int d)
. \begin{tabb}
 Same as invoking \method{formatPoints}{int,int}{\texttt{(n,d)}}, except that the points are numbered.
 \end{tabb}
nnumber of points ddimension string representation of first d coordinates of first n points in the point set


SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.