How would one implement the rangesearch()?

I’m using some code that requires Matlab’s rangesearch().

I tried looking it up, but I’m confused about implementational details.

If I understood (Find all neighbors within specified distance using input data - MATLAB rangesearch - MathWorks Nordic):

For each row vector of Y, it finds the row indices of X that are within the specified radius.
Then it repeats this for every row vector of Y.

Any input?

rangesearch seems to be not implemented in Octave or any known package.

Looking at the documentation, it sounds like this function returns a sorted subset of the matrix generated by pdist2 from the statistics package. Depending on the size of your data, you can compute this distance matrix and compare the distances to some radius “r”.