mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-03 06:50:57 +08:00
Fix two numerical issues in unit tests.
This commit is contained in:
parent
61a2995d03
commit
455e6e38b6
@ -42,10 +42,10 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m)
|
||||
VERIFY_IS_APPROX(m3, (m1.array() - s1).matrix());
|
||||
|
||||
// reductions
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum().sum() - m1.sum(), m1.cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum().sum() - m1.sum(), m1.cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum() + m2.colwise().sum() - (m1+m2).colwise().sum(), (m1+m2).cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum() - m2.rowwise().sum() - (m1-m2).rowwise().sum(), (m1-m2).cwiseAbs().maxCoeff());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum().sum() - m1.sum(), m1.norm());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum().sum() - m1.sum(), m1.norm());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.colwise().sum() + m2.colwise().sum() - (m1+m2).colwise().sum(), (m1+m2).norm());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(m1.rowwise().sum() - m2.rowwise().sum() - (m1-m2).rowwise().sum(), (m1-m2).norm());
|
||||
VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op<Scalar>()));
|
||||
|
||||
// vector-wise ops
|
||||
|
@ -42,7 +42,7 @@ template<typename MatrixType> void ref_matrix(const MatrixType& m)
|
||||
typedef Ref<const DynMatrixType> ConstRefDynMat;
|
||||
typedef Ref<RealDynMatrixType , 0, Stride<Dynamic,Dynamic> > RefRealMatWithStride;
|
||||
|
||||
Index rows = m.rows(), cols = m.cols(), size = rows*cols;
|
||||
Index rows = m.rows(), cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = m1;
|
||||
@ -136,7 +136,7 @@ template<typename VectorType> void ref_vector(const VectorType& m)
|
||||
VERIFY_IS_EQUAL(mat1, mat2);
|
||||
rm5.noalias() = rm4.transpose() * mat3;
|
||||
mat2.row(i) = v2.real().transpose() * mat3;
|
||||
VERIFY_IS_EQUAL(mat1, mat2);
|
||||
VERIFY_IS_APPROX(mat1, mat2);
|
||||
}
|
||||
|
||||
template<typename PlainObjectType> void check_const_correctness(const PlainObjectType&)
|
||||
|
Loading…
Reference in New Issue
Block a user