edu.stanford.math.plex4.metric.impl
T
- public abstract class ObjectSearchableFiniteMetricSpace<T> extends java.lang.Object implements AbstractSearchableMetricSpace<T>
Modifier and Type | Field and Description |
---|---|
protected T[] |
elements
This array stores the elements in the metric space
|
Constructor and Description |
---|
ObjectSearchableFiniteMetricSpace(T[] array)
This constructor initializes the class with an array of elements.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(int i,
int j)
This function returns the distance between the object at index i and the
object at index j.
|
abstract double |
distance(T a,
T b)
This function returns the distance between two points.
|
gnu.trove.TIntHashSet |
getClosedNeighborhood(T 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(T queryPoint,
int k)
This function returns the indices of the k points that are closest to the given query point.
|
int |
getNearestPointIndex(T queryPoint)
This function returns the index of the point within the metric space nearest to
the given query point.
|
gnu.trove.TIntHashSet |
getOpenNeighborhood(T 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.
|
T |
getPoint(int index)
This function returns the point at the specified index.
|
T[] |
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.
|
protected final T[] elements
public ObjectSearchableFiniteMetricSpace(T[] array)
array
- the array of elements that will be the points in the metric spacepublic gnu.trove.TIntHashSet getKNearestNeighbors(T queryPoint, int k)
AbstractSearchableMetricSpace
getKNearestNeighbors
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the reference pointk
- the number of nearest neighbors to getpublic int getNearestPointIndex(T queryPoint)
AbstractSearchableMetricSpace
getNearestPointIndex
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the query pointpublic gnu.trove.TIntHashSet getOpenNeighborhood(T queryPoint, double epsilon)
AbstractSearchableMetricSpace
getOpenNeighborhood
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the center of the open ballepsilon
- the radius of the open ballpublic gnu.trove.TIntHashSet getClosedNeighborhood(T queryPoint, double epsilon)
AbstractSearchableMetricSpace
getClosedNeighborhood
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the center of the closed ballepsilon
- the radius of the closed ballpublic abstract double distance(T a, T b)
AbstractObjectMetric
distance
in interface AbstractObjectMetric<T>
a
- the first pointb
- the second pointpublic T getPoint(int index)
AbstractObjectMetricSpace
getPoint
in interface AbstractObjectMetricSpace<T>
index
- the index of the point to retrievepublic T[] getPoints()
AbstractObjectMetricSpace
getPoints
in interface AbstractObjectMetricSpace<T>
public double distance(int i, int j)
AbstractIntMetricSpace
distance
in interface AbstractIntMetricSpace
i
- the index of the first objectj
- the index of the second objectpublic int size()
AbstractIntMetricSpace
size
in interface AbstractIntMetricSpace