mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 16:49:38 +08:00
bug #1617: add unit tests for empty triangular solve.
This commit is contained in:
parent
502f717980
commit
aeffdf909e
@ -71,6 +71,19 @@ template<typename Scalar,int Size, int Cols> void trsolve(int size=Size,int cols
|
||||
int c = internal::random<int>(0,cols-1);
|
||||
VERIFY_TRSM(rmLhs.template triangularView<Lower>(), rmRhs.col(c));
|
||||
VERIFY_TRSM(cmLhs.template triangularView<Lower>(), rmRhs.col(c));
|
||||
|
||||
if(Size==Dynamic)
|
||||
{
|
||||
cmLhs.resize(0,0);
|
||||
cmRhs.resize(0,cmRhs.cols());
|
||||
Matrix<Scalar,Size,Cols,colmajor> res = cmLhs.template triangularView<Lower>().solve(cmRhs);
|
||||
VERIFY_IS_EQUAL(res.rows(),0);
|
||||
VERIFY_IS_EQUAL(res.cols(),cmRhs.cols());
|
||||
res = cmRhs;
|
||||
cmLhs.template triangularView<Lower>().solveInPlace(res);
|
||||
VERIFY_IS_EQUAL(res.rows(),0);
|
||||
VERIFY_IS_EQUAL(res.cols(),cmRhs.cols());
|
||||
}
|
||||
}
|
||||
|
||||
EIGEN_DECLARE_TEST(product_trsolve)
|
||||
|
@ -98,6 +98,19 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
|
||||
initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeLowerTriangular, &zeroCoords, &nonzeroCoords);
|
||||
VERIFY_IS_APPROX(refMat2.template triangularView<Lower>().solve(vec2),
|
||||
m2.template triangularView<Lower>().solve(vec3));
|
||||
|
||||
// test empty triangular matrix
|
||||
{
|
||||
m2.resize(0,0);
|
||||
refMatB.resize(0,refMatB.cols());
|
||||
DenseMatrix res = m2.template triangularView<Lower>().solve(refMatB);
|
||||
VERIFY_IS_EQUAL(res.rows(),0);
|
||||
VERIFY_IS_EQUAL(res.cols(),refMatB.cols());
|
||||
res = refMatB;
|
||||
m2.template triangularView<Lower>().solveInPlace(res);
|
||||
VERIFY_IS_EQUAL(res.rows(),0);
|
||||
VERIFY_IS_EQUAL(res.cols(),refMatB.cols());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user