31#define ASSERT(expr, msg) \
32 details::m_assert(expr, #expr, __METHOD_NAME__, __FILE__, __LINE__, msg)
48void m_assert(
bool expr, std::string expr_str, std::string func,
49 std::string file,
int line, std::string msg);
66 class =
typename std::enable_if<std::is_arithmetic<T>::value>::type>
67static bool close_to(arma::Mat<T> &a, arma::Mat<T> &b,
double tol = 1e-8)
69 if (a.n_elem != b.n_elem) {
73 for (
size_t i = 0; i < a.n_elem; i++) {
93 class =
typename std::enable_if<std::is_arithmetic<T>::value>::type>
94static bool close_to(T a, T b,
double tol = 1e-8)
96 return std::fabs(a - b) < tol;
110 class =
typename std::enable_if<std::is_integral<T>::value>::type>
111static bool is_equal(arma::Mat<T> &a, arma::Mat<T> &b)
113 for (
size_t i = 0; i < a.n_elem; i++) {
114 if (!(a(i) == b(i))) {
129 class =
typename std::enable_if<std::is_arithmetic<T>::value>::type>
130static bool assert_each(std::function<
bool(T)> expr, arma::Mat<T> &M)
132 for (
size_t i = 0; i < M.n_elem; i++) {
static bool close_to(arma::Mat< T > &a, arma::Mat< T > &b, double tol=1e-8)
Test if two armadillo matrices/vectors are close to each other.
static bool is_equal(arma::Mat< T > &a, arma::Mat< T > &b)
Test if two armadillo matrices/vectors are equal.
static bool assert_each(std::function< bool(T)> expr, arma::Mat< T > &M)
Test that all elements fulfill the condition.
Function prototypes and macros that are useful.