aboutsummaryrefslogtreecommitdiff
path: root/test/jacobisvd.cpp
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2022-02-25 16:32:14 +0800
committerYi Kong <yikong@google.com>2022-02-25 15:08:55 +0000
commit2aab794c004027d008d6b0b64165bf1961d5d2bb (patch)
tree83bb8f19c67bcafdb2ca4a98414af1b17392ec36 /test/jacobisvd.cpp
parentca5aa72016f062fd0712bcb86370478de332bca3 (diff)
downloadeigen-2aab794c004027d008d6b0b64165bf1961d5d2bb.tar.gz
Upgrade eigen to 3.4.0
Steps: * Removed common files between Android copy and the matching upstream copy * Obtained latest upstream tarball (see README.version) * Extracted over the directory Bug: 148287349 Test: presubmit Change-Id: Iee2744719075fdf000b315e973645923da766111
Diffstat (limited to 'test/jacobisvd.cpp')
-rw-r--r--test/jacobisvd.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp
index 7f5f71562..5b15c5a27 100644
--- a/test/jacobisvd.cpp
+++ b/test/jacobisvd.cpp
@@ -36,7 +36,9 @@ void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true)
template<typename MatrixType> void jacobisvd_verify_assert(const MatrixType& m)
{
svd_verify_assert<JacobiSVD<MatrixType> >(m);
- typedef typename MatrixType::Index Index;
+ svd_verify_assert<JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner> >(m, true);
+ svd_verify_assert<JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner> >(m);
+ svd_verify_assert<JacobiSVD<MatrixType, HouseholderQRPreconditioner> >(m);
Index rows = m.rows();
Index cols = m.cols();
@@ -68,9 +70,26 @@ void jacobisvd_method()
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);
}
-void test_jacobisvd()
+namespace Foo {
+// older compiler require a default constructor for Bar
+// cf: https://stackoverflow.com/questions/7411515/
+class Bar {public: Bar() {}};
+bool operator<(const Bar&, const Bar&) { return true; }
+}
+// regression test for a very strange MSVC issue for which simply
+// including SVDBase.h messes up with std::max and custom scalar type
+void msvc_workaround()
+{
+ const Foo::Bar a;
+ const Foo::Bar b;
+ std::max EIGEN_NOT_A_MACRO (a,b);
+}
+
+EIGEN_DECLARE_TEST(jacobisvd)
{
CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) ));
CALL_SUBTEST_4(( jacobisvd_verify_assert(Matrix4d()) ));
@@ -123,4 +142,6 @@ void test_jacobisvd()
CALL_SUBTEST_9( svd_preallocate<void>() );
CALL_SUBTEST_2( svd_underoverflow<void>() );
+
+ msvc_workaround();
}