Skip to main content
. 2024 Mar 29;10:e1929. doi: 10.7717/peerj-cs.1929

Algorithm 2. SNN query.

1: Input: Query vector q; user-specified radius R; output from Algorithm 1
2: Compute xq:=q−μ
3: Compute the sorting score of xq, i.e., αq:=xqTv1
4: Select candidate index range J so that |αj−αq|≤R for all j∈J
5: Compute d:=x¯(J)−X(J,:)Txq using the precomputed x¯=[xi¯]
6: Return: Points xj with dj≤(R2−xqTxq)/2 according to Eq. (4)