diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-06-17 00:14:42 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-06-17 00:14:42 +0200 |
commit | 55365566b2f81656a58e3d3dad1a82ec3038ca64 (patch) | |
tree | 458e647ee49df1e3d0d48504713f4767a9b25235 /test/householder.cpp | |
parent | 9f11f80db1b53d0f9b9173a777c0a644e763619a (diff) |
Fix HouseholderSequence::conjugate() and ::adjoint() and add respective unit tests.
Diffstat (limited to 'test/householder.cpp')
-rw-r--r-- | test/householder.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/householder.cpp b/test/householder.cpp index d10cadd6c..c5f6b5e4f 100644 --- a/test/householder.cpp +++ b/test/householder.cpp @@ -89,12 +89,29 @@ template<typename MatrixType> void householder(const MatrixType& m) hseq.setLength(hc.size()).setShift(shift); VERIFY(hseq.length() == hc.size()); VERIFY(hseq.shift() == shift); - + MatrixType m5 = m2; m5.block(shift,0,brows,cols).template triangularView<StrictlyLower>().setZero(); VERIFY_IS_APPROX(hseq * m5, m1); // test applying hseq directly m3 = hseq; VERIFY_IS_APPROX(m3 * m5, m1); // test evaluating hseq to a dense matrix, then applying + + SquareMatrixType hseq_mat = hseq; + SquareMatrixType hseq_mat_conj = hseq.conjugate(); + SquareMatrixType hseq_mat_adj = hseq.adjoint(); + SquareMatrixType hseq_mat_trans = hseq.transpose(); + SquareMatrixType m6 = SquareMatrixType::Random(rows, rows); + VERIFY_IS_APPROX(hseq_mat.adjoint(), hseq_mat_adj); + VERIFY_IS_APPROX(hseq_mat.conjugate(), hseq_mat_conj); + VERIFY_IS_APPROX(hseq_mat.transpose(), hseq_mat_trans); + VERIFY_IS_APPROX(hseq_mat * m6, hseq_mat * m6); + VERIFY_IS_APPROX(hseq_mat.adjoint() * m6, hseq_mat_adj * m6); + VERIFY_IS_APPROX(hseq_mat.conjugate() * m6, hseq_mat_conj * m6); + VERIFY_IS_APPROX(hseq_mat.transpose() * m6, hseq_mat_trans * m6); + VERIFY_IS_APPROX(m6 * hseq_mat, m6 * hseq_mat); + VERIFY_IS_APPROX(m6 * hseq_mat.adjoint(), m6 * hseq_mat_adj); + VERIFY_IS_APPROX(m6 * hseq_mat.conjugate(), m6 * hseq_mat_conj); + VERIFY_IS_APPROX(m6 * hseq_mat.transpose(), m6 * hseq_mat_trans); // test householder sequence on the right with a shift |