14 #ifndef MLPACK_CORE_DATA_HAS_NANINF_HPP
15 #define MLPACK_CORE_DATA_HAS_NANINF_HPP
30 if ((token.length() == 3) || (token.length() == 4))
32 const bool neg = (token[0] ==
'-');
33 const bool pos = (token[0] ==
'+');
35 const size_t offset = ((neg || pos) && (token.length() == 4)) ? 1 : 0;
39 if ((token2 ==
"inf") || (token2 ==
"Inf") || (token2 ==
"INF"))
41 if (std::numeric_limits<T>::has_infinity)
43 val = (!neg) ? std::numeric_limits<T>::infinity() :
44 -std::numeric_limits<T>::infinity();
48 val = (!neg) ? std::numeric_limits<T>::max() :
49 -std::numeric_limits<T>::max();
54 else if ((token2 ==
"nan") || (token2 ==
"Nan") || (token2 ==
"NaN") ||
57 if (std::numeric_limits<T>::has_quiet_NaN)
58 val = std::numeric_limits<T>::quiet_NaN();
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool IsNaNInf(T &val, const std::string &token)
See if the token is a NaN or an Inf, and if so, set the value accordingly and return a boolean repres...
src mlpack core util version hpp VERSION_HPP_CONTENTS string(REGEX REPLACE".*#define MLPACK_VERSION_MAJOR ([0-9]+).*""\\1"MLPACK_VERSION_MAJOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* MLPACK_VERSION_MINOR "$