aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cholesky.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-10-20 10:48:40 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-10-20 10:48:40 +0200
commitd04f23260def5c61bce01942b4b74eb0c77c54ed (patch)
tree49918fc66fb8ee78217e482a1cd500d31c365cb9 /test/cholesky.cpp
parent8838b0a1fff2cb01fab3a55312a16ae20daead13 (diff)
Fix bug #894: the sign of LDLT was not re-initialized at each call of compute()
Diffstat (limited to 'test/cholesky.cpp')
-rw-r--r--test/cholesky.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index a883192ab..33e32a322 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -316,33 +316,35 @@ template<typename MatrixType> void cholesky_definiteness(const MatrixType& m)
{
eigen_assert(m.rows() == 2 && m.cols() == 2);
MatrixType mat;
+ LDLT<MatrixType> ldlt(2);
+
{
mat << 1, 0, 0, -1;
- LDLT<MatrixType> ldlt(mat);
+ ldlt.compute(mat);
VERIFY(!ldlt.isNegative());
VERIFY(!ldlt.isPositive());
}
{
mat << 1, 2, 2, 1;
- LDLT<MatrixType> ldlt(mat);
+ ldlt.compute(mat);
VERIFY(!ldlt.isNegative());
VERIFY(!ldlt.isPositive());
}
{
mat << 0, 0, 0, 0;
- LDLT<MatrixType> ldlt(mat);
+ ldlt.compute(mat);
VERIFY(ldlt.isNegative());
VERIFY(ldlt.isPositive());
}
{
mat << 0, 0, 0, 1;
- LDLT<MatrixType> ldlt(mat);
+ ldlt.compute(mat);
VERIFY(!ldlt.isNegative());
VERIFY(ldlt.isPositive());
}
{
mat << -1, 0, 0, 0;
- LDLT<MatrixType> ldlt(mat);
+ ldlt.compute(mat);
VERIFY(ldlt.isNegative());
VERIFY(!ldlt.isPositive());
}