umontreal.iro.lecuyer.hups
Class SubsetOfPointSet
- java.lang.Object
-
- umontreal.iro.lecuyer.hups.PointSet
-
- umontreal.iro.lecuyer.hups.SubsetOfPointSet
-
public class SubsetOfPointSet extends PointSet
This container class permits one to select a subset of a point set. This is done by selecting a range or providing an array of either point or coordinate indices. A typical application of a range selection is to make the number of points or the dimension finite. It is also possible to provide, for example, a random permutation in the selection of components. It is possible also to take projections of coordinates for selected dimensions.Selecting a new subset of points or coordinates overwrites the previous selection. The specification of a subset with respect to the points is independent from selecting a subset with respect to the coordinates. The number of points and the dimension are adapted to the current selection and all indices still start from 0, i.e., the subset works just like an ordinary point set.
When the points or coordinates ranges are changed, existing iterators become invalid. They should be reconstructed or reset to avoid inconsistencies.
-
-
Constructor Summary
Constructors Constructor and Description SubsetOfPointSet(PointSet P)Constructs a newPointSetobject, initially identical to P, and from which a subset of the points and/or a subset of the coordinates is to be extracted.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetCoordinate(int i, int j)Returns ui, j, the coordinate j of the point i.PointSetIteratoriterator()Constructs and returns a point set iterator.voidselectCoordinates(int[] coordIndices, int numCoord)Selects the numCoord coordinates whose numbers are provided in the array coordIndices.voidselectCoordinatesRange(int from, int to)Selects the coordinates from ``from'' to ``to - 1'' from the original point set.voidselectPoints(int[] pointIndices, int numPoints)Selects the numPoints points whose numbers are provided in the array pointIndices.voidselectPointsRange(int from, int to)Selects the points numbered from ``from'' to ``to - 1'' from the original point set.java.lang.StringtoString()Formats a string that contains information about the point set.-
Methods inherited from class umontreal.iro.lecuyer.hups.PointSet
addRandomShift, addRandomShift, addRandomShift, addRandomShift, clearRandomShift, formatPoints, formatPoints, formatPoints, formatPoints, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsNumbered, formatPointsNumbered, getDimension, getNumPoints, getStream, randomize, randomize, randomize, randomize, randomize, setStream, unrandomize
-
-
-
-
Method Detail
-
selectPointsRange
public void selectPointsRange(int from, int to)Selects the points numbered from ``from'' to ``to - 1'' from the original point set.- Parameters:
from- index of the point, in the contained point set, corresponding to the point 0 of this point setto- index of the last point taken from the contained point set
-
selectPoints
public void selectPoints(int[] pointIndices, int numPoints)Selects the numPoints points whose numbers are provided in the array pointIndices.- Parameters:
pointIndices- array of point indices to be selectednumPoints- number of points in the subset of point set
-
selectCoordinatesRange
public void selectCoordinatesRange(int from, int to)Selects the coordinates from ``from'' to ``to - 1'' from the original point set.- Parameters:
from- index of the coordinate, in the contained point set, corresponding to the coordinate 0 of each point of this point setto- index of the last coordinate taken for each point from the contained point set
-
selectCoordinates
public void selectCoordinates(int[] coordIndices, int numCoord)Selects the numCoord coordinates whose numbers are provided in the array coordIndices.- Parameters:
coordIndices- array of coordinate indices to be selectednumCoord- number of coordinatess for each point in the subset of point set
-
getCoordinate
public double getCoordinate(int i, int j)Description copied from class:PointSetReturns ui, j, the coordinate j of the point i.- Specified by:
getCoordinatein classPointSet- Parameters:
i- index of the point to look forj- index of the coordinate to look for- Returns:
- the value of ui, j
-
iterator
public PointSetIterator iterator()
Description copied from class:PointSetConstructs and returns a point set iterator. The default implementation returns an iterator that uses the methodgetCoordinate(i,j) to iterate over the points and coordinates, but subclasses can reimplement it for better efficiency.
-
-
DMelt 3.0 © DataMelt by jWork.ORG