assert_equal for a list of matrices
parent
4604cbce05
commit
d894e23a06
|
|
@ -142,6 +142,19 @@ bool assert_equal(const Matrix& expected, const Matrix& actual, double tol) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool assert_equal(const std::list<Matrix>& As, const std::list<Matrix>& Bs, double tol) {
|
||||
if (As.size() != Bs.size()) return false;
|
||||
|
||||
list<Matrix>::const_iterator itA, itB;
|
||||
itA = As.begin(); itB = Bs.begin();
|
||||
for (; itA != As.end(); itA++, itB++)
|
||||
if (!assert_equal(*itB, *itA, tol))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void multiplyAdd(double alpha, const Matrix& A, const Vector& x, Vector& e) {
|
||||
#if defined CBLAS
|
||||
|
|
|
|||
|
|
@ -81,6 +81,11 @@ inline bool operator!=(const Matrix& A, const Matrix& B) {
|
|||
*/
|
||||
bool assert_equal(const Matrix& A, const Matrix& B, double tol = 1e-9);
|
||||
|
||||
/**
|
||||
* equals with an tolerance, prints out message if unequal
|
||||
*/
|
||||
bool assert_equal(const std::list<Matrix>& As, const std::list<Matrix>& Bs, double tol = 1e-9);
|
||||
|
||||
/**
|
||||
* overload * for matrix-vector multiplication (as BOOST does not)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue