From d1d7a1ade9da009f11b8ff47222c6498fdd93aa2 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 23 Jun 2013 19:11:32 +0200 Subject: Workaround a bunch of stupid warnings in unit tests --- test/cholesky.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'test/cholesky.cpp') diff --git a/test/cholesky.cpp b/test/cholesky.cpp index a3b16bfc2..d084ec72c 100644 --- a/test/cholesky.cpp +++ b/test/cholesky.cpp @@ -82,14 +82,14 @@ template void cholesky(const MatrixType& m) symm += a1 * a1.adjoint(); } - SquareMatrixType symmUp = symm.template triangularView(); - SquareMatrixType symmLo = symm.template triangularView(); - // to test if really Cholesky only uses the upper triangular part, uncomment the following // FIXME: currently that fails !! //symm.template part().setZero(); { + SquareMatrixType symmUp = symm.template triangularView(); + SquareMatrixType symmLo = symm.template triangularView(); + LLT chollo(symmLo); VERIFY_IS_APPROX(symm, chollo.reconstructedMatrix()); vecX = chollo.solve(vecB); @@ -113,6 +113,21 @@ template void cholesky(const MatrixType& m) VERIFY_IS_APPROX(MatrixType(chollo.matrixU().transpose().conjugate()), MatrixType(chollo.matrixL())); VERIFY_IS_APPROX(MatrixType(cholup.matrixL().transpose().conjugate()), MatrixType(cholup.matrixU())); VERIFY_IS_APPROX(MatrixType(cholup.matrixU().transpose().conjugate()), MatrixType(cholup.matrixL())); + + // test some special use cases of SelfCwiseBinaryOp: + MatrixType m1 = MatrixType::Random(rows,cols), m2(rows,cols); + m2 = m1; + m2 += symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); + m2 = m1; + m2 -= symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); + m2 = m1; + m2.noalias() += symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); + m2 = m1; + m2.noalias() -= symmLo.template selfadjointView().llt().solve(matB); + VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); } // LDLT @@ -166,21 +181,6 @@ template void cholesky(const MatrixType& m) symm = -symm; } - // test some special use cases of SelfCwiseBinaryOp: - MatrixType m1 = MatrixType::Random(rows,cols), m2(rows,cols); - m2 = m1; - m2 += symmLo.template selfadjointView().llt().solve(matB); - VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); - m2 = m1; - m2 -= symmLo.template selfadjointView().llt().solve(matB); - VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); - m2 = m1; - m2.noalias() += symmLo.template selfadjointView().llt().solve(matB); - VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView().llt().solve(matB)); - m2 = m1; - m2.noalias() -= symmLo.template selfadjointView().llt().solve(matB); - VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView().llt().solve(matB)); - // update/downdate CALL_SUBTEST(( test_chol_update(symm) )); CALL_SUBTEST(( test_chol_update(symm) )); @@ -304,7 +304,8 @@ template void cholesky_verify_assert() void test_cholesky() { - int s; + int s = 0; + s = s; // shuts down ICC's remark #593: variable "s" was set but never used for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( cholesky(Matrix()) ); CALL_SUBTEST_3( cholesky(Matrix2d()) ); -- cgit v1.2.3