diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2019-05-10 14:57:05 +0200 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2019-05-10 14:57:05 +0200 |
commit | 4ccd1ece92c58e0ee3a15a6a6f0af2b00b7829ab (patch) | |
tree | b53c322db903ee288944e3a0c247684f144c7c6d | |
parent | d3ef7cf03ed080fb5b35045b73812bb34c6119a3 (diff) |
bug #1707: Fix deprecation warnings, or disable warnings when testing deprecated functions
-rw-r--r-- | Eigen/src/Core/Transpose.h | 4 | ||||
-rw-r--r-- | Eigen/src/Geometry/Transform.h | 8 | ||||
-rw-r--r-- | test/triangular.cpp | 36 | ||||
-rw-r--r-- | unsupported/test/EulerAngles.cpp | 6 |
4 files changed, 42 insertions, 12 deletions
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index c513f7f7c..1979b0e99 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -237,7 +237,7 @@ struct inplace_transpose_selector; template<typename MatrixType> struct inplace_transpose_selector<MatrixType,true,false> { // square matrix static void run(MatrixType& m) { - m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose()); + m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose().template triangularView<StrictlyUpper>()); } }; @@ -262,7 +262,7 @@ template<typename MatrixType,bool MatchPacketSize> struct inplace_transpose_selector<MatrixType,false,MatchPacketSize> { // non square matrix static void run(MatrixType& m) { if (m.rows()==m.cols()) - m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose()); + m.matrix().template triangularView<StrictlyUpper>().swap(m.matrix().transpose().template triangularView<StrictlyUpper>()); else m = m.transpose().eval(); } diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index 3090351a0..c87b5fedf 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -1111,12 +1111,12 @@ EIGEN_DEVICE_FUNC void Transform<Scalar,Dim,Mode,Options>::computeRotationScalin Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1 VectorType sv(svd.singularValues()); sv.coeffRef(0) *= x; - if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint()); + if(scaling) *scaling = svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint(); if(rotation) { LinearMatrixType m(svd.matrixU()); m.col(0) /= x; - rotation->lazyAssign(m * svd.matrixV().adjoint()); + *rotation = m * svd.matrixV().adjoint(); } } @@ -1140,12 +1140,12 @@ EIGEN_DEVICE_FUNC void Transform<Scalar,Dim,Mode,Options>::computeScalingRotatio Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1 VectorType sv(svd.singularValues()); sv.coeffRef(0) *= x; - if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint()); + if(scaling) *scaling = svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint(); if(rotation) { LinearMatrixType m(svd.matrixU()); m.col(0) /= x; - rotation->lazyAssign(m * svd.matrixV().adjoint()); + *rotation = m * svd.matrixV().adjoint(); } } diff --git a/test/triangular.cpp b/test/triangular.cpp index 0fca5e3b9..981a0d071 100644 --- a/test/triangular.cpp +++ b/test/triangular.cpp @@ -7,9 +7,35 @@ // 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/. +#ifdef EIGEN_TEST_PART_100 +# define EIGEN_NO_DEPRECATED_WARNING +#endif + #include "main.h" +template<typename MatrixType> void triangular_deprecated(const MatrixType &m) +{ + Index rows = m.rows(); + Index cols = m.cols(); + MatrixType m1, m2, m3, m4; + m1.setRandom(rows,cols); + m2.setRandom(rows,cols); + m3 = m1; m4 = m2; + // deprecated method: + m1.template triangularView<Eigen::Upper>().swap(m2); + // use this method instead: + m3.template triangularView<Eigen::Upper>().swap(m4.template triangularView<Eigen::Upper>()); + VERIFY_IS_APPROX(m1,m3); + VERIFY_IS_APPROX(m2,m4); + // deprecated method: + m1.template triangularView<Eigen::Lower>().swap(m4); + // use this method instead: + m3.template triangularView<Eigen::Lower>().swap(m2.template triangularView<Eigen::Lower>()); + VERIFY_IS_APPROX(m1,m3); + VERIFY_IS_APPROX(m2,m4); +} + template<typename MatrixType> void triangular_square(const MatrixType& m) { @@ -109,11 +135,12 @@ template<typename MatrixType> void triangular_square(const MatrixType& m) // test swap m1.setOnes(); m2.setZero(); - m2.template triangularView<Upper>().swap(m1); + m2.template triangularView<Upper>().swap(m1.template triangularView<Eigen::Upper>()); m3.setZero(); m3.template triangularView<Upper>().setOnes(); VERIFY_IS_APPROX(m2,m3); - + VERIFY_RAISES_STATIC_ASSERT(m1.template triangularView<Eigen::Lower>().swap(m2.template triangularView<Eigen::Upper>())); + m1.setRandom(); m3 = m1.template triangularView<Upper>(); Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic> m5(cols, internal::random<int>(1,20)); m5.setRandom(); @@ -224,7 +251,7 @@ template<typename MatrixType> void triangular_rect(const MatrixType& m) // test swap m1.setOnes(); m2.setZero(); - m2.template triangularView<Upper>().swap(m1); + m2.template triangularView<Upper>().swap(m1.template triangularView<Eigen::Upper>()); m3.setZero(); m3.template triangularView<Upper>().setOnes(); VERIFY_IS_APPROX(m2,m3); @@ -256,6 +283,9 @@ EIGEN_DECLARE_TEST(triangular) CALL_SUBTEST_9( triangular_rect(MatrixXcf(r, c)) ); CALL_SUBTEST_5( triangular_rect(MatrixXcd(r, c)) ); CALL_SUBTEST_6( triangular_rect(Matrix<float,Dynamic,Dynamic,RowMajor>(r, c)) ); + + CALL_SUBTEST_100( triangular_deprecated(Matrix<float, 5, 7>()) ); + CALL_SUBTEST_100( triangular_deprecated(MatrixXd(r,c)) ); } CALL_SUBTEST_1( bug_159() ); diff --git a/unsupported/test/EulerAngles.cpp b/unsupported/test/EulerAngles.cpp index 4ddb5a2e8..0955795b6 100644 --- a/unsupported/test/EulerAngles.cpp +++ b/unsupported/test/EulerAngles.cpp @@ -214,9 +214,9 @@ template<typename Scalar> void eulerangles_manual() check_singular_cases(-PI); // non-singular cases - VectorX alpha = VectorX::LinSpaced(Eigen::Sequential, 20, Scalar(-0.99) * PI, PI); - VectorX beta = VectorX::LinSpaced(Eigen::Sequential, 20, Scalar(-0.49) * PI, Scalar(0.49) * PI); - VectorX gamma = VectorX::LinSpaced(Eigen::Sequential, 20, Scalar(-0.99) * PI, PI); + VectorX alpha = VectorX::LinSpaced(20, Scalar(-0.99) * PI, PI); + VectorX beta = VectorX::LinSpaced(20, Scalar(-0.49) * PI, Scalar(0.49) * PI); + VectorX gamma = VectorX::LinSpaced(20, Scalar(-0.99) * PI, PI); for (int i = 0; i < alpha.size(); ++i) { for (int j = 0; j < beta.size(); ++j) { for (int k = 0; k < gamma.size(); ++k) { |