mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 19:59:05 +08:00
Added a note to the Gram Schmidt code and improved some formatting.
This commit is contained in:
parent
72d4d45133
commit
327ed3d1d3
@ -458,6 +458,7 @@ SVD<MatrixType>& SVD<MatrixType>::compute(const MatrixType& matrix)
|
|||||||
typename MatrixUType::ColXpr prevColVec = m_matU.col(prevCol);
|
typename MatrixUType::ColXpr prevColVec = m_matU.col(prevCol);
|
||||||
colVec -= colVec.dot(prevColVec)*prevColVec;
|
colVec -= colVec.dot(prevColVec)*prevColVec;
|
||||||
}
|
}
|
||||||
|
// Here we can run into troubles when colVec.norm() = 0.
|
||||||
m_matU.col(col) = colVec.normalized();
|
m_matU.col(col) = colVec.normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
test/svd.cpp
12
test/svd.cpp
@ -101,17 +101,19 @@ template<typename MatrixType> void svd_verify_assert()
|
|||||||
|
|
||||||
void test_svd()
|
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_1( svd(Matrix3f()) );
|
||||||
CALL_SUBTEST_2( svd(Matrix4d()) );
|
CALL_SUBTEST_2( svd(Matrix4d()) );
|
||||||
|
|
||||||
int cols = ei_random<int>(2,50);
|
int cols = ei_random<int>(2,50);
|
||||||
int rows = cols + ei_random<int>(0,50);
|
int rows = cols + ei_random<int>(0,50);
|
||||||
|
|
||||||
CALL_SUBTEST_3( svd(MatrixXf(rows,cols)) );
|
CALL_SUBTEST_3( svd(MatrixXf(rows,cols)) );
|
||||||
CALL_SUBTEST_4( svd(MatrixXd(rows,cols)) );
|
CALL_SUBTEST_4( svd(MatrixXd(rows,cols)) );
|
||||||
// complex are not implemented yet
|
|
||||||
// CALL_SUBTEST(svd(MatrixXcd(6,6)) );
|
//complex are not implemented yet
|
||||||
// CALL_SUBTEST(svd(MatrixXcf(3,3)) );
|
//CALL_SUBTEST(svd(MatrixXcd(6,6)) );
|
||||||
|
//CALL_SUBTEST(svd(MatrixXcf(3,3)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_SUBTEST_1( svd_verify_assert<Matrix3f>() );
|
CALL_SUBTEST_1( svd_verify_assert<Matrix3f>() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user