DISTANCES
- The type of distances measured (usually an array type)public interface InternalNearestNeighbours<DISTANCES>
Modifier and Type | Method and Description |
---|---|
void |
searchKNN(int[] qus,
int K,
int[][] nnIndices,
DISTANCES[] nnDistances)
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 |
searchNN(int[] qus,
int[] nnIndices,
DISTANCES nnDistances)
Search for the nearest neighbour to each of the N queries (given by their
index in this nearest neighbours object), and return the index of each
nearest neighbour and the respective distance.
|
void searchNN(int[] qus, int[] nnIndices, DISTANCES nnDistances)
This method should not return the same index as the query (i.e. technically it should find the second-nearest-neighbour)
For efficiency, to use this method, you need to pre-construct the arrays for storing the results outside of the method and pass them in as arguments.
qus
- An array of N query vectorsnnIndices
- The return N-dimensional array for holding the indices of the
nearest neighbour of each respective query.nnDistances
- The return N-dimensional array for holding the distances of
the nearest neighbour to each respective query.void searchKNN(int[] qus, int K, int[][] nnIndices, DISTANCES[] nnDistances)
This method should not return the same index as the query (i.e. technically it should find the second-nearest-neighbour as the first returned value)
For efficiency, to use this method, you need to pre-construct the arrays for storing the results outside of the method and pass them in as arguments.
qus
- An array of N query indicesK
- the number of neighbours to findnnIndices
- The return N*K-dimensional array for holding the indices of
the K nearest neighbours of each respective query.nnDistances
- The return N*K-dimensional array for holding the distances of
the nearest neighbours of each respective query.