diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-17 09:40:52 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-17 09:40:52 -0400 |
commit | 8356bc8d067d0f291284b256c515b1be0766856c (patch) | |
tree | a8dec076bc6fc541e45d305cf5cc73e270c21def /test | |
parent | cd3a9d1ccba8547378e993538d3347705ad950f1 (diff) |
add jacobiSvd() method, update test & docs
Diffstat (limited to 'test')
-rw-r--r-- | test/jacobisvd.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp index 7d8c36308..212f7f1d7 100644 --- a/test/jacobisvd.cpp +++ b/test/jacobisvd.cpp @@ -197,6 +197,19 @@ template<typename MatrixType> void jacobisvd_verify_assert(const MatrixType& m) } template<typename MatrixType> +void jacobisvd_method() +{ + enum { Size = MatrixType::RowsAtCompileTime }; + typedef typename MatrixType::RealScalar RealScalar; + typedef Matrix<RealScalar, Size, 1> RealVecType; + MatrixType m = MatrixType::Identity(); + 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); +} + +template<typename MatrixType> void jacobisvd_inf_nan() { JacobiSVD<MatrixType> svd; @@ -256,6 +269,10 @@ void test_jacobisvd() CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(ei_random<int>(100, 150), ei_random<int>(100, 150))) )); CALL_SUBTEST_8(( jacobisvd<MatrixXcd>(MatrixXcd(ei_random<int>(80, 100), ei_random<int>(80, 100))) )); + // test matrixbase method + CALL_SUBTEST_1(( jacobisvd_method<Matrix2cd>() )); + CALL_SUBTEST_3(( jacobisvd_method<Matrix3f>() )); + // Test problem size constructors CALL_SUBTEST_7( JacobiSVD<MatrixXf>(10,10) ); } |