aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2009-05-22 14:27:58 +0200
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2009-05-22 14:27:58 +0200
commit5c5789cf0f28b375e3bfebe3e61756fc0b00fe0c (patch)
tree8f0c290834bee4119ee8e8084d0231144e12c640 /test
parentc7baddb132f3c5894775041645f54517bd110d40 (diff)
QR and SVD decomposition interface unification.
Added default ctor and public compute method as well as safe-guards against uninitialized usage. Added unit tests for the safe-guards.
Diffstat (limited to 'test')
-rw-r--r--test/qr.cpp23
-rw-r--r--test/svd.cpp22
2 files changed, 45 insertions, 0 deletions
diff --git a/test/qr.cpp b/test/qr.cpp
index 8fe356444..b71abb782 100644
--- a/test/qr.cpp
+++ b/test/qr.cpp
@@ -121,6 +121,22 @@ template<typename MatrixType> void qr_invertible()
VERIFY(lu.solve(m3, &m2));
}
+template<typename MatrixType> void qr_verify_assert()
+{
+ MatrixType tmp;
+
+ QR<MatrixType> qr;
+ VERIFY_RAISES_ASSERT(qr.isFullRank())
+ VERIFY_RAISES_ASSERT(qr.rank())
+ VERIFY_RAISES_ASSERT(qr.dimensionOfKernel())
+ VERIFY_RAISES_ASSERT(qr.isInjective())
+ VERIFY_RAISES_ASSERT(qr.isSurjective())
+ VERIFY_RAISES_ASSERT(qr.isInvertible())
+ VERIFY_RAISES_ASSERT(qr.matrixR())
+ VERIFY_RAISES_ASSERT(qr.solve(tmp,&tmp))
+ VERIFY_RAISES_ASSERT(qr.matrixQ())
+}
+
void test_qr()
{
for(int i = 0; i < 1; i++) {
@@ -144,4 +160,11 @@ void test_qr()
// CALL_SUBTEST( qr_invertible<MatrixXcf>() );
// CALL_SUBTEST( qr_invertible<MatrixXcd>() );
}
+
+ CALL_SUBTEST(qr_verify_assert<Matrix3f>());
+ CALL_SUBTEST(qr_verify_assert<Matrix3d>());
+ CALL_SUBTEST(qr_verify_assert<MatrixXf>());
+ CALL_SUBTEST(qr_verify_assert<MatrixXd>());
+ CALL_SUBTEST(qr_verify_assert<MatrixXcf>());
+ CALL_SUBTEST(qr_verify_assert<MatrixXcd>());
}
diff --git a/test/svd.cpp b/test/svd.cpp
index 688c3f402..4a703369e 100644
--- a/test/svd.cpp
+++ b/test/svd.cpp
@@ -24,6 +24,7 @@
#include "main.h"
#include <Eigen/SVD>
+#include <Eigen/LU>
template<typename MatrixType> void svd(const MatrixType& m)
{
@@ -85,6 +86,22 @@ template<typename MatrixType> void svd(const MatrixType& m)
}
}
+template<typename MatrixType> void svd_verify_assert()
+{
+ MatrixType tmp;
+
+ SVD<MatrixType> svd;
+ VERIFY_RAISES_ASSERT(svd.solve(tmp, &tmp))
+ VERIFY_RAISES_ASSERT(svd.matrixU())
+ VERIFY_RAISES_ASSERT(svd.singularValues())
+ VERIFY_RAISES_ASSERT(svd.matrixV())
+ VERIFY_RAISES_ASSERT(svd.sort())
+ VERIFY_RAISES_ASSERT(svd.computeUnitaryPositive(&tmp,&tmp))
+ VERIFY_RAISES_ASSERT(svd.computePositiveUnitary(&tmp,&tmp))
+ VERIFY_RAISES_ASSERT(svd.computeRotationScaling(&tmp,&tmp))
+ VERIFY_RAISES_ASSERT(svd.computeScalingRotation(&tmp,&tmp))
+}
+
void test_svd()
{
for(int i = 0; i < g_repeat; i++) {
@@ -96,4 +113,9 @@ void test_svd()
// CALL_SUBTEST( svd(MatrixXcd(6,6)) );
// CALL_SUBTEST( svd(MatrixXcf(3,3)) );
}
+
+ CALL_SUBTEST( svd_verify_assert<Matrix3f>() );
+ CALL_SUBTEST( svd_verify_assert<Matrix3d>() );
+ CALL_SUBTEST( svd_verify_assert<MatrixXf>() );
+ CALL_SUBTEST( svd_verify_assert<MatrixXd>() );
}