diff --git a/test/bdcsvd.cpp b/test/bdcsvd.cpp index 6eb82f09f..0714a7729 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 @@ -32,9 +39,12 @@ 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); + VERIFY_IS_APPROX(m.template bdcSvd().solve(m), m); VERIFY_IS_APPROX(m.template bdcSvd().transpose().solve(m), m); VERIFY_IS_APPROX(m.template bdcSvd().adjoint().solve(m), m); diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp index e9d0cc835..833aee6a5 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 @@ -29,12 +36,14 @@ void jacobisvd_method() VERIFY_IS_APPROX(m.jacobiSvd().singularValues(), RealVecType::Ones()); VERIFY_RAISES_ASSERT(m.jacobiSvd().matrixU()); VERIFY_RAISES_ASSERT(m.jacobiSvd().matrixV()); - VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).solve(m), m); - VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m); - VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m); VERIFY_IS_APPROX(m.template jacobiSvd().solve(m), m); VERIFY_IS_APPROX(m.template jacobiSvd().transpose().solve(m), m); VERIFY_IS_APPROX(m.template jacobiSvd().adjoint().solve(m), m); + + // Deprecated behavior. + VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).solve(m), m); + VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m); + VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m); } template diff --git a/test/svd_common.h b/test/svd_common.h index c6f653ab8..11e225f82 100644 --- a/test/svd_common.h +++ b/test/svd_common.h @@ -480,8 +480,9 @@ void svd_compute_checks(const MatrixType& m) { } } +// Deprecated behavior. template -void svd_check_constructor_options(const MatrixType& m, unsigned int computationOptions) { +void svd_check_runtime_options(const MatrixType& m, unsigned int computationOptions) { const bool fixedRowAndThinU = SvdType::RowsAtCompileTime != Dynamic && (computationOptions & ComputeThinU) != 0 && m.cols() < m.rows(); const bool fixedColAndThinV = SvdType::ColsAtCompileTime != Dynamic && (computationOptions & ComputeThinV) != 0 && m.rows() < m.cols(); if (fixedRowAndThinU || fixedColAndThinV) { @@ -527,18 +528,19 @@ void svd_option_checks(const MatrixType& m) { svd_check_full(m, fullSvd); svd_compare_to_full(m, fullSvd); + // Deprecated behavior. typedef SVD_STATIC_OPTIONS(MatrixType, QRPreconditioner) DynamicSvd; - svd_check_constructor_options(m, 0); - svd_check_constructor_options(m, ComputeThinU); - svd_check_constructor_options(m, ComputeThinV); - svd_check_constructor_options(m, ComputeThinU | ComputeThinV); + svd_check_runtime_options(m, 0); + svd_check_runtime_options(m, ComputeThinU); + svd_check_runtime_options(m, ComputeThinV); + svd_check_runtime_options(m, ComputeThinU | ComputeThinV); - svd_check_constructor_options(m, ComputeFullU); - svd_check_constructor_options(m, ComputeFullV); - svd_check_constructor_options(m, ComputeFullU | ComputeFullV); + svd_check_runtime_options(m, ComputeFullU); + svd_check_runtime_options(m, ComputeFullV); + svd_check_runtime_options(m, ComputeFullU | ComputeFullV); - svd_check_constructor_options(m, ComputeThinU | ComputeFullV); - svd_check_constructor_options(m, ComputeFullU | ComputeThinV); + svd_check_runtime_options(m, ComputeThinU | ComputeFullV); + svd_check_runtime_options(m, ComputeFullU | ComputeThinV); } template @@ -609,6 +611,7 @@ void svd_verify_constructor_options_assert(const MatrixType& m, bool fullOnly = svd2.singularValues(); VERIFY_RAISES_ASSERT(svd2.solve(rhs)) + // Deprecated behavior. SvdType svd3(a, ComputeFullU); svd3.matrixU(); VERIFY_RAISES_ASSERT(svd3.matrixV())