11template <
class DerivedA,
class DerivedB>
12constexpr bool equals(
const Eigen::MatrixBase<DerivedA> &A,
13 const Eigen::MatrixBase<DerivedB> &B,
16 return A.isApprox(B, tolerance);
12constexpr bool equals(
const Eigen::MatrixBase<DerivedA> &A, {
…}
20template <
class Scalar>
26template <
class DerivedA,
class DerivedB>
28 const Eigen::MatrixBase<DerivedB> &B,
31 PRECICE_ASSERT(A.rows() == B.rows(),
"Matrices with different number of rows can't be compared.");
32 PRECICE_ASSERT(A.cols() == B.cols(),
"Matrices with different number of cols can't be compared.");
34 return ((A - B).array() > tolerance).any();
37template <
class DerivedA,
class DerivedB>
39 const Eigen::MatrixBase<DerivedB> &B,
42 PRECICE_ASSERT(A.rows() == B.rows(),
"Matrices with different number of rows can't be compared.");
43 PRECICE_ASSERT(A.cols() == B.cols(),
"Matrices with different number of cols can't be compared.");
45 return ((A - B).array() >= -tolerance).any();
48template <
class DerivedA,
class DerivedB>
50 const Eigen::MatrixBase<DerivedB> &B,
53 PRECICE_ASSERT(A.rows() == B.rows(),
"Matrices with different number of rows can't be compared.");
54 PRECICE_ASSERT(A.cols() == B.cols(),
"Matrices with different number of cols can't be compared.");
56 return ((A - B).array() > tolerance).all();
59template <
class DerivedA,
class DerivedB>
61 const Eigen::MatrixBase<DerivedB> &B,
64 PRECICE_ASSERT(A.rows() == B.rows(),
"Matrices with different number of rows can't be compared.");
65 PRECICE_ASSERT(A.cols() == B.cols(),
"Matrices with different number of cols can't be compared.");
67 return ((A - B).array() >= tolerance).all();
70template <
class Scalar>
73 return A - B > tolerance;
76template <
class Scalar>
79 return A - B >= -tolerance;
82template <
class Scalar>
85 return A - B < -tolerance;
88template <
class Scalar>
91 return A - B <= tolerance;
#define PRECICE_ASSERT(...)
provides general mathematical constants and functions.
constexpr bool equals(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares two Eigen::MatrixBase for equality up to tolerance.
bool oneGreaterEquals(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=math::NUMERICAL_ZERO_DIFFERENCE)
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type smallerEquals(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
constexpr double NUMERICAL_ZERO_DIFFERENCE
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type greaterEquals(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type smaller(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool allGreater(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=math::NUMERICAL_ZERO_DIFFERENCE)
bool allGreaterEquals(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=math::NUMERICAL_ZERO_DIFFERENCE)
bool oneGreater(const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &B, double tolerance=math::NUMERICAL_ZERO_DIFFERENCE)
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type greater(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)