2 Dimensional Ising Model
Simulate the change in energy and magnetization in a ferro magnet
Loading...
Searching...
No Matches
testlib Namespace Reference

Functions

template<class T , class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
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.
 
template<class T , class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
static bool close_to (T a, T b, double tol=1e-8)
 Test if two numbers are close to each other.
 
template<class T , class = typename std::enable_if<std::is_integral<T>::value>::type>
static bool is_equal (arma::Mat< T > &a, arma::Mat< T > &b)
 Test if two armadillo matrices/vectors are equal.
 
template<class T , class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
static bool assert_each (std::function< bool(T)> expr, arma::Mat< T > &M)
 Test that all elements fulfill the condition.
 

Function Documentation

◆ assert_each()

template<class T , class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
static bool testlib::assert_each ( std::function< bool(T)>  expr,
arma::Mat< T > &  M 
)
static

Test that all elements fulfill the condition.

Parameters
exprThe boolean expression to apply to each element
MThe matrix/vector to iterate over
Returns
bool

Definition at line 130 of file testlib.hpp.

◆ close_to() [1/2]

template<class T , class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
static bool testlib::close_to ( arma::Mat< T > &  a,
arma::Mat< T > &  b,
double  tol = 1e-8 
)
static

Test if two armadillo matrices/vectors are close to each other.

This function takes in 2 matrices/vectors and checks if they are approximately equal to each other given a tolerance.

Parameters
aMatrix/vector a
bMatrix/vector b
tolThe tolerance
Returns
bool

Definition at line 67 of file testlib.hpp.

◆ close_to() [2/2]

template<class T , class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
static bool testlib::close_to ( a,
b,
double  tol = 1e-8 
)
static

Test if two numbers are close to each other.

This function takes in 2 matrices/vectors and checks if they are approximately equal to each other given a tolerance.

Parameters
aMatrix/vector a
bMatrix/vector b
tolThe tolerance
Returns
bool

Definition at line 94 of file testlib.hpp.

◆ is_equal()

template<class T , class = typename std::enable_if<std::is_integral<T>::value>::type>
static bool testlib::is_equal ( arma::Mat< T > &  a,
arma::Mat< T > &  b 
)
static

Test if two armadillo matrices/vectors are equal.

This function takes in 2 matrices/vectors and checks if they are equal to each other. This should only be used for integral types.

Parameters
aMatrix/vector a
bMatrix/vector b
Returns
bool

Definition at line 111 of file testlib.hpp.