edu.stanford.math.plex4.kd
public class KDEuclideanMetricSpace extends ObjectSearchableFiniteMetricSpace<double[]>
elements
Constructor and Description |
---|
KDEuclideanMetricSpace(double[][] dataPoints) |
Modifier and Type | Method and Description |
---|---|
double |
distance(double[] a,
double[] b)
This function returns the distance between two points.
|
double |
distance(int i,
int j)
This function returns the distance between the object at index i and the
object at index j.
|
gnu.trove.TIntHashSet |
getClosedNeighborhood(double[] queryPoint,
double epsilon)
This function returns the set of indices of points that are contained in the closed ball
of radius epsilon, centered at the specified query point.
|
double[] |
getMaximumCoordinates() |
double[] |
getMinimumCoordinates() |
int |
getNearestPointIndex(double[] queryPoint)
This function returns the index of the point within the metric space nearest to
the given query point.
|
gnu.trove.TIntHashSet |
getOpenNeighborhood(double[] queryPoint,
double epsilon)
This function returns the set of indices of points that are contained in the open ball
of radius epsilon, centered at the specified query point.
|
double[] |
getPoint(int index)
This function returns the point at the specified index.
|
double[][] |
getPoints()
This function returns the set of points in the metric space as an array.
|
int |
size()
This function returns the number of points in the metric space.
|
getKNearestNeighbors
public double[][] getPoints()
AbstractObjectMetricSpace
getPoints
in interface AbstractObjectMetricSpace<double[]>
getPoints
in class ObjectSearchableFiniteMetricSpace<double[]>
public int getNearestPointIndex(double[] queryPoint)
AbstractSearchableMetricSpace
getNearestPointIndex
in interface AbstractSearchableMetricSpace<double[]>
getNearestPointIndex
in class ObjectSearchableFiniteMetricSpace<double[]>
queryPoint
- the query pointpublic gnu.trove.TIntHashSet getOpenNeighborhood(double[] queryPoint, double epsilon)
AbstractSearchableMetricSpace
getOpenNeighborhood
in interface AbstractSearchableMetricSpace<double[]>
getOpenNeighborhood
in class ObjectSearchableFiniteMetricSpace<double[]>
queryPoint
- the center of the open ballepsilon
- the radius of the open ballpublic gnu.trove.TIntHashSet getClosedNeighborhood(double[] queryPoint, double epsilon)
AbstractSearchableMetricSpace
getClosedNeighborhood
in interface AbstractSearchableMetricSpace<double[]>
getClosedNeighborhood
in class ObjectSearchableFiniteMetricSpace<double[]>
queryPoint
- the center of the closed ballepsilon
- the radius of the closed ballpublic int size()
AbstractIntMetricSpace
size
in interface AbstractIntMetricSpace
size
in class ObjectSearchableFiniteMetricSpace<double[]>
public double distance(double[] a, double[] b)
AbstractObjectMetric
distance
in interface AbstractObjectMetric<double[]>
distance
in class ObjectSearchableFiniteMetricSpace<double[]>
a
- the first pointb
- the second pointpublic double[] getPoint(int index)
AbstractObjectMetricSpace
getPoint
in interface AbstractObjectMetricSpace<double[]>
getPoint
in class ObjectSearchableFiniteMetricSpace<double[]>
index
- the index of the point to retrievepublic double distance(int i, int j)
AbstractIntMetricSpace
distance
in interface AbstractIntMetricSpace
distance
in class ObjectSearchableFiniteMetricSpace<double[]>
i
- the index of the first objectj
- the index of the second objectpublic double[] getMaximumCoordinates()
public double[] getMinimumCoordinates()