public class ShortNearestNeighboursExact extends ShortNearestNeighbours
Modifier and Type  Class and Description 

static class 
ShortNearestNeighboursExact.Factory
NearestNeighboursFactory for producing
ShortNearestNeighboursExact s. 
Modifier and Type  Field and Description 

protected ShortFVComparator 
distance 
protected short[][] 
pnts 
Constructor and Description 

ShortNearestNeighboursExact(short[][] pnts)
Construct the ShortNearestNeighboursExact over the provided
dataset and using Euclidean distance.

ShortNearestNeighboursExact(short[][] pnts,
ShortFVComparator distance)
Construct the ShortNearestNeighboursExact over the provided
dataset with the given distance function.

Modifier and Type  Method and Description 

float 
computeDistance(short[] a,
short[] b)
Compute the distance between two vectors using the underlying distance
comparison used by this class.

ShortFVComparator 
distanceComparator()
Get the distance comparator

short[][] 
getPoints()
Get the underlying data points.

int 
numDimensions()
Get the number of dimensions of each vector in the dataset

void 
searchKNN(List<short[]> qus,
int K,
int[][] indices,
float[][] distances)
Search for the K nearest neighbours to each of the N queries, and return
the indices of each nearest neighbour and their respective distances.

void 
searchKNN(short[][] qus,
int K,
int[][] indices,
float[][] distances)
Search for the K nearest neighbours to each of the N queries, and return
the indices of each nearest neighbour and their respective distances.

List<IntFloatPair> 
searchKNN(short[] query,
int K)
Search for the K nearest neighbours to the given query and return an
ordered list of pairs containing the distance and index of each
neighbour.

void 
searchNN(List<short[]> qus,
int[] indices,
float[] distances)
Search for the nearest neighbour to each of the N queries, and return the
index of each nearest neighbour and the respective distance.

IntFloatPair 
searchNN(short[] query)
Search for the nearest neighbour to the given query and return a pair
containing the distance and index of that neighbour.

void 
searchNN(short[][] qus,
int[] indices,
float[] distances)
Search for the nearest neighbour to each of the N queries, and return the
index of each nearest neighbour and the respective distance.

int 
size()
Get the size of the dataset

distanceFunc, distanceFunc, distanceFunc, distanceFunc
protected final short[][] pnts
protected final ShortFVComparator distance
public ShortNearestNeighboursExact(short[][] pnts)
pnts
 the datasetpublic ShortNearestNeighboursExact(short[][] pnts, ShortFVComparator distance)
Note: If the distance function provides similarities rather than distances they are automatically inverted.
pnts
 the datasetdistance
 the distance functionpublic void searchNN(short[][] qus, int[] indices, float[] distances)
NearestNeighbours
For efficiency, to use this method, you need to preconstruct the arrays for storing the results outside of the method and pass them in as arguments.
If a nearestneighbour cannot be determined, it will have an index value of 1
qus
 An array of N query vectorsindices
 The return Ndimensional array for holding the indices of the
nearest neighbour of each respective query.distances
 The return Ndimensional array for holding the distances of
the nearest neighbour to each respective query.public void searchKNN(short[][] qus, int K, int[][] indices, float[][] distances)
NearestNeighbours
For efficiency, to use this method, you need to preconstruct the arrays for storing the results outside of the method and pass them in as arguments.
If a kth nearestneighbour cannot be determined, it will have an index value of 1
qus
 An array of N query vectorsK
 the number of neighbours to findindices
 The return N*Kdimensional array for holding the indices of
the K nearest neighbours of each respective query.distances
 The return N*Kdimensional array for holding the distances of
the nearest neighbours of each respective query.public void searchNN(List<short[]> qus, int[] indices, float[] distances)
NearestNeighbours
For efficiency, to use this method, you need to preconstruct the arrays for storing the results outside of the method and pass them in as arguments.
If a nearestneighbour cannot be determined, it will have an index value of 1
qus
 An array of N query vectorsindices
 The return Ndimensional array for holding the indices of the
nearest neighbour of each respective query.distances
 The return Ndimensional array for holding the distances of
the nearest neighbour to each respective query.public void searchKNN(List<short[]> qus, int K, int[][] indices, float[][] distances)
NearestNeighbours
For efficiency, to use this method, you need to preconstruct the arrays for storing the results outside of the method and pass them in as arguments.
If a kth nearestneighbour cannot be determined, it will have an index value of 1
qus
 An array of N query vectorsK
 the number of neighbours to findindices
 The return N*Kdimensional array for holding the indices of
the K nearest neighbours of each respective query.distances
 The return N*Kdimensional array for holding the distances of
the nearest neighbours of each respective query.public List<IntFloatPair> searchKNN(short[] query, int K)
NearestNeighbours
If k neighbours cannot be determined, then the resultant list might have fewer than k elements.
query
 the query vectorK
 the number of neighbours to search forpublic IntFloatPair searchNN(short[] query)
NearestNeighbours
If the nearestneighbour cannot be determined null
will be
returned.
query
 the query vectorpublic int numDimensions()
ShortNearestNeighbours
numDimensions
in class ShortNearestNeighbours
public int size()
NearestNeighbours
public short[][] getPoints()
public float computeDistance(short[] a, short[] b)
a
 the first vectorb
 the second vectorpublic ShortFVComparator distanceComparator()