34 #define DEBUG(msg) std::cout << __FILE__ << " " << __LINE__ << ": " \
46#define ASSERT(expr, msg) m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \
52#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
114bool close_to(arma::vec &a, arma::vec &b,
double tol=1e-8);
127static inline std::string methodName(
const std::string& pretty_function)
129 size_t colons = pretty_function.find(
"::");
130 size_t begin = pretty_function.substr(0,colons).rfind(
" ") + 1;
131 size_t end = pretty_function.rfind(
"(") - begin;
133 return pretty_function.substr(begin,end) +
"()";
147bool mkpath(std::string path,
int mode = 0777);
void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)
Test an expression, confirm that test is ok, or abort execution.
bool mkpath(std::string path, int mode=0777)
Make path given.
bool close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.
std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.