So imagine I have a $m$ vectors each of dimension $d$. Lets call them, $\vec x_{i}$, with $i = 1, 2, 3, 4, 5, \dots, m$. Now the idea is to find the neighbours of $\vec x_{i}$ (calling them $\vec x_{j}$), within a ball of radius $r$. So, $$ || \vec x_{i} - \vec x_{j} || \le r$$.
Note: $|| \cdots ||$ is the Euclidean norm.
Naively one can compute distance between all the $j$'s for a particular $i$, and then sort them, and keep only the elements which are less than $r$. This is computationally expensive for large $m$ and $d$.
So the question is how can I efficiently compute the neighbours $x_{j}$?