From 69ce9b8ff2bee262e5cec9cdb9e59d4e625a95f5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 14 Dec 2011 08:04:33 +0000 Subject: [PATCH] New Statistic API. --- src/mlpack/methods/emst/dtb.hpp | 10 ++++++---- src/mlpack/methods/emst/dtb_impl.hpp | 26 +++++++++++++++++--------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/mlpack/methods/emst/dtb.hpp b/src/mlpack/methods/emst/dtb.hpp index c4cfdd36a9..40c3459792 100644 --- a/src/mlpack/methods/emst/dtb.hpp +++ b/src/mlpack/methods/emst/dtb.hpp @@ -57,14 +57,16 @@ class DTBStat /** * An initializer for leaves. */ - DTBStat(const arma::mat& dataset, size_t start, size_t count); + template + DTBStat(const MatType& dataset, const size_t start, const size_t count); /** * An initializer for non-leaves. Simply calls the leaf initializer. */ - DTBStat(const arma::mat& dataset, size_t start, size_t count, - const DTBStat& left_stat, const DTBStat& right_stat); - + template + DTBStat(const MatType& dataset, const size_t start, const size_t count, + const DTBStat& leftStat, const DTBStat& rightStat); + }; // class DTBStat /** diff --git a/src/mlpack/methods/emst/dtb_impl.hpp b/src/mlpack/methods/emst/dtb_impl.hpp index c45a727c8d..74e860ccdd 100644 --- a/src/mlpack/methods/emst/dtb_impl.hpp +++ b/src/mlpack/methods/emst/dtb_impl.hpp @@ -48,7 +48,10 @@ DTBStat::DTBStat() /** * An initializer for leaves. */ -DTBStat::DTBStat(const arma::mat& dataset, size_t start, size_t count) +template +DTBStat::DTBStat(const MatType& dataset, + const size_t start, + const size_t count) { if (count == 1) { @@ -65,8 +68,12 @@ DTBStat::DTBStat(const arma::mat& dataset, size_t start, size_t count) /** * An initializer for non-leaves. Simply calls the leaf initializer. */ -DTBStat::DTBStat(const arma::mat& dataset, size_t start, size_t count, - const DTBStat& left_stat, const DTBStat& right_stat) +template +DTBStat::DTBStat(const MatType& dataset, + const size_t start, + const size_t count, + const DTBStat& leftStat, + const DTBStat& right_stat) { if (count == 1) { @@ -80,11 +87,12 @@ DTBStat::DTBStat(const arma::mat& dataset, size_t start, size_t count, } } - DualTreeBoruvka::~DualTreeBoruvka() - { - if (tree_ != NULL) - delete tree_; - } + +DualTreeBoruvka::~DualTreeBoruvka() +{ + if (tree_ != NULL) + delete tree_; +} /** * Adds a single edge to the edge list @@ -555,4 +563,4 @@ void DualTreeBoruvka::ComputeMST(arma::mat& results) -#endif \ No newline at end of file +#endif