From 327ed3d1d303007123e727fc0ac53e0603d5628d Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Sat, 25 Sep 2010 14:15:35 +0200 Subject: [PATCH] Added a note to the Gram Schmidt code and improved some formatting. --- Eigen/src/SVD/SVD.h | 1 + test/svd.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Eigen/src/SVD/SVD.h b/Eigen/src/SVD/SVD.h index 9207fbd6f..e8c970d4f 100644 --- a/Eigen/src/SVD/SVD.h +++ b/Eigen/src/SVD/SVD.h @@ -458,6 +458,7 @@ SVD& SVD::compute(const MatrixType& matrix) typename MatrixUType::ColXpr prevColVec = m_matU.col(prevCol); colVec -= colVec.dot(prevColVec)*prevColVec; } + // Here we can run into troubles when colVec.norm() = 0. m_matU.col(col) = colVec.normalized(); } diff --git a/test/svd.cpp b/test/svd.cpp index c151a5486..1452e39bf 100644 --- a/test/svd.cpp +++ b/test/svd.cpp @@ -101,17 +101,19 @@ template void svd_verify_assert() void test_svd() { - for(int i = 0; i < g_repeat; i++) { + for(int i = 0; i < g_repeat; i++) + { CALL_SUBTEST_1( svd(Matrix3f()) ); CALL_SUBTEST_2( svd(Matrix4d()) ); + int cols = ei_random(2,50); int rows = cols + ei_random(0,50); - CALL_SUBTEST_3( svd(MatrixXf(rows,cols)) ); CALL_SUBTEST_4( svd(MatrixXd(rows,cols)) ); - // complex are not implemented yet -// CALL_SUBTEST(svd(MatrixXcd(6,6)) ); -// CALL_SUBTEST(svd(MatrixXcf(3,3)) ); + + //complex are not implemented yet + //CALL_SUBTEST(svd(MatrixXcd(6,6)) ); + //CALL_SUBTEST(svd(MatrixXcf(3,3)) ); } CALL_SUBTEST_1( svd_verify_assert() );