12 #ifndef GRT_UTIL_HEADER
13 #define GRT_UTIL_HEADER
16 #include "GRTVersionInfo.h"
27 #ifdef __GRT_WINDOWS_BUILD__
37 #ifdef __GRT_OSX_BUILD__
42 #ifdef __GRT_LINUX_BUILD__
67 static bool sleep(
const unsigned int &numMilliseconds);
80 static double scale(
const double &x,
const double &minSource,
const double &maxSource,
const double &minTarget,
const double &maxTarget,
const bool constrain=
false);
96 static std::string
intToString(
const unsigned int &i);
104 static std::string
toString(
const int &i);
112 static std::string
toString(
const unsigned int &i);
120 static std::string
toString(
const long &i);
128 static std::string
toString(
const unsigned long &i);
136 static std::string
toString(
const unsigned long long &i);
144 static std::string
toString(
const bool &b);
152 static std::string
toString(
const double &v);
160 static std::string
toString(
const long double &v);
168 static std::string
toString(
const float &v);
201 static bool stringEndsWith(
const std::string &str,
const std::string &ending);
214 static double limit(
const double value,
const double minValue,
const double maxValue);
222 static double sum(
const std::vector<double> &x);
231 static double dotProduct(
const std::vector<double> &a,
const std::vector<double> &b);
240 static double euclideanDistance(
const std::vector<double> &a,
const std::vector<double> &b);
250 static double manhattanDistance(
const std::vector<double> &a,
const std::vector<double> &b);
261 static double cosineDistance(
const std::vector<double> &a,
const std::vector<double> &b);
274 static std::vector<double>
scale(
const std::vector<double> &x,
const double minSource,
const double maxSource,
const double minTarget=0,
const double maxTarget=1,
const bool constrain=
false);
282 static std::vector<double>
normalize(
const std::vector<double> &x);
293 static std::vector<double>
limit(
const std::vector<double> &x,
const double minValue,
const double maxValue);
301 static double getMin(
const std::vector< double > &x);
309 static unsigned int getMinIndex(
const std::vector< double > &x);
317 static double getMax(
const std::vector< double > &x);
325 static unsigned int getMaxIndex(
const std::vector< double > &x);
333 static unsigned int getMin(
const std::vector< unsigned int > &x);
341 static unsigned int getMax(
const std::vector< unsigned int > &x);
348 static unsigned int getOS();
359 static void cartToPolar(
const double x,
const double y,
double &r,
double &theta);
370 static void polarToCart(
const double r,
const double theta,
double &x,
double &y);
381 #endif // GRT_UTIL_HEADER
static double cosineDistance(const std::vector< double > &a, const std::vector< double > &b)
static std::string toString(const int &i)
static double dotProduct(const std::vector< double > &a, const std::vector< double > &b)
static double manhattanDistance(const std::vector< double > &a, const std::vector< double > &b)
static unsigned int getMaxIndex(const std::vector< double > &x)
static bool stringToBool(const std::string &s)
static double scale(const double &x, const double &minSource, const double &maxSource, const double &minTarget, const double &maxTarget, const bool constrain=false)
static std::string intToString(const int &i)
static double getMin(const std::vector< double > &x)
static bool sleep(const unsigned int &numMilliseconds)
static double stringToDouble(const std::string &s)
static unsigned int getMinIndex(const std::vector< double > &x)
static double euclideanDistance(const std::vector< double > &a, const std::vector< double > &b)
static void cartToPolar(const double x, const double y, double &r, double &theta)
static int stringToInt(const std::string &s)
static void polarToCart(const double r, const double theta, double &x, double &y)
static bool stringEndsWith(const std::string &str, const std::string &ending)
static double getMax(const std::vector< double > &x)
static double sum(const std::vector< double > &x)
static unsigned int getOS()
static double limit(const double value, const double minValue, const double maxValue)
static std::vector< double > normalize(const std::vector< double > &x)