[mlpack] How to keep object when searching neighbors?

Ryan Curtin gth671b at mail.gatech.edu
Wed Jan 15 21:57:52 EST 2014


On Thu, Jan 16, 2014 at 10:36:49AM +0800, Li Dong wrote:
> > You can use the RangeSearch class to find all the neighbors of a tracer
> > in a specified radius.
> 
> RangeSearch is exactly what I want.
> 
> > Or am I misunderstanding?  Are you trying to find the Tracer neighbors
> > of the MeshCell points or the MeshCell neighbors of the Tracer points?
> 
> MeshCells is the reference dataset, and Tracer is the query point.

Ok, in that case my idea will work; build a tree on MeshCell points,
then use single-tree NeighborSearch during each iteration.  It'll look
something like this...

{{{
  using namespace mlpack;

  arma::mat meshPoints; // Constructed somehow
  arma::mat tracerPoints; // Constructed somehow

  AllkNN allknn(meshPoints, tracerPoints, false /* not naive */, true /* single mode */);

  while (stillRunning)
  {
    // recalculate tracer points
    ...

    arma::mat distances;
    arma::Mat<size_t> neighbors;
    allknn.Search(k, neighbors, distances);
  }
}}}

-- 
Ryan Curtin    | "I don't really come from outer space."
ryan at ratml.org |   - L.J. Washington


More information about the mlpack mailing list