25package umontreal.ssj.hups;
27import umontreal.ssj.util.PrintfFormat;
28import java.util.Arrays;
29import umontreal.ssj.util.multidimsort.DoubleArrayComparator;
30import umontreal.ssj.util.multidimsort.MultiDimSort;
31import umontreal.ssj.rng.RandomStream;
54 protected double x[][];
59 boolean randomizeParent =
true;
61 protected CachedPointSet() {
80 throw new IllegalArgumentException(
"Cannot cache more points than in point set p.");
82 throw new IllegalArgumentException(
"Attempt to cache points using more coordinates than the dimension.");
83 if (toPoint == Integer.MAX_VALUE)
84 throw new IllegalArgumentException(
"Cannot cache infinite number of points");
85 if (toDim == Integer.MAX_VALUE)
86 throw new IllegalArgumentException(
"Cannot cache infinite dimensional points");
87 this.fromPoint = fromPoint;
89 this.fromDim = fromDim;
90 dim = toDim - fromDim;
113 this(p, 0, n, 0,
dim);
142 this.randomizeParent = randomizeParent;
154 P.addRandomShift(d1, d2, stream);
166 if (randomizeParent) {
202 for (
int j = 0; j < d; j++)
203 x[i][j] = x[i][j + d];
209 sb.append(super.toString());
211 sb.append(P.toString());
213 return sb.toString();
220 public double[][] getArray() {
250 for (
int j = 0; j < d; j++)
This class implements a CachedPointSet iterator which takes the values directly in the array x in whi...
void nextCoordinates(double p[], int d)
CachedPointSet(PointSet p)
Creates a new PointSet object that contains an array storing the points of p.
void randomize(PointSetRandomization rand)
Randomizes the underlying point set using rand and re-caches the points.
void sortByCoordinate(int j)
Sorts the cached points by increasing order of coordinate j.
void fillCache(int fromDim, int dim)
Caches the points, skipping fromDim coordinates and taking the next dim ones.
void addRandomShift(int d1, int d2, RandomStream stream)
Generates a random shift, adds it to the contained point set, and re-caches the points.
PointSetIterator iterator()
Constructs and returns a point set iterator that gets the values directly from the cached array.
void stripCoordinates(int d)
Removes the first d coordinates of each cached point.
double getCoordinate(int i, int j)
Returns , the coordinate of the point .
CachedPointSet(PointSet p, int n, int dim)
Same as CachedPointSet(p, 0,n, 0, dim).
String toString()
Formats a string that contains information about the point set.
PointSet getParentPointSet()
Returns the reference point set that was passed to the constructor.
CachedPointSet(PointSet p, int fromPoint, int toPoint, int fromDim, int toDim)
Creates a new PointSet object that contains an array storing the coordinates fromDim (inclusive) to t...
public< T > void sort(MultiDimSort< T > sort)
Sorts the cached points (only) with the given.
void setRandomizeParent(boolean randomizeParent)
If randomizeParent is true, calls to randomize() will be defered to the parent point set (this is the...
This class implements a default point set iterator.
int curPointIndex
Index of the current point.
int curCoordIndex
Index of the current coordinate.
void outOfBounds()
Error message for index out of bounds.
This abstract class represents a general point set.
int numPoints
Number of points.
int getNumPoints()
Returns the number of points.
int getDimension()
Returns the dimension (number of available coordinates) of the points.
int dim
Dimension of the points.
This provides an implementation of Comparator in which arrays of double in dimensions are compared b...
This is the interface for iterators that permit one to go through the points of a PointSet and the su...
void setCurPointIndex(int i)
Resets the current point index to and the current coordinate index to zero.
int nextPoint(double[] p, int fromDim, int d)
Returns in p the next d coordinates of the current point, starting at coordinate fromDim (i....
This interface is for a randomization that can be used to randomize a umontreal.ssj....
void randomize(PointSet p)
This method must randomize p.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
This interface is meant to be implemented by certain multivariate sorting algorithms that sort object...