Commit 72ec3008 authored by Jean-Baptiste Mouret's avatar Jean-Baptiste Mouret
Browse files

move to the right file

parent 613dec4c
......@@ -48,7 +48,17 @@
namespace limbo {
namespace tools {
// get sign of number
/// @ingroup tools
/// make a 1-D vector from a double (useful when we need to return vectors)
Eigen::VectorXd make_vector(double x)
{
Eigen::VectorXd res(1);
res(0) = x;
return res;
}
template <typename T>
inline constexpr int signum(T x, std::false_type is_signed)
{
......@@ -61,19 +71,27 @@ namespace limbo {
return (T(0) < x) - (x < T(0));
}
/// @ingroup tools
/// return -1 if x < 0;
/// return 0 if x = 0;
/// return 1 if x > 0.
template <typename T>
inline constexpr int signum(T x)
{
return signum(x, std::is_signed<T>());
}
// inf or NAN checks
/// @ingroup tools
/// return true if v is nan (not a number) or infinity
template <typename T, typename std::enable_if<std::is_arithmetic<T>::value, int>::type = 0>
inline bool is_nan_or_inf(T v)
{
return std::isinf(v) || std::isnan(v);
}
/// @ingroup tools
/// return true if v is nan (not a number) or infinity
/// (const version)
template <typename T, typename std::enable_if<!std::is_arithmetic<T>::value, int>::type = 0>
inline bool is_nan_or_inf(const T& v)
{
......
......@@ -53,16 +53,6 @@ namespace limbo {
return ((Eigen::VectorXd::Random(size)).array() + 1.0) / 2.0;
}
/// @ingroup tools
/// make a 1-D vector from a double (useful when we need to return vectors)
Eigen::VectorXd make_vector(double x)
{
Eigen::VectorXd res(1);
res(0) = x;
return res;
}
/// @ingroup tools
/// a mt19937-based random generator (mutex-protected)
///
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment