13 #ifndef __MLPACK_CORE_MATH_CLAMP_HPP 14 #define __MLPACK_CORE_MATH_CLAMP_HPP 32 return (d + fabs(d)) / 2;
44 return (d - fabs(d)) / 2;
56 const double rangeMin,
57 const double rangeMax)
69 #endif // __MLPACK_CORE_MATH_CLAMP_HPP double ClampNonNegative(const double d)
Forces a number to be non-negative, turning negative numbers into zero.
Linear algebra utility functions, generally performed on matrices or vectors.
double ClampNonPositive(const double d)
Forces a number to be non-positive, turning positive numbers into zero.
double ClampRange(double value, const double rangeMin, const double rangeMax)
Clamp a number between a particular range.