Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
3 changes: 1 addition & 2 deletions include/maths/CEqualWithTolerance.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

#include <maths/CLinearAlgebraFwd.h>

#include <cmath>
#include <functional>

#include <math.h>

namespace ml
{
namespace maths
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
6 changes: 3 additions & 3 deletions include/maths/CInformationCriteria.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,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 +215,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 +327,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
6 changes: 3 additions & 3 deletions include/maths/CKMeansOnline.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,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 +471,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 +485,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
4 changes: 2 additions & 2 deletions include/maths/CKdTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,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 +386,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
12 changes: 6 additions & 6 deletions include/maths/CLinearAlgebraTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct SSqrt<VectorTag>
{
for (std::size_t i = 0u; i < d; ++i)
{
result(i) = ::sqrt(result(i));
result(i) = std::sqrt(result(i));
}
}
};
Expand All @@ -70,7 +70,7 @@ struct SSqrt<MatrixTag>
{
for (std::size_t j = 0u; j <= i; ++j)
{
result(i, j) = ::sqrt(result(i, j));
result(i, j) = std::sqrt(result(i, j));
}
}
}
Expand Down Expand Up @@ -264,7 +264,7 @@ struct SFabs<VectorTag>
{
for (std::size_t i = 0u; i < d; ++i)
{
result(i) = ::fabs(result(i));
result(i) = std::fabs(result(i));
}
}
};
Expand All @@ -279,7 +279,7 @@ struct SFabs<MatrixTag>
{
for (std::size_t j = 0u; j <= i; ++j)
{
result(i, j) = ::fabs(result(i, j));
result(i, j) = std::fabs(result(i, j));
}
}
}
Expand Down Expand Up @@ -740,7 +740,7 @@ void scaleCovariances(std::size_t i,
T scale,
CSymmetricMatrixNxN<T, N> &m)
{
scale = ::sqrt(scale);
scale = std::sqrt(scale);
for (std::size_t j = 0u; j < m.columns(); ++j)
{
if (i == j)
Expand Down Expand Up @@ -768,7 +768,7 @@ void scaleCovariances(std::size_t i,
T scale,
CSymmetricMatrix<T> &m)
{
scale = ::sqrt(scale);
scale = std::sqrt(scale);
for (std::size_t j = 0u; j < m.columns(); ++j)
{
if (i == j)
Expand Down
5 changes: 2 additions & 3 deletions include/maths/CMixtureDistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/variant.hpp>

#include <cmath>
#include <exception>
#include <vector>

#include <math.h>

namespace ml
{
namespace maths
Expand Down Expand Up @@ -620,7 +619,7 @@ double quantile(const CMixtureDistribution<T> &distribution, const double q)
LOG_ERROR("Unable to bracket quantile = " << q
<< ", (a,b) = (" << a << "," << b << ")"
<< ", (f(a),f(b)) = (" << fa << "," << fb << ")");
result = ::fabs(fa) < ::fabs(fb) ? a : b;
result = std::fabs(fa) < std::fabs(fb) ? a : b;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion include/maths/CModelWeight.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <boost/numeric/conversion/bounds.hpp>

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


Expand Down
Loading