From 7aa6fd362558718304937ddfd60232c9802d69be Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 3 Sep 2009 02:53:51 -0400 Subject: big reorganization in JacobiSVD: - R-SVD preconditioning now done with meta selectors to avoid compiling useless code - SVD options now honored, with options to hint "at least as many rows as cols" etc... - fix compilation in bad cases (rectangular and fixed-size) - the check for termination is now done on the fly, no more goto (should have done that earlier!) --- test/jacobisvd.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'test/jacobisvd.cpp') diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp index 8b4c7584e..5940b8497 100644 --- a/test/jacobisvd.cpp +++ b/test/jacobisvd.cpp @@ -27,7 +27,7 @@ #include #include -template void svd(const MatrixType& m, bool pickrandom = true) +template void svd(const MatrixType& m = MatrixType(), bool pickrandom = true) { int rows = m.rows(); int cols = m.cols(); @@ -48,7 +48,7 @@ template void svd(const MatrixType& m, bool pickrandom = tr if(pickrandom) a = MatrixType::Random(rows,cols); else a = m; - JacobiSVD svd(a); + JacobiSVD svd(a); MatrixType sigma = MatrixType::Zero(rows,cols); sigma.diagonal() = svd.singularValues().template cast(); MatrixUType u = svd.matrixU(); @@ -80,28 +80,27 @@ void test_jacobisvd() Matrix2cd m; m << 0, 1, 0, 1; - CALL_SUBTEST( svd(m, false) ); + CALL_SUBTEST(( svd(m, false) )); m << 1, 0, 1, 0; - CALL_SUBTEST( svd(m, false) ); + CALL_SUBTEST(( svd(m, false) )); Matrix2d n; n << 1, 1, 1, -1; - CALL_SUBTEST( svd(n, false) ); - CALL_SUBTEST( svd(Matrix3f()) ); - CALL_SUBTEST( svd(Matrix4d()) ); - CALL_SUBTEST( svd(MatrixXf(50,50)) ); - CALL_SUBTEST( svd(MatrixXcd(14,7)) ); - CALL_SUBTEST( svd(MatrixXd(10,50)) ); - - CALL_SUBTEST( svd(MatrixXcf(3,3)) ); - CALL_SUBTEST( svd(MatrixXd(30,30)) ); + CALL_SUBTEST(( svd(n, false) )); + CALL_SUBTEST(( svd() )); + CALL_SUBTEST(( svd() )); + CALL_SUBTEST(( svd , AtLeastAsManyColsAsRows>() )); + CALL_SUBTEST(( svd , AtLeastAsManyRowsAsCols>(Matrix(10,2)) )); + + CALL_SUBTEST(( svd(MatrixXf(50,50)) )); + CALL_SUBTEST(( svd(MatrixXcd(14,7)) )); } - CALL_SUBTEST( svd(MatrixXf(300,200)) ); - CALL_SUBTEST( svd(MatrixXcd(100,150)) ); + CALL_SUBTEST(( svd(MatrixXf(300,200)) )); + CALL_SUBTEST(( svd(MatrixXcd(100,150)) )); - CALL_SUBTEST( svd_verify_assert() ); - CALL_SUBTEST( svd_verify_assert() ); - CALL_SUBTEST( svd_verify_assert() ); - CALL_SUBTEST( svd_verify_assert() ); + CALL_SUBTEST(( svd_verify_assert() )); + CALL_SUBTEST(( svd_verify_assert() )); + CALL_SUBTEST(( svd_verify_assert() )); + CALL_SUBTEST(( svd_verify_assert() )); } -- cgit v1.2.3