edu.stanford.math.plex
public class EuclideanArrayData extends PointData.NSpace
EuclideanArrayData
class is the simplest implementation
of NSpace. Intended for smallish data sets. Instances of this class are
implemented at 0-based arrays of double, but the first dimension()
entries are ignored, since PointData instances are indexed from 1 to
count(), inclusive. This is occasionally awkward, and it is the reason
that constructors that provide the data in the form of double[][], do
not require "blank space" to be provided.PointData.Discrete, PointData.NSpace, PointData.Predicate
Modifier | Constructor and Description |
---|---|
protected |
EuclideanArrayData() |
|
EuclideanArrayData(double[][] data)
Construct a EuclideanArrayData instance from a double[][].
|
|
EuclideanArrayData(double[] data,
int dimension)
The obvious constructor for this class.
|
|
EuclideanArrayData(int num_pts,
int dimension) |
|
EuclideanArrayData(int num_pts,
int dimension,
double min,
double max) |
Modifier and Type | Method and Description |
---|---|
double |
coordinate(int p,
int i)
Get coordinates.
|
int |
count()
The number of data points.
|
int |
dimension()
The number of dimensions of the space.
|
double |
distance(int p1,
int p2)
Euclidean distance.
|
double[] |
get_pt(int p,
double[] vec)
Get point.
|
protected boolean |
pointsAreConsistent(double[][] data) |
protected boolean |
pointsAreConsistent(double[] data,
int dimension) |
xi
random_points
protected EuclideanArrayData()
public EuclideanArrayData(double[] data, int dimension)
This is more likely to be called programmatically. The first dimension entries in data are ignored.
data
- The first dimension entries of this array will be ignored.dimension
- The number of dimensions.public EuclideanArrayData(double[][] data)
This constructor requires taht the double[][] be of consistent dimenions; that is, data[i].length must be constant -- this will be the dimension of the instance. The instance will be initialize with data[0] being the first "point", so data.length will be count().
data
- A "rectangular matrix" of data; data[0] is the first point.public EuclideanArrayData(int num_pts, int dimension)
public EuclideanArrayData(int num_pts, int dimension, double min, double max)
public int dimension()
dimension
in class PointData.NSpace
public int count()
public double distance(int p1, int p2)
public double coordinate(int p, int i)
coordinate
in class PointData.NSpace
p
- the pointi
- the coordinatepublic double[] get_pt(int p, double[] vec)
p
- the pointvec
- place to store pointprotected boolean pointsAreConsistent(double[] data, int dimension)
protected boolean pointsAreConsistent(double[][] data)