[mlpack] #251

Ryan Curtin gth671b at mail.gatech.edu
Sun Feb 2 12:25:27 EST 2014


On Sun, Feb 02, 2014 at 06:44:00PM +0530, Abhinav Pathak wrote:
> Hey,
> 
> 1) In which all files do i need to change the definition/declaration of
> BinarySpaceTree class to this form:
> template<
>     typename BoundType,
>     typename MetricType,
>     typename StatisticType,
>     typename SplitType
> >
> class BinarySpaceTree;
> I'm asking this because I'm getting a lot of random errors, which i'm not
> able to debug as of now.
> 
> 
> 
> 2) And can u pls clarify what exactly are: typename BoundType,
>                                                        typename MetricType,
>                                                        typename
> StatisticType,
> 
> I'm slightly confused with the code architecture of BinarySpaceTree class
> 
> 
> 
> 
> 3) And also these functions:
> void SplitNode(MatType& data, std::vector<size_t>& oldFromNew);
> 
> are declared in BinarySpaceTree class, should i remove them from this class
> and put in the Mean Split class? Won't that cause some new errors?
> And if suppose i do so, how would i use functions like bound.Diameter();
> which are needed for the split and are present in the BinarySpaceTree class
> ?
> 
> 
> 4) And in this piece of code:
> template<typename BoundType, typename StatisticType, typename MatType>
> void BinarySpaceTree<BoundType, StatisticType, MatType>::SplitNode(
>     MatType& data,
>     std::vector<size_t>& oldFromNew)
> 
> why have <typename BoundType, typename StatisticType, typename MatType>
> these been passed as template arguments ? I'm mean what the need of doing
> so?

Hello Abhinav,

Your questions seem like basic C++ questions; I'm not the right person
to answer those.  You might try starting with the C++ FAQ [1], any of
the easily searchable introductions to templates ([2], for example), or
Alexandrescu's "Modern C++ Design" book [3].

[1] http://www.parashift.com/c++-faq/
[2] http://www.codeguru.com/cpp/com-tech/atl/tutorials/article.php/c3617/An-Introduction-to-C-Templates.htm
[3] http://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315

Once you've read through those you should be able to better comprehend
the problems you are having.

Thanks,

Ryan

-- 
Ryan Curtin    | "Hi Doggy."
ryan at ratml.org |   - Johnny


More information about the mlpack mailing list