31#define ASSERT(expr, msg) \
32 details::m_assert(expr, #expr, __METHOD_NAME__, __FILE__, __LINE__, msg)
47void m_assert(
bool expr, std::string expr_str, std::string func,
48 std::string file,
int line, std::string msg);
64 class =
typename std::enable_if<std::is_arithmetic<T>::value>::type>
65static bool close_to(arma::Mat<T> &a, arma::Mat<T> &b,
double tol = 1e-8)
67 if (a.n_elem != b.n_elem) {
71 for (
size_t i = 0; i < a.n_elem; i++) {
72 if (!close_to(a(i), b(i))) {
91 class =
typename std::enable_if<std::is_arithmetic<T>::value>::type>
92static bool close_to(T a, T b,
double tol = 1e-8)
94 return std::fabs(a - b) < tol;
108 class =
typename std::enable_if<std::is_integral<T>::value>::type>
109static bool is_equal(arma::Mat<T> &a, arma::Mat<T> &b)
111 for (
size_t i = 0; i < a.n_elem; i++) {
112 if (!(a(i) == b(i))) {
127 class =
typename std::enable_if<std::is_arithmetic<T>::value>::type>
128static bool assert_each(std::function<
bool(T)> expr, arma::Mat<T> &M)
130 for (
size_t i = 0; i < M.n_elem; i++) {
Function prototypes and macros that are useful.