diff --git a/src/mlpack/core/tree/binary_space_tree/typedef.hpp b/src/mlpack/core/tree/binary_space_tree/typedef.hpp index 2a4638ddf9..9b18c7d5d7 100644 --- a/src/mlpack/core/tree/binary_space_tree/typedef.hpp +++ b/src/mlpack/core/tree/binary_space_tree/typedef.hpp @@ -259,10 +259,10 @@ using MaxRPTree = BinarySpaceTree using RPTree = BinarySpaceTree; + StatisticType, + MatType, + HRectBound, + RPTreeMeanSplit>; /** * The Universal B-tree. When recursively splitting nodes, the class diff --git a/src/mlpack/core/tree/cellbound_impl.hpp b/src/mlpack/core/tree/cellbound_impl.hpp index 24d289a72d..7dda69e582 100644 --- a/src/mlpack/core/tree/cellbound_impl.hpp +++ b/src/mlpack/core/tree/cellbound_impl.hpp @@ -226,7 +226,7 @@ void CellBound::AddBound( template template void CellBound::InitHighBound(size_t numEqualBits, - const MatType& data) + const MatType& data) { arma::Col tmpHiAddress(hiAddress); arma::Col tmpLoAddress(hiAddress); @@ -315,7 +315,7 @@ void CellBound::InitHighBound(size_t numEqualBits, template template void CellBound::InitLowerBound(size_t numEqualBits, - const MatType& data) + const MatType& data) { arma::Col tmpHiAddress(loAddress); arma::Col tmpLoAddress(loAddress); @@ -659,8 +659,7 @@ inline ElemType CellBound::MaxDistance( */ template inline ElemType CellBound::MaxDistance( - const CellBound& other) - const + const CellBound& other) const { ElemType maxSum = std::numeric_limits::lowest(); diff --git a/src/mlpack/core/tree/hrectbound_impl.hpp b/src/mlpack/core/tree/hrectbound_impl.hpp index d7c6187009..0470da7210 100644 --- a/src/mlpack/core/tree/hrectbound_impl.hpp +++ b/src/mlpack/core/tree/hrectbound_impl.hpp @@ -514,7 +514,7 @@ HRectBound::RangeDistance( return RangeType(loSum, hiSum); else if (DistanceType::Power == 2) return RangeType((ElemType) std::sqrt(loSum), - (ElemType) std::sqrt(hiSum)); + (ElemType) std::sqrt(hiSum)); else { return RangeType( diff --git a/src/mlpack/core/tree/octree/octree_impl.hpp b/src/mlpack/core/tree/octree/octree_impl.hpp index 9571df8684..2ae6403f5a 100644 --- a/src/mlpack/core/tree/octree/octree_impl.hpp +++ b/src/mlpack/core/tree/octree/octree_impl.hpp @@ -21,7 +21,7 @@ namespace mlpack { //! Construct the tree. template Octree::Octree(const MatType& dataset, - const size_t maxLeafSize) : + const size_t maxLeafSize) : begin(0), count(dataset.n_cols), bound(dataset.n_rows), @@ -147,7 +147,7 @@ Octree::Octree( //! Construct the tree. template Octree::Octree(MatType&& dataset, - const size_t maxLeafSize) : + const size_t maxLeafSize) : begin(0), count(dataset.n_cols), bound(dataset.n_rows), diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp index 9d0253195d..a8e699cb0b 100644 --- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp +++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp @@ -27,7 +27,7 @@ template class AuxiliaryInformationType> void RectangleTree:: + AuxiliaryInformationType>:: BuildStatistics(RectangleTree* node) { // Recurse first. diff --git a/src/mlpack/core/tree/rectangle_tree/typedef.hpp b/src/mlpack/core/tree/rectangle_tree/typedef.hpp index de2fe02431..a9e770b12e 100644 --- a/src/mlpack/core/tree/rectangle_tree/typedef.hpp +++ b/src/mlpack/core/tree/rectangle_tree/typedef.hpp @@ -128,11 +128,11 @@ using DiscreteHilbertRTreeAuxiliaryInformation = template using HilbertRTree = RectangleTree, - HilbertRTreeDescentHeuristic, - DiscreteHilbertRTreeAuxiliaryInformation>; + StatisticType, + MatType, + HilbertRTreeSplit<2>, + HilbertRTreeDescentHeuristic, + DiscreteHilbertRTreeAuxiliaryInformation>; /** * The R+ tree, a variant of the R tree that avoids overlapping rectangles. @@ -159,12 +159,12 @@ using HilbertRTree = RectangleTree using RPlusTree = RectangleTree, - RPlusTreeDescentHeuristic, - NoAuxiliaryInformation>; + StatisticType, + MatType, + RPlusTreeSplit, + RPlusTreeDescentHeuristic, + NoAuxiliaryInformation>; /** * The R++ tree, a variant of the R+ tree with maximum buonding rectangles. @@ -188,12 +188,12 @@ using RPlusTree = RectangleTree using RPlusPlusTree = RectangleTree, - RPlusPlusTreeDescentHeuristic, - RPlusPlusTreeAuxiliaryInformation>; + StatisticType, + MatType, + RPlusTreeSplit, + RPlusPlusTreeDescentHeuristic, + RPlusPlusTreeAuxiliaryInformation>; } // namespace mlpack #endif diff --git a/src/mlpack/methods/lmnn/constraints_impl.hpp b/src/mlpack/methods/lmnn/constraints_impl.hpp index 6aaa36219b..6f227fd970 100644 --- a/src/mlpack/methods/lmnn/constraints_impl.hpp +++ b/src/mlpack/methods/lmnn/constraints_impl.hpp @@ -38,9 +38,9 @@ Constraints::Constraints( template inline void Constraints::ReorderResults( - const arma::mat& distances, - arma::Mat& neighbors, - const arma::vec& norms) + const arma::mat& distances, + arma::Mat& neighbors, + const arma::vec& norms) { // Shortcut... if (neighbors.n_rows == 1) @@ -79,9 +79,9 @@ inline void Constraints::ReorderResults( // Calculates k similar labeled nearest neighbors. template void Constraints::TargetNeighbors(arma::Mat& outputMatrix, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms) + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -116,11 +116,11 @@ void Constraints::TargetNeighbors(arma::Mat& outputMatrix, // batch of data points. template void Constraints::TargetNeighbors(arma::Mat& outputMatrix, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms, - const size_t begin, - const size_t batchSize) + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms, + const size_t begin, + const size_t batchSize) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -163,9 +163,9 @@ void Constraints::TargetNeighbors(arma::Mat& outputMatrix, // Calculates k differently labeled nearest neighbors. template void Constraints::Impostors(arma::Mat& outputMatrix, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms) + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -200,10 +200,10 @@ void Constraints::Impostors(arma::Mat& outputMatrix, // writes back calculated neighbors & distances to passed matrices. template void Constraints::Impostors(arma::Mat& outputNeighbors, - arma::mat& outputDistance, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms) + arma::mat& outputDistance, + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -239,11 +239,11 @@ void Constraints::Impostors(arma::Mat& outputNeighbors, // batch of data points. template void Constraints::Impostors(arma::Mat& outputMatrix, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms, - const size_t begin, - const size_t batchSize) + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms, + const size_t begin, + const size_t batchSize) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -287,12 +287,12 @@ void Constraints::Impostors(arma::Mat& outputMatrix, // batch of data points. template void Constraints::Impostors(arma::Mat& outputNeighbors, - arma::mat& outputDistance, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms, - const size_t begin, - const size_t batchSize) + arma::mat& outputDistance, + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms, + const size_t begin, + const size_t batchSize) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -337,12 +337,12 @@ void Constraints::Impostors(arma::Mat& outputNeighbors, // data points. template void Constraints::Impostors(arma::Mat& outputNeighbors, - arma::mat& outputDistance, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms, - const arma::uvec& points, - const size_t numPoints) + arma::mat& outputDistance, + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms, + const arma::uvec& points, + const size_t numPoints) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -386,9 +386,9 @@ void Constraints::Impostors(arma::Mat& outputNeighbors, // TargetNeighbors() and Impostors(). template void Constraints::Triplets(arma::Mat& outputMatrix, - const arma::mat& dataset, - const arma::Row& labels, - const arma::vec& norms) + const arma::mat& dataset, + const arma::Row& labels, + const arma::vec& norms) { // Perform pre-calculation. If neccesary. Precalculate(labels); @@ -420,7 +420,7 @@ void Constraints::Triplets(arma::Mat& outputMatrix, template inline void Constraints::Precalculate( - const arma::Row& labels) + const arma::Row& labels) { // Make sure the calculation is necessary. if (precalculated) diff --git a/src/mlpack/methods/lmnn/lmnn_function_impl.hpp b/src/mlpack/methods/lmnn/lmnn_function_impl.hpp index 1c28e43527..01aa77afea 100644 --- a/src/mlpack/methods/lmnn/lmnn_function_impl.hpp +++ b/src/mlpack/methods/lmnn/lmnn_function_impl.hpp @@ -128,9 +128,9 @@ void LMNNFunction::Shuffle() // Update cache transformation matrices. template inline void LMNNFunction::UpdateCache( - const arma::mat& transformation, - const size_t begin, - const size_t batchSize) + const arma::mat& transformation, + const size_t begin, + const size_t batchSize) { // Are there any empty transformation matrices? size_t index = oldTransformationMatrices.size(); @@ -185,10 +185,10 @@ inline void LMNNFunction::UpdateCache( // Calculate norm of change in transformation. template inline void LMNNFunction::TransDiff( - std::map& transformationDiffs, - const arma::mat& transformation, - const size_t begin, - const size_t batchSize) + std::map& transformationDiffs, + const arma::mat& transformation, + const size_t begin, + const size_t batchSize) { for (size_t i = begin; i < begin + batchSize; ++i) { @@ -340,8 +340,8 @@ double LMNNFunction::Evaluate(const arma::mat& transformation) //! Calculate cost over batches. template double LMNNFunction::Evaluate(const arma::mat& transformation, - const size_t begin, - const size_t batchSize) + const size_t begin, + const size_t batchSize) { double cost = 0; @@ -470,7 +470,7 @@ double LMNNFunction::Evaluate(const arma::mat& transformation, template template void LMNNFunction::Gradient(const arma::mat& transformation, - GradType& gradient) + GradType& gradient) { // Apply distance metric over dataset. transformedDataset = transformation * dataset; @@ -601,9 +601,9 @@ void LMNNFunction::Gradient(const arma::mat& transformation, template template void LMNNFunction::Gradient(const arma::mat& transformation, - const size_t begin, - GradType& gradient, - const size_t batchSize) + const size_t begin, + GradType& gradient, + const size_t batchSize) { // Apply distance metric over dataset. transformedDataset = transformation * dataset; @@ -739,8 +739,8 @@ void LMNNFunction::Gradient(const arma::mat& transformation, template template double LMNNFunction::EvaluateWithGradient( - const arma::mat& transformation, - GradType& gradient) + const arma::mat& transformation, + GradType& gradient) { double cost = 0; @@ -880,10 +880,10 @@ double LMNNFunction::EvaluateWithGradient( template template double LMNNFunction::EvaluateWithGradient( - const arma::mat& transformation, - const size_t begin, - GradType& gradient, - const size_t batchSize) + const arma::mat& transformation, + const size_t begin, + GradType& gradient, + const size_t batchSize) { double cost = 0; diff --git a/src/mlpack/tests/facilities_test.cpp b/src/mlpack/tests/facilities_test.cpp index 36e0a64155..312391f36a 100644 --- a/src/mlpack/tests/facilities_test.cpp +++ b/src/mlpack/tests/facilities_test.cpp @@ -2,7 +2,7 @@ * @file facilities_test.cpp * @author Khizir Siddiqui * - * Test file for facilities in distance metrics. + * Test file for facilities in metrics. * * mlpack is free software; you may redistribute it and/or modify it under the * terms of the 3-clause BSD license. You should have received a copy of the