Use more explicit names.

This commit is contained in:
Gael Guennebaud 2015-12-10 12:03:38 +01:00
parent 75f0fe3795
commit 145ad5d800

View File

@ -115,17 +115,17 @@ template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size>
struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,false> { struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,false> {
enum { enum {
IsLower = ((Mode&Lower)==Lower), IsLower = ((Mode&Lower)==Lower),
RowIndex = IsLower ? LoopIndex : Size - LoopIndex - 1, DiagIndex = IsLower ? LoopIndex : Size - LoopIndex - 1,
S = IsLower ? 0 : RowIndex+1 StartIndex = IsLower ? 0 : DiagIndex+1
}; };
static void run(const Lhs& lhs, Rhs& rhs) static void run(const Lhs& lhs, Rhs& rhs)
{ {
if (LoopIndex>0) if (LoopIndex>0)
rhs.coeffRef(RowIndex) -= lhs.row(RowIndex).template segment<LoopIndex>(S).transpose() rhs.coeffRef(DiagIndex) -= lhs.row(DiagIndex).template segment<LoopIndex>(StartIndex).transpose()
.cwiseProduct(rhs.template segment<LoopIndex>(S)).sum(); .cwiseProduct(rhs.template segment<LoopIndex>(StartIndex)).sum();
if(!(Mode & UnitDiag)) if(!(Mode & UnitDiag))
rhs.coeffRef(RowIndex) /= lhs.coeff(RowIndex,RowIndex); rhs.coeffRef(DiagIndex) /= lhs.coeff(DiagIndex,DiagIndex);
triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex+1,Size>::run(lhs,rhs); triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex+1,Size>::run(lhs,rhs);
} }