NN {scmap} | R Documentation

## Main nearest neighbour calculation function. Used on the first reference dataset. Returns a list of three objects: 1) the cell indices of the w nearest neighbours 2) the corresponding approx. cosine similarities

### Description

Main nearest neighbour calculation function. Used on the first reference dataset. Returns a list of three objects: 1) the cell indices of the w nearest neighbours 2) the corresponding approx. cosine similarities

### Usage

    NN(w, k, subcentroids, subclusters, query_chunks, M, SqNorm)

### Arguments

`w` | An integer specifying the number of nearest neighbours
`k` | An integer specifying the number of subcentroids for each product quantization chunk
`subcentroids` | A list of matrices containing the subcentroids of each chunk.
`subclusters` | A matrix containing the subcentroid assignments of each reference cell. See scf_index.
`query_chunks` | A list of matrices containing the chunks of the query dataset after it has been split according to the product quantization method
`M` | An integer specifying the number of chunks
`SqNorm` | A numerical vector containing the Euclidean Squared Norm of each query cell.

[Package scmap version 1.2.0 Index]