Fixes #1387 for compilation error in JacobiSVD with HouseholderQRPreconditioner that occurs when input is a compile-time row vector.

This commit is contained in:
arthurfeeney
2021-07-17 10:39:38 -05:00
committed by Arthur
parent 297f0f563d
commit a77638387d
3 changed files with 27 additions and 15 deletions

View File

@@ -36,6 +36,9 @@ void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true)
template<typename MatrixType> void jacobisvd_verify_assert(const MatrixType& m)
{
svd_verify_assert<JacobiSVD<MatrixType> >(m);
svd_verify_assert<JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner> >(m, true);
svd_verify_assert<JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner> >(m);
svd_verify_assert<JacobiSVD<MatrixType, HouseholderQRPreconditioner> >(m);
Index rows = m.rows();
Index cols = m.cols();

View File

@@ -462,7 +462,7 @@ void svd_preallocate()
}
template<typename SvdType,typename MatrixType>
void svd_verify_assert(const MatrixType& m)
void svd_verify_assert(const MatrixType& m, bool fullOnly = false)
{
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows();
@@ -489,8 +489,17 @@ void svd_verify_assert(const MatrixType& m)
VERIFY_RAISES_ASSERT(svd.matrixV())
svd.singularValues();
VERIFY_RAISES_ASSERT(svd.solve(rhs))
if (ColsAtCompileTime == Dynamic)
svd.compute(a, ComputeFullU);
svd.matrixU();
VERIFY_RAISES_ASSERT(svd.matrixV())
VERIFY_RAISES_ASSERT(svd.solve(rhs))
svd.compute(a, ComputeFullV);
svd.matrixV();
VERIFY_RAISES_ASSERT(svd.matrixU())
VERIFY_RAISES_ASSERT(svd.solve(rhs))
if (!fullOnly && ColsAtCompileTime == Dynamic)
{
svd.compute(a, ComputeThinU);
svd.matrixU();