From bb1dbb4df62ad90d927f73b9ce46ea5b4fc82fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Wed, 23 Feb 2022 18:32:00 +0000 Subject: [PATCH] Disable deprecated warnings in SVD tests. (cherry picked from commit f0b81fefb7247b3fae48407d7a18614189d5996a) --- test/bdcsvd.cpp | 9 +++++++++ test/jacobisvd.cpp | 7 +++++++ test/svd_common.h | 18 ++++++++++-------- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/test/bdcsvd.cpp b/test/bdcsvd.cpp index 41303775c..d44946880 100644 --- a/test/bdcsvd.cpp +++ b/test/bdcsvd.cpp @@ -10,6 +10,13 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/ +// We explicitly disable deprecated declarations for this set of tests +// because we purposely verify assertions for the deprecated SVD runtime +// option behavior. +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + // discard stack allocation as that too bypasses malloc #define EIGEN_STACK_ALLOCATION_LIMIT 0 #define EIGEN_RUNTIME_NO_MALLOC @@ -49,6 +56,8 @@ void bdcsvd_method() VERIFY_IS_APPROX(m.bdcSvd().singularValues(), RealVecType::Ones()); VERIFY_RAISES_ASSERT(m.bdcSvd().matrixU()); VERIFY_RAISES_ASSERT(m.bdcSvd().matrixV()); + + // Deprecated behavior. VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).solve(m), m); VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m); VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m); diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp index 5b15c5a27..34e97ab3e 100644 --- a/test/jacobisvd.cpp +++ b/test/jacobisvd.cpp @@ -8,6 +8,13 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// We explicitly disable deprecated declarations for this set of tests +// because we purposely verify assertions for the deprecated SVD runtime +// option behavior. +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + // discard stack allocation as that too bypasses malloc #define EIGEN_STACK_ALLOCATION_LIMIT 0 #define EIGEN_RUNTIME_NO_MALLOC diff --git a/test/svd_common.h b/test/svd_common.h index eae4c0bfe..ea3f6b7b0 100644 --- a/test/svd_common.h +++ b/test/svd_common.h @@ -490,14 +490,16 @@ void svd_verify_assert(const MatrixType& m, bool fullOnly = false) svd.singularValues(); VERIFY_RAISES_ASSERT(svd.solve(rhs)) - svd.compute(a, ComputeFullU); - svd.matrixU(); - VERIFY_RAISES_ASSERT(svd.matrixV()) - VERIFY_RAISES_ASSERT(svd.solve(rhs)) - svd.compute(a, ComputeFullV); - svd.matrixV(); - VERIFY_RAISES_ASSERT(svd.matrixU()) - VERIFY_RAISES_ASSERT(svd.solve(rhs)) + // Deprecated behavior. + SvdType svd3(a, ComputeFullU); + svd3.matrixU(); + VERIFY_RAISES_ASSERT(svd3.matrixV()) + VERIFY_RAISES_ASSERT(svd3.solve(rhs)) + + SvdType svd4(a, ComputeFullV); + svd4.matrixV(); + VERIFY_RAISES_ASSERT(svd4.matrixU()) + VERIFY_RAISES_ASSERT(svd4.solve(rhs)) if (!fullOnly && ColsAtCompileTime == Dynamic) {