mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
Fixed some SVD issues.
Make the SVD's output unitary. Improved unit tests. Added an assert to the SVD ctor to check whether rows>=cols.
This commit is contained in:
parent
053261de88
commit
316dadc8e4
@ -87,7 +87,10 @@ template<typename _MatrixType> class SVD
|
||||
m_sigma(std::min(rows, cols)),
|
||||
m_workMatrix(rows, cols),
|
||||
m_rv1(cols),
|
||||
m_isInitialized(false) {}
|
||||
m_isInitialized(false)
|
||||
{
|
||||
ei_assert(rows >= cols && "SVD is only defined if rows>=cols.");
|
||||
}
|
||||
|
||||
SVD(const MatrixType& matrix) : m_matU(matrix.rows(), matrix.rows()),
|
||||
m_matV(matrix.cols(),matrix.cols()),
|
||||
|
@ -95,6 +95,8 @@ template<typename MatrixType> void svd_verify_assert()
|
||||
VERIFY_RAISES_ASSERT(svd.computePositiveUnitary(&tmp,&tmp))
|
||||
VERIFY_RAISES_ASSERT(svd.computeRotationScaling(&tmp,&tmp))
|
||||
VERIFY_RAISES_ASSERT(svd.computeScalingRotation(&tmp,&tmp))
|
||||
|
||||
VERIFY_RAISES_ASSERT(SVD<MatrixXf>(10, 20))
|
||||
}
|
||||
|
||||
void test_svd()
|
||||
@ -116,7 +118,4 @@ void test_svd()
|
||||
CALL_SUBTEST_2( svd_verify_assert<Matrix4d>() );
|
||||
CALL_SUBTEST_3( svd_verify_assert<MatrixXf>() );
|
||||
CALL_SUBTEST_4( svd_verify_assert<MatrixXd>() );
|
||||
|
||||
// Test problem size constructors
|
||||
CALL_SUBTEST_9( SVD<MatrixXf>(10, 20) );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user