diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-07-10 11:30:46 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-07-10 11:30:46 +0200 |
commit | b47dea8b7aeab10cf584f2d3275192d90d8df2ed (patch) | |
tree | f9647716407f4fe897d8d277e9f99cfda08a9c86 /test | |
parent | 1a1b2e9f27db619303e7f212f9bf5c58a2dd988c (diff) |
add a meta unroller for the triangular solver (only for vectors as rhs)
Diffstat (limited to 'test')
-rw-r--r-- | test/triangular.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/triangular.cpp b/test/triangular.cpp index 0c03e987e..7c680a8ed 100644 --- a/test/triangular.cpp +++ b/test/triangular.cpp @@ -86,7 +86,17 @@ template<typename MatrixType> void triangular(const MatrixType& m) while (ei_abs2(m1(i,i))<1e-3) m1(i,i) = ei_random<Scalar>(); Transpose<MatrixType> trm4(m4); - // test back and forward subsitution + // test back and forward subsitution with a vector as the rhs + m3 = m1.template triangularView<Eigen::UpperTriangular>(); + VERIFY(v2.isApprox(m3.adjoint() * (m1.adjoint().template triangularView<Eigen::LowerTriangular>().solve(v2)), largerEps)); + m3 = m1.template triangularView<Eigen::LowerTriangular>(); + VERIFY(v2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Eigen::UpperTriangular>().solve(v2)), largerEps)); + m3 = m1.template triangularView<Eigen::UpperTriangular>(); + VERIFY(v2.isApprox(m3 * (m1.template triangularView<Eigen::UpperTriangular>().solve(v2)), largerEps)); + m3 = m1.template triangularView<Eigen::LowerTriangular>(); + VERIFY(v2.isApprox(m3.conjugate() * (m1.conjugate().template triangularView<Eigen::LowerTriangular>().solve(v2)), largerEps)); + + // test back and forward subsitution with a matrix as the rhs m3 = m1.template triangularView<Eigen::UpperTriangular>(); VERIFY(m2.isApprox(m3.adjoint() * (m1.adjoint().template triangularView<Eigen::LowerTriangular>().solve(m2)), largerEps)); m3 = m1.template triangularView<Eigen::LowerTriangular>(); |