From 2e792d1f42e895175e9536e141456326da1176ed Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 15 Jun 2010 22:00:34 +0200 Subject: * make the triangular matrix * matrix product works with trapezoidal matrices * extend the trmm unit test for unit diagonal --- test/product_trmm.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'test/product_trmm.cpp') diff --git a/test/product_trmm.cpp b/test/product_trmm.cpp index 69e97f7aa..e8580cbd2 100644 --- a/test/product_trmm.cpp +++ b/test/product_trmm.cpp @@ -28,8 +28,11 @@ template void trmm(int size,int othersize) { typedef typename NumTraits::Real RealScalar; - Matrix tri(size,size), upTri(size,size), loTri(size,size); - Matrix ge1(size,othersize), ge2(10,size), ge3; + typedef Matrix MatrixType; + + MatrixType tri(size,size), upTri(size,size), loTri(size,size), + unitUpTri(size,size), unitLoTri(size,size); + MatrixType ge1(size,othersize), ge2(10,size), ge3; Matrix rge3; Scalar s1 = ei_random(), @@ -38,6 +41,8 @@ template void trmm(int size,int othersize) tri.setRandom(); loTri = tri.template triangularView(); upTri = tri.template triangularView(); + unitLoTri = tri.template triangularView(); + unitUpTri = tri.template triangularView(); ge1.setRandom(); ge2.setRandom(); @@ -57,6 +62,10 @@ template void trmm(int size,int othersize) VERIFY_IS_APPROX(rge3 = tri.adjoint().template triangularView() * ge2.adjoint(), loTri.adjoint() * ge2.adjoint()); VERIFY_IS_APPROX( ge3 = tri.adjoint().template triangularView() * ge2.adjoint(), upTri.adjoint() * ge2.adjoint()); VERIFY_IS_APPROX(rge3 = tri.adjoint().template triangularView() * ge2.adjoint(), upTri.adjoint() * ge2.adjoint()); + + VERIFY_IS_APPROX( ge3 = tri.template triangularView() * ge1, unitLoTri * ge1); + VERIFY_IS_APPROX(rge3 = tri.template triangularView() * ge1, unitLoTri * ge1); + VERIFY_IS_APPROX( ge3 = (s1*tri).adjoint().template triangularView() * ge2.adjoint(), ei_conj(s1) * unitLoTri.adjoint() * ge2.adjoint()); } void test_product_trmm() -- cgit v1.2.3