[mlpack] Range search with periodic boundary conditions

董理 dongli at lasg.iap.ac.cn
Wed May 13 11:14:58 EDT 2015


Dear Ryan,

I have encountered the following error when compiling my search codes with CoverTree:

/opt/packman/mlpack/1.0.12/0/include/mlpack/methods/range_search/range_search_impl.hpp:245:63: error: implicit instantiation of undefined template
      'mlpack::tree::CoverTree<geomtk::DomainMetric<geomtk::SphereDomain>, mlpack::tree::FirstPointIsRoot,
      mlpack::tree::EmptyStatistic>::SingleTreeTraverser<mlpack::range::RangeSearchRules<geomtk::DomainMetric<geomtk::SphereDomain>,
      mlpack::tree::CoverTree<geomtk::DomainMetric<geomtk::SphereDomain>, mlpack::tree::FirstPointIsRoot, mlpack::tree::EmptyStatistic> > >'
    typename TreeType::template SingleTreeTraverser<RuleType> traverser(rules);
                                                              ^
/Users/dongli/Works/lasm/src/AdvectionManager.cpp:206:12: note: in instantiation of member function
      'mlpack::range::RangeSearch<geomtk::DomainMetric<geomtk::SphereDomain>, mlpack::tree::CoverTree<geomtk::DomainMetric<geomtk::SphereDomain>,
      mlpack::tree::FirstPointIsRoot, mlpack::tree::EmptyStatistic> >::Search' requested here
    search.Search(r, neighbors, distances);
           ^
…
/opt/packman/mlpack/1.0.12/0/include/mlpack/core/tree/cover_tree/cover_tree.hpp:212:9: note: template is declared here
  class SingleTreeTraverser;
        ^
1 error generated.


The metric class is defined in my codes as:

template <class DomainType>
class DomainMetric {
public:
    static const DomainType *domain;

    DomainMetric() {}

    template <typename VecType1, typename VecType2>
    static double
    Evaluate(const VecType1 &x, const VecType2 &y) {
        return domain->calcDistance(x, y);
    }

    string
    ToString() const {
        return "Implement me!”;
    }
}; // DomainMetric

template <class DomainType>
const DomainType* DomainMetric<DomainType>::domain = NULL;

And I define the RangeSearch template as

typedef geomtk::DomainMetric<typename Mesh::DomainType> MetricType;
typedef mlpack::tree::CoverTree<MetricType> TreeType;
typedef mlpack::range::RangeSearch<MetricType, TreeType> SearchType;

Any idea? Thanks in advance!

Best regards,
Li

> On 2015年5月13日, at 上午6:46, 董理 <dongli at lasg.iap.ac.cn> wrote:
> 
> Never mind! I should modify my SpaceCoord to provide vec data.
> 
>> On 2015年5月12日, at 下午2:44, 董理 <dongli at lasg.iap.ac.cn> wrote:
>> 
>> Dear Ryan,
>> 
>> One more thing. I would like to directly use the space coordinate class in my project instead of arma::mat in CoverTree, such as arma::field<SpaceCoord> (There is ‘col’ method in arma::field, but no ‘unsafe_col’). Because there are auxiliary data like cosLat, etc. It seems that arma::mat is hard-coded. Could I change this easily?
>> 
>> Best regards,
>> Li
>> 
>>> On 2015年5月12日, at 上午10:45, Ryan Curtin <ryan at ratml.org> wrote:
>>> 
>>> On Tue, May 12, 2015 at 06:45:43AM +0800, 董理 wrote:
>>>> Dear Ryan,
>>>> 
>>>> Thanks for your reply! I searched out on the internet, and found the following question:
>>>> 
>>>> http://stackoverflow.com/questions/6917664/nearest-neighbor-search-with-periodic-boundary-conditions <http://stackoverflow.com/questions/6917664/nearest-neighbor-search-with-periodic-boundary-conditions>
>>>> 
>>>> It seems ‘cover tree’ can be used for periodic boundary condition. I see there already is an implementation of cover tree. Could I use it?
>>> 
>>> Yes, you could do that also; I didn't think of that.  If you write a
>>> periodic metric (and it satisfies the conditions of a metric,
>>> importantly, the triangle inequality; I haven't thought about this),
>>> then you can plug that in as the MetricType template parameter to the
>>> CoverTree class, and then use that with the NeighborSearch class and you
>>> will get your results correctly.
>>> 
>>> -- 
>>> Ryan Curtin    | "No... not without incident."
>>> ryan at ratml.org |   - John Preston
>> 
> 
> 
> _______________________________________________
> mlpack mailing list
> mlpack at cc.gatech.edu
> https://mailman.cc.gatech.edu/mailman/listinfo/mlpack

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cc.gatech.edu/pipermail/mlpack/attachments/20150513/3e9cff24/attachment-0003.html>


More information about the mlpack mailing list