edu.stanford.math.plex4.metric.impl
public class ExplicitMetricSpace extends java.lang.Object implements AbstractSearchableMetricSpace<java.lang.Integer>
| Constructor and Description |
|---|
ExplicitMetricSpace(double[][] distanceMatrix)
This constructor initializes the class with the given distance matrix.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distance(java.lang.Integer a,
java.lang.Integer 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(java.lang.Integer 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.
|
gnu.trove.TIntHashSet |
getKNearestNeighbors(java.lang.Integer queryPoint,
int k)
This function returns the indices of the k points that are closest to the given query point.
|
int |
getNearestPointIndex(java.lang.Integer queryPoint)
This function returns the index of the point within the metric space nearest to
the given query point.
|
gnu.trove.TIntHashSet |
getOpenNeighborhood(java.lang.Integer 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.
|
java.lang.Integer |
getPoint(int index)
This function returns the point at the specified index.
|
java.lang.Integer[] |
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.
|
public ExplicitMetricSpace(double[][] distanceMatrix)
distanceMatrix - the distance matrix to initialize withAbstractSearchableMetricSpacepublic double distance(int i,
int j)
AbstractIntMetricSpacedistance in interface AbstractIntMetricSpacei - the index of the first objectj - the index of the second objectpublic int size()
AbstractIntMetricSpacesize in interface AbstractIntMetricSpacepublic gnu.trove.TIntHashSet getClosedNeighborhood(java.lang.Integer queryPoint,
double epsilon)
AbstractSearchableMetricSpacegetClosedNeighborhood in interface AbstractSearchableMetricSpace<java.lang.Integer>queryPoint - the center of the closed ballepsilon - the radius of the closed ballpublic gnu.trove.TIntHashSet getKNearestNeighbors(java.lang.Integer queryPoint,
int k)
AbstractSearchableMetricSpacegetKNearestNeighbors in interface AbstractSearchableMetricSpace<java.lang.Integer>queryPoint - the reference pointk - the number of nearest neighbors to getpublic int getNearestPointIndex(java.lang.Integer queryPoint)
AbstractSearchableMetricSpacegetNearestPointIndex in interface AbstractSearchableMetricSpace<java.lang.Integer>queryPoint - the query pointpublic gnu.trove.TIntHashSet getOpenNeighborhood(java.lang.Integer queryPoint,
double epsilon)
AbstractSearchableMetricSpacegetOpenNeighborhood in interface AbstractSearchableMetricSpace<java.lang.Integer>queryPoint - the center of the open ballepsilon - the radius of the open ballpublic java.lang.Integer getPoint(int index)
AbstractObjectMetricSpacegetPoint in interface AbstractObjectMetricSpace<java.lang.Integer>index - the index of the point to retrievepublic java.lang.Integer[] getPoints()
AbstractObjectMetricSpacegetPoints in interface AbstractObjectMetricSpace<java.lang.Integer>public double distance(java.lang.Integer a,
java.lang.Integer b)
AbstractObjectMetricdistance in interface AbstractObjectMetric<java.lang.Integer>a - the first pointb - the second point