Added a note to the Gram Schmidt code and improved some formatting.

This commit is contained in:
Hauke Heibel 2010-09-25 14:15:35 +02:00
parent 72d4d45133
commit 327ed3d1d3
2 changed files with 8 additions and 5 deletions

View File

@ -458,6 +458,7 @@ SVD<MatrixType>& SVD<MatrixType>::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();
}

View File

@ -101,17 +101,19 @@ template<typename MatrixType> 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<int>(2,50);
int rows = cols + ei_random<int>(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<Matrix3f>() );