Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bin/autodetect/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

int main(int argc, char **argv)
{
typedef ml::autodetect::CCmdLineParser::TStrVec TStrVec;
using TStrVec = ml::autodetect::CCmdLineParser::TStrVec;

// Read command line options
std::string limitConfigFile;
Expand Down Expand Up @@ -216,7 +216,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}

typedef boost::scoped_ptr<ml::core::CDataSearcher> TScopedDataSearcherP;
using TScopedDataSearcherP = boost::scoped_ptr<ml::core::CDataSearcher>;
TScopedDataSearcherP restoreSearcher;
if (ioMgr.restoreStream() != 0)
{
Expand All @@ -236,14 +236,14 @@ int main(int argc, char **argv)
}
}

typedef boost::scoped_ptr<ml::core::CDataAdder> TScopedDataAdderP;
using TScopedDataAdderP = boost::scoped_ptr<ml::core::CDataAdder>;
TScopedDataAdderP persister;
if (ioMgr.persistStream() != 0)
{
persister.reset(new ml::api::CSingleStreamDataAdder(ioMgr.persistStream()));
}

typedef boost::scoped_ptr<ml::api::CBackgroundPersister> TScopedBackgroundPersisterP;
using TScopedBackgroundPersisterP = boost::scoped_ptr<ml::api::CBackgroundPersister>;
TScopedBackgroundPersisterP periodicPersister;
if (persistInterval >= 0)
{
Expand All @@ -258,7 +258,7 @@ int main(int argc, char **argv)
*persister));
}

typedef boost::scoped_ptr<ml::api::CInputParser> TScopedInputParserP;
using TScopedInputParserP = boost::scoped_ptr<ml::api::CInputParser>;
TScopedInputParserP inputParser;
if (lengthEncodedInput)
{
Expand Down
8 changes: 4 additions & 4 deletions bin/categorize/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int main(int argc, char **argv)
}
ml::api::CFieldConfig fieldConfig(categorizationFieldName);

typedef boost::scoped_ptr<ml::core::CDataSearcher> TScopedDataSearcherP;
using TScopedDataSearcherP = boost::scoped_ptr<ml::core::CDataSearcher>;
TScopedDataSearcherP restoreSearcher;
if (ioMgr.restoreStream() != 0)
{
Expand All @@ -170,14 +170,14 @@ int main(int argc, char **argv)
}
}

typedef boost::scoped_ptr<ml::core::CDataAdder> TScopedDataAdderP;
using TScopedDataAdderP = boost::scoped_ptr<ml::core::CDataAdder>;
TScopedDataAdderP persister;
if (ioMgr.persistStream() != 0)
{
persister.reset(new ml::api::CSingleStreamDataAdder(ioMgr.persistStream()));
}

typedef boost::scoped_ptr<ml::api::CBackgroundPersister> TScopedBackgroundPersisterP;
using TScopedBackgroundPersisterP = boost::scoped_ptr<ml::api::CBackgroundPersister>;
TScopedBackgroundPersisterP periodicPersister;
if (persistInterval >= 0)
{
Expand All @@ -192,7 +192,7 @@ int main(int argc, char **argv)
*persister));
}

typedef boost::scoped_ptr<ml::api::CInputParser> TScopedInputParserP;
using TScopedInputParserP = boost::scoped_ptr<ml::api::CInputParser>;
TScopedInputParserP inputParser;
if (lengthEncodedInput)
{
Expand Down
4 changes: 2 additions & 2 deletions bin/normalize/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ int main(int argc, char **argv)
modelConfig.perPartitionNormalization(perPartitionNormalization);

// There's a choice of input and output formats for the numbers to be normalised
typedef boost::scoped_ptr<ml::api::CInputParser> TScopedInputParserP;
using TScopedInputParserP = boost::scoped_ptr<ml::api::CInputParser>;
TScopedInputParserP inputParser;
if (lengthEncodedInput)
{
Expand All @@ -132,7 +132,7 @@ int main(int argc, char **argv)
ml::api::CCsvInputParser::COMMA));
}

typedef boost::scoped_ptr<ml::api::COutputHandler> TScopedOutputHandlerP;
using TScopedOutputHandlerP = boost::scoped_ptr<ml::api::COutputHandler>;
TScopedOutputHandlerP outputWriter;
if (writeCsv)
{
Expand Down
6 changes: 2 additions & 4 deletions include/core/CFloatStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

#include <maths/ImportExport.h>

#include <cmath>
#include <limits>

#include <math.h>


namespace ml
{
namespace core
Expand All @@ -35,7 +33,7 @@ namespace
{
const int MAX_PRECISE_INTEGER_FLOAT(
static_cast<int>(
::pow(10.0,
std::pow(10.0,
static_cast<double>(std::numeric_limits<float>::digits10))
) - 1
);
Expand Down
8 changes: 4 additions & 4 deletions include/core/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <core/CoreTypes.h>

#include <cmath>
#include <limits>
#include <math.h>

namespace ml
{
Expand Down Expand Up @@ -47,13 +47,13 @@ const core_t::TTime WEEK = 604800;
const core_t::TTime YEAR = 31449600;

//! Log of min double.
const double LOG_MIN_DOUBLE = ::log(std::numeric_limits<double>::min());
const double LOG_MIN_DOUBLE = std::log(std::numeric_limits<double>::min());

//! Log of max double.
const double LOG_MAX_DOUBLE = ::log(std::numeric_limits<double>::max());
const double LOG_MAX_DOUBLE = std::log(std::numeric_limits<double>::max());

//! Log of double epsilon.
const double LOG_DOUBLE_EPSILON = ::log(std::numeric_limits<double>::epsilon());
const double LOG_DOUBLE_EPSILON = std::log(std::numeric_limits<double>::epsilon());

//! Log of two.
const double LOG_TWO = 0.693147180559945;
Expand Down
11 changes: 5 additions & 6 deletions include/maths/CCompositeFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/remove_reference.hpp>

#include <cmath>
#include <limits>

#include <math.h>

namespace ml
{
namespace maths
Expand Down Expand Up @@ -225,19 +224,19 @@ class MATHS_EXPORT CCompositeFunctions
inline T operator()(double x) const
{
static const double LOG_MIN_DOUBLE =
::log(std::numeric_limits<double>::min());
std::log(std::numeric_limits<double>::min());
double fx = m_F(x);
return fx < LOG_MIN_DOUBLE ? 0.0 : ::exp(fx);
return fx < LOG_MIN_DOUBLE ? 0.0 : std::exp(fx);
}

//! For function return success/fail and taking result as argument.
inline bool operator()(double x, T &result) const
{
static const double LOG_MIN_DOUBLE =
::log(std::numeric_limits<double>::min());
std::log(std::numeric_limits<double>::min());
if (m_F(x, result))
{
result = result < LOG_MIN_DOUBLE ? 0.0 : ::exp(result);
result = result < LOG_MIN_DOUBLE ? 0.0 : std::exp(result);
return true;
}
return false;
Expand Down
2 changes: 0 additions & 2 deletions include/maths/CEqualWithTolerance.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include <functional>

#include <math.h>

namespace ml
{
namespace maths
Expand Down
1 change: 1 addition & 0 deletions include/maths/CGradientDescent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <maths/CLinearAlgebra.h>
#include <maths/ImportExport.h>

#include <cmath>
#include <cstddef>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion include/maths/CGramSchmidt.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class MATHS_EXPORT CGramSchmidt : private core::CNonInstantiatable
<< ", norm = " << n
<< ", eps = " << eps);

if (::fabs(n) > eps)
if (std::fabs(n) > eps)
{
divide(x[current], n);
++current;
Expand Down
7 changes: 4 additions & 3 deletions include/maths/CInformationCriteria.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <maths/CSphericalCluster.h>
#include <maths/ImportExport.h>

#include <cmath>
#include <cstddef>
#include <limits>
#include <vector>
Expand Down Expand Up @@ -196,7 +197,7 @@ class CSphericalGaussianInfoCriterion
m_Likelihood += ni * log(ni)
- 0.5 * m_D * ni * ( 1.0
+ core::constants::LOG_TWO_PI
+ ::log(upper * vi / m_D));
+ std::log(upper * vi / m_D));
}
else
{
Expand All @@ -215,7 +216,7 @@ class CSphericalGaussianInfoCriterion
return 0.0;
}

double logN = ::log(m_N);
double logN = std::log(m_N);
double p = (m_D * m_K + 2.0 * m_K - 1.0);
switch (TYPE)
{
Expand Down Expand Up @@ -327,7 +328,7 @@ class CGaussianInfoCriterion
return 0.0;
}

double logN = ::log(m_N);
double logN = std::log(m_N);
double p = (m_D * (1.0 + 0.5 * (m_D + 1.0)) * m_K + m_K - 1.0);
switch (TYPE)
{
Expand Down
19 changes: 9 additions & 10 deletions include/maths/CIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@

#include <atomic>
#include <algorithm>
#include <cmath>
#include <functional>
#include <numeric>

#include <math.h>

namespace ml
{
namespace maths
Expand Down Expand Up @@ -223,7 +222,7 @@ class MATHS_EXPORT CIntegration
//! of the integral is returned. This is intended to support integration
//! where the integrand is very small and may underflow double. This is
//! handled by renormalizing the integral so only underflows if values
//! are less than ::exp(-std::numeric_limits<double>::max()), so really
//! are less than std::exp(-std::numeric_limits<double>::max()), so really
//! very small!
//!
//! \param[in] function The log of the function to integrate.
Expand Down Expand Up @@ -270,7 +269,7 @@ class MATHS_EXPORT CIntegration
double fmax = *std::max_element(fx, fx + ORDER);
for (unsigned int i = 0; i < ORDER; ++i)
{
fx[i] = ::exp(fx[i] - fmax);
fx[i] = std::exp(fx[i] - fmax);
}

// Quadrature.
Expand All @@ -279,7 +278,7 @@ class MATHS_EXPORT CIntegration
result += weights[i] * fx[i];
}
result *= range;
result = result <= 0.0 ? core::constants::LOG_MIN_DOUBLE : fmax + ::log(result);
result = result <= 0.0 ? core::constants::LOG_MIN_DOUBLE : fmax + std::log(result);

return true;
}
Expand Down Expand Up @@ -333,15 +332,15 @@ class MATHS_EXPORT CIntegration
corrections.reserve(fIntervals.size());
for (std::size_t i = 0u; i < fIntervals.size(); ++i)
{
corrections.push_back(::fabs(fIntervals[i]));
corrections.push_back(std::fabs(fIntervals[i]));
}

for (std::size_t i = 0u;
!intervals.empty() && i < refinements;
++i)
{
std::size_t n = intervals.size();
double cutoff = tolerance * ::fabs(result) / static_cast<double>(n);
double cutoff = tolerance * std::fabs(result) / static_cast<double>(n);

std::size_t end = 0u;
for (std::size_t j = 0u; j < corrections.size(); ++j)
Expand Down Expand Up @@ -415,13 +414,13 @@ class MATHS_EXPORT CIntegration
double correction = fjNew - fjOld;
if (i + 1 < refinements)
{
corrections[j] = ::fabs(correction);
corrections[j] = std::fabs(correction);
corrections.resize(corrections.size() + splitsPerRefinement - 1,
::fabs(correction));
std::fabs(correction));
}

result += correction;
cutoff = tolerance * ::fabs(result) / static_cast<double>(n);
cutoff = tolerance * std::fabs(result) / static_cast<double>(n);
}
}

Expand Down
7 changes: 4 additions & 3 deletions include/maths/CKMeansOnline.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <maths/CPRNG.h>
#include <maths/CTypeConversions.h>

#include <cmath>
#include <cstddef>
#include <numeric>
#include <utility>
Expand Down Expand Up @@ -385,7 +386,7 @@ class CKMeansOnline
return;
}

double alpha = ::exp(-m_DecayRate * time);
double alpha = std::exp(-m_DecayRate * time);
LOG_TRACE("alpha = " << alpha);

this->age(alpha);
Expand Down Expand Up @@ -471,7 +472,7 @@ class CKMeansOnline
}
else
{
std::size_t ni_ = static_cast<std::size_t>(::ceil(ni));
std::size_t ni_ = static_cast<std::size_t>(std::ceil(ni));
TDoublePoint v(m_Clusters[i].second);
sampleGaussian(ni_, m, v.diagonal(), categorySamples);
}
Expand All @@ -485,7 +486,7 @@ class CKMeansOnline
LOG_TRACE("weights = " << core::CContainerPrinter::print(weights));

TDoublePointVec final;
final.reserve(static_cast<std::size_t>(::ceil(std::accumulate(weights.begin(), weights.end(), 0.0))));
final.reserve(static_cast<std::size_t>(std::ceil(std::accumulate(weights.begin(), weights.end(), 0.0))));
TDoubleMeanAccumulator sample;
for (;;)
{
Expand Down
5 changes: 3 additions & 2 deletions include/maths/CKdTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <maths/CTypeConversions.h>

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <vector>

Expand Down Expand Up @@ -349,7 +350,7 @@ class CKdTree
nextCoordinate,
nearest,
distanceToNearest);
if (secondary && ::fabs(distanceToHyperplane) < distanceToNearest)
if (secondary && std::fabs(distanceToHyperplane) < distanceToNearest)
{
nearest = this->nearestNeighbour(point,
*secondary,
Expand Down Expand Up @@ -386,7 +387,7 @@ class CKdTree

std::size_t nextCoordinate = (coordinate + 1) % m_Dimension;
this->nearestNeighbours(point, *primary, nextCoordinate, nearest);
if (secondary && ::fabs(distanceToHyperplane) < nearest.biggest().first)
if (secondary && std::fabs(distanceToHyperplane) < nearest.biggest().first)
{
this->nearestNeighbours(point, *secondary, nextCoordinate, nearest);
}
Expand Down
2 changes: 1 addition & 1 deletion include/maths/CLinearAlgebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ struct SVector
double result = 0.0;
for (std::size_t i = 0u; i < m_X.size(); ++i)
{
result += ::fabs(static_cast<double>(m_X[i]));
result += std::fabs(static_cast<double>(m_X[i]));
}
return result;
}
Expand Down
Loading