Fix #69 for the second time, and add the respective regression test

This commit is contained in:
Gael Guennebaud 2010-01-04 17:36:26 +01:00
parent 80d1f9e966
commit 826bff58c6
2 changed files with 20 additions and 5 deletions

View File

@ -25,13 +25,27 @@
#ifndef EIGEN_SOLVETRIANGULAR_H
#define EIGEN_SOLVETRIANGULAR_H
template<typename Lhs, typename Rhs, int Side>
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<typename Lhs, typename Rhs,
int Mode, // can be Upper/Lower | UnitDiag
int Side, // can be OnTheLeft/OnTheRight
int Unrolling = Rhs::IsVectorAtCompileTime && Rhs::SizeAtCompileTime <= 8 // FIXME
? CompleteUnrolling : NoUnrolling,
int Mode, // can be Upper/Lower | UnitDiag
int Unrolling = ei_trsolve_traits<Lhs,Rhs,Side>::Unrolling,
int StorageOrder = (int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor,
int RhsVectors = Rhs::IsVectorAtCompileTime ? 1 : Dynamic
int RhsVectors = ei_trsolve_traits<Lhs,Rhs,Side>::RhsVectors
>
struct ei_triangular_solver_selector;

View File

@ -84,6 +84,7 @@ void test_product_trsolve()
// vectors
CALL_SUBTEST_3((trsolve<std::complex<double>,Dynamic,1>(ei_random<int>(1,320))));
CALL_SUBTEST_4((trsolve<float,1,1>()));
CALL_SUBTEST_5((trsolve<std::complex<float>,4,1>()));
CALL_SUBTEST_5((trsolve<float,1,2>()));
CALL_SUBTEST_6((trsolve<std::complex<float>,4,1>()));
}
}