From 826bff58c68273d1d0088898c1f54a01c9a94b04 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 4 Jan 2010 17:36:26 +0100 Subject: [PATCH] Fix #69 for the second time, and add the respective regression test --- Eigen/src/Core/SolveTriangular.h | 22 ++++++++++++++++++---- test/product_trsolve.cpp | 3 ++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h index 15717a120..9c4a49c3c 100644 --- a/Eigen/src/Core/SolveTriangular.h +++ b/Eigen/src/Core/SolveTriangular.h @@ -25,13 +25,27 @@ #ifndef EIGEN_SOLVETRIANGULAR_H #define EIGEN_SOLVETRIANGULAR_H +template +class ei_trsolve_traits +{ + private: + enum { + RhsIsVectorAtCompileTime = (Side==OnTheLeft ? Rhs::ColsAtCompileTime : Rhs::RowsAtCompileTime)==1 + }; + public: + enum { + Unrolling = (RhsIsVectorAtCompileTime && Rhs::SizeAtCompileTime <= 8) + ? CompleteUnrolling : NoUnrolling, + RhsVectors = RhsIsVectorAtCompileTime ? 1 : Dynamic + }; +}; + template::Unrolling, int StorageOrder = (int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor, - int RhsVectors = Rhs::IsVectorAtCompileTime ? 1 : Dynamic + int RhsVectors = ei_trsolve_traits::RhsVectors > struct ei_triangular_solver_selector; diff --git a/test/product_trsolve.cpp b/test/product_trsolve.cpp index 449240f7c..66e263862 100644 --- a/test/product_trsolve.cpp +++ b/test/product_trsolve.cpp @@ -84,6 +84,7 @@ void test_product_trsolve() // vectors CALL_SUBTEST_3((trsolve,Dynamic,1>(ei_random(1,320)))); CALL_SUBTEST_4((trsolve())); - CALL_SUBTEST_5((trsolve,4,1>())); + CALL_SUBTEST_5((trsolve())); + CALL_SUBTEST_6((trsolve,4,1>())); } }