BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::Util Namespace Reference

Description

namespace defining Utility functions needed by mathcore

Functions

template<class T >
EvalLog (T x)
 safe evaluation of log(x) with a protections against negative or zero argument to the log smooth linear extrapolation below function values smaller than epsilon (better than a simple cut-off) More...
 
template<class T >
std::string ToString (const T &val)
 

Function Documentation

◆ EvalLog()

template<class T >
T ROOT::Math::Util::EvalLog ( x)
inline

safe evaluation of log(x) with a protections against negative or zero argument to the log smooth linear extrapolation below function values smaller than epsilon (better than a simple cut-off)

Definition at line 56 of file Util.h.

56  {
57  static const T epsilon = T(2.0 * std::numeric_limits<double>::min());
58 #if !defined(R__HAS_VECCORE)
59  T logval = x <= epsilon ? x / epsilon + std::log(epsilon) - T(1.0) : std::log(x);
60 #else
61  T logval = vecCore::Blend<T>(x <= epsilon, x / epsilon + std::log(epsilon) - T(1.0), std::log(x));
62 #endif
63  return logval;
64  }

Referenced by ROOT::Minuit2::FumiliMaximumLikelihoodFCN::operator()().

◆ ToString()

template<class T >
std::string ROOT::Math::Util::ToString ( const T &  val)

Utility function for conversion to strings

Definition at line 42 of file Util.h.

43  {
44  std::ostringstream buf;
45  buf << val;
46 
47  std::string ret = buf.str();
48  return ret;
49  }

Referenced by ROOT::Math::IBaseParam::ParameterName().