33 #define DEBUG(msg) std::cout << __FILE__ << " " << __LINE__ << ": " \
45#define ASSERT(expr, msg) m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \
48#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
112static inline std::string methodName(
const std::string& prettyFunction)
114 size_t colons = prettyFunction.find(
"::");
115 size_t begin = prettyFunction.substr(0,colons).rfind(
" ") + 1;
116 size_t end = prettyFunction.rfind(
"(") - begin;
118 return prettyFunction.substr(begin,end) +
"()";
bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8)
Test if two armadillo vectors are close to each other.
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.
std::string scientific_format(double d, int width=20, int prec=10)
Turns a double into a string written in scientific format.