[mlpack] Range search with periodic boundary conditions

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


You guess is correct! Thanks for saving me~

Li
> On 2015年5月13日, at 下午11:34, Ryan Curtin <ryan at ratml.org> wrote:
> 
> On Wed, May 13, 2015 at 11:14:58PM +0800, 董理 wrote:
>> 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!
> 
> My first guess is that you're including
> src/mlpack/core/tree/cover_tree/cover_tree.hpp, when really you should
> include src/mlpack/core/tree/cover_tree.hpp, which then includes
> everything else associated with the cover tree.
> 
> Probably the right thing to do on the mlpack side is to make sure that
> cover_tree.hpp includes everything that it needs...
> 
> -- 
> Ryan Curtin    | "What? Facts?"
> ryan at ratml.org |   - Joe Cairo




More information about the mlpack mailing list