Minor assorted spacing fixes.

This commit is contained in:
Ryan Curtin
2024-06-21 16:51:39 -04:00
parent 5a5195c5c2
commit f34c15dc6c
9 changed files with 87 additions and 88 deletions
@@ -259,10 +259,10 @@ using MaxRPTree = BinarySpaceTree<DistanceType,
*/
template<typename DistanceType, typename StatisticType, typename MatType>
using RPTree = BinarySpaceTree<DistanceType,
StatisticType,
MatType,
HRectBound,
RPTreeMeanSplit>;
StatisticType,
MatType,
HRectBound,
RPTreeMeanSplit>;
/**
* The Universal B-tree. When recursively splitting nodes, the class
+3 -4
View File
@@ -226,7 +226,7 @@ void CellBound<DistanceType, ElemType>::AddBound(
template<typename DistanceType, typename ElemType>
template<typename MatType>
void CellBound<DistanceType, ElemType>::InitHighBound(size_t numEqualBits,
const MatType& data)
const MatType& data)
{
arma::Col<AddressElemType> tmpHiAddress(hiAddress);
arma::Col<AddressElemType> tmpLoAddress(hiAddress);
@@ -315,7 +315,7 @@ void CellBound<DistanceType, ElemType>::InitHighBound(size_t numEqualBits,
template<typename DistanceType, typename ElemType>
template<typename MatType>
void CellBound<DistanceType, ElemType>::InitLowerBound(size_t numEqualBits,
const MatType& data)
const MatType& data)
{
arma::Col<AddressElemType> tmpHiAddress(loAddress);
arma::Col<AddressElemType> tmpLoAddress(loAddress);
@@ -659,8 +659,7 @@ inline ElemType CellBound<DistanceType, ElemType>::MaxDistance(
*/
template<typename DistanceType, typename ElemType>
inline ElemType CellBound<DistanceType, ElemType>::MaxDistance(
const CellBound& other)
const
const CellBound& other) const
{
ElemType maxSum = std::numeric_limits<ElemType>::lowest();
+1 -1
View File
@@ -514,7 +514,7 @@ HRectBound<DistanceType, ElemType>::RangeDistance(
return RangeType<ElemType>(loSum, hiSum);
else if (DistanceType::Power == 2)
return RangeType<ElemType>((ElemType) std::sqrt(loSum),
(ElemType) std::sqrt(hiSum));
(ElemType) std::sqrt(hiSum));
else
{
return RangeType<ElemType>(
+2 -2
View File
@@ -21,7 +21,7 @@ namespace mlpack {
//! Construct the tree.
template<typename DistanceType, typename StatisticType, typename MatType>
Octree<DistanceType, StatisticType, MatType>::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<DistanceType, StatisticType, MatType>::Octree(
//! Construct the tree.
template<typename DistanceType, typename StatisticType, typename MatType>
Octree<DistanceType, StatisticType, MatType>::Octree(MatType&& dataset,
const size_t maxLeafSize) :
const size_t maxLeafSize) :
begin(0),
count(dataset.n_cols),
bound(dataset.n_rows),
@@ -27,7 +27,7 @@ template<typename DistanceType,
typename DescentType,
template<typename> class AuxiliaryInformationType>
void RectangleTree<DistanceType, StatisticType, MatType, SplitType, DescentType,
AuxiliaryInformationType>::
AuxiliaryInformationType>::
BuildStatistics(RectangleTree* node)
{
// Recurse first.
+17 -17
View File
@@ -128,11 +128,11 @@ using DiscreteHilbertRTreeAuxiliaryInformation =
template<typename DistanceType, typename StatisticType, typename MatType>
using HilbertRTree = RectangleTree<DistanceType,
StatisticType,
MatType,
HilbertRTreeSplit<2>,
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<DistanceType,
*/
template<typename DistanceType, typename StatisticType, typename MatType>
using RPlusTree = RectangleTree<DistanceType,
StatisticType,
MatType,
RPlusTreeSplit<RPlusTreeSplitPolicy,
MinimalCoverageSweep>,
RPlusTreeDescentHeuristic,
NoAuxiliaryInformation>;
StatisticType,
MatType,
RPlusTreeSplit<RPlusTreeSplitPolicy,
MinimalCoverageSweep>,
RPlusTreeDescentHeuristic,
NoAuxiliaryInformation>;
/**
* The R++ tree, a variant of the R+ tree with maximum buonding rectangles.
@@ -188,12 +188,12 @@ using RPlusTree = RectangleTree<DistanceType,
*/
template<typename DistanceType, typename StatisticType, typename MatType>
using RPlusPlusTree = RectangleTree<DistanceType,
StatisticType,
MatType,
RPlusTreeSplit<RPlusPlusTreeSplitPolicy,
MinimalSplitsNumberSweep>,
RPlusPlusTreeDescentHeuristic,
RPlusPlusTreeAuxiliaryInformation>;
StatisticType,
MatType,
RPlusTreeSplit<RPlusPlusTreeSplitPolicy,
MinimalSplitsNumberSweep>,
RPlusPlusTreeDescentHeuristic,
RPlusPlusTreeAuxiliaryInformation>;
} // namespace mlpack
#endif
+39 -39
View File
@@ -38,9 +38,9 @@ Constraints<DistanceType>::Constraints(
template<typename DistanceType>
inline void Constraints<DistanceType>::ReorderResults(
const arma::mat& distances,
arma::Mat<size_t>& neighbors,
const arma::vec& norms)
const arma::mat& distances,
arma::Mat<size_t>& neighbors,
const arma::vec& norms)
{
// Shortcut...
if (neighbors.n_rows == 1)
@@ -79,9 +79,9 @@ inline void Constraints<DistanceType>::ReorderResults(
// Calculates k similar labeled nearest neighbors.
template<typename DistanceType>
void Constraints<DistanceType>::TargetNeighbors(arma::Mat<size_t>& outputMatrix,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
{
// Perform pre-calculation. If neccesary.
Precalculate(labels);
@@ -116,11 +116,11 @@ void Constraints<DistanceType>::TargetNeighbors(arma::Mat<size_t>& outputMatrix,
// batch of data points.
template<typename DistanceType>
void Constraints<DistanceType>::TargetNeighbors(arma::Mat<size_t>& outputMatrix,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms,
const size_t begin,
const size_t batchSize)
const arma::mat& dataset,
const arma::Row<size_t>& 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<DistanceType>::TargetNeighbors(arma::Mat<size_t>& outputMatrix,
// Calculates k differently labeled nearest neighbors.
template<typename DistanceType>
void Constraints<DistanceType>::Impostors(arma::Mat<size_t>& outputMatrix,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
{
// Perform pre-calculation. If neccesary.
Precalculate(labels);
@@ -200,10 +200,10 @@ void Constraints<DistanceType>::Impostors(arma::Mat<size_t>& outputMatrix,
// writes back calculated neighbors & distances to passed matrices.
template<typename DistanceType>
void Constraints<DistanceType>::Impostors(arma::Mat<size_t>& outputNeighbors,
arma::mat& outputDistance,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
arma::mat& outputDistance,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
{
// Perform pre-calculation. If neccesary.
Precalculate(labels);
@@ -239,11 +239,11 @@ void Constraints<DistanceType>::Impostors(arma::Mat<size_t>& outputNeighbors,
// batch of data points.
template<typename DistanceType>
void Constraints<DistanceType>::Impostors(arma::Mat<size_t>& outputMatrix,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms,
const size_t begin,
const size_t batchSize)
const arma::mat& dataset,
const arma::Row<size_t>& 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<DistanceType>::Impostors(arma::Mat<size_t>& outputMatrix,
// batch of data points.
template<typename DistanceType>
void Constraints<DistanceType>::Impostors(arma::Mat<size_t>& outputNeighbors,
arma::mat& outputDistance,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms,
const size_t begin,
const size_t batchSize)
arma::mat& outputDistance,
const arma::mat& dataset,
const arma::Row<size_t>& 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<DistanceType>::Impostors(arma::Mat<size_t>& outputNeighbors,
// data points.
template<typename DistanceType>
void Constraints<DistanceType>::Impostors(arma::Mat<size_t>& outputNeighbors,
arma::mat& outputDistance,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms,
const arma::uvec& points,
const size_t numPoints)
arma::mat& outputDistance,
const arma::mat& dataset,
const arma::Row<size_t>& 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<DistanceType>::Impostors(arma::Mat<size_t>& outputNeighbors,
// TargetNeighbors() and Impostors().
template<typename DistanceType>
void Constraints<DistanceType>::Triplets(arma::Mat<size_t>& outputMatrix,
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
const arma::mat& dataset,
const arma::Row<size_t>& labels,
const arma::vec& norms)
{
// Perform pre-calculation. If neccesary.
Precalculate(labels);
@@ -420,7 +420,7 @@ void Constraints<DistanceType>::Triplets(arma::Mat<size_t>& outputMatrix,
template<typename DistanceType>
inline void Constraints<DistanceType>::Precalculate(
const arma::Row<size_t>& labels)
const arma::Row<size_t>& labels)
{
// Make sure the calculation is necessary.
if (precalculated)
+19 -19
View File
@@ -128,9 +128,9 @@ void LMNNFunction<DistanceType>::Shuffle()
// Update cache transformation matrices.
template<typename DistanceType>
inline void LMNNFunction<DistanceType>::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<DistanceType>::UpdateCache(
// Calculate norm of change in transformation.
template<typename DistanceType>
inline void LMNNFunction<DistanceType>::TransDiff(
std::map<size_t, double>& transformationDiffs,
const arma::mat& transformation,
const size_t begin,
const size_t batchSize)
std::map<size_t, double>& 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<DistanceType>::Evaluate(const arma::mat& transformation)
//! Calculate cost over batches.
template<typename DistanceType>
double LMNNFunction<DistanceType>::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<DistanceType>::Evaluate(const arma::mat& transformation,
template<typename DistanceType>
template<typename GradType>
void LMNNFunction<DistanceType>::Gradient(const arma::mat& transformation,
GradType& gradient)
GradType& gradient)
{
// Apply distance metric over dataset.
transformedDataset = transformation * dataset;
@@ -601,9 +601,9 @@ void LMNNFunction<DistanceType>::Gradient(const arma::mat& transformation,
template<typename DistanceType>
template<typename GradType>
void LMNNFunction<DistanceType>::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<DistanceType>::Gradient(const arma::mat& transformation,
template<typename DistanceType>
template<typename GradType>
double LMNNFunction<DistanceType>::EvaluateWithGradient(
const arma::mat& transformation,
GradType& gradient)
const arma::mat& transformation,
GradType& gradient)
{
double cost = 0;
@@ -880,10 +880,10 @@ double LMNNFunction<DistanceType>::EvaluateWithGradient(
template<typename DistanceType>
template<typename GradType>
double LMNNFunction<DistanceType>::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;
+1 -1
View File
@@ -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