mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
Fix usage of "Index" as a compile time integral.
This commit is contained in:
parent
f248249c1f
commit
75f0fe3795
@ -107,32 +107,32 @@ struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,Dynamic>
|
|||||||
* meta-unrolling implementation
|
* meta-unrolling implementation
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int Mode, int Index, int Size,
|
template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size,
|
||||||
bool Stop = Index==Size>
|
bool Stop = LoopIndex==Size>
|
||||||
struct triangular_solver_unroller;
|
struct triangular_solver_unroller;
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int Mode, int Index, int Size>
|
template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size>
|
||||||
struct triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,false> {
|
struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,false> {
|
||||||
enum {
|
enum {
|
||||||
IsLower = ((Mode&Lower)==Lower),
|
IsLower = ((Mode&Lower)==Lower),
|
||||||
RowIndex = IsLower ? Index : Size - Index - 1,
|
RowIndex = IsLower ? LoopIndex : Size - LoopIndex - 1,
|
||||||
S = IsLower ? 0 : RowIndex+1
|
S = IsLower ? 0 : RowIndex+1
|
||||||
};
|
};
|
||||||
static void run(const Lhs& lhs, Rhs& rhs)
|
static void run(const Lhs& lhs, Rhs& rhs)
|
||||||
{
|
{
|
||||||
if (Index>0)
|
if (LoopIndex>0)
|
||||||
rhs.coeffRef(RowIndex) -= lhs.row(RowIndex).template segment<Index>(S).transpose()
|
rhs.coeffRef(RowIndex) -= lhs.row(RowIndex).template segment<LoopIndex>(S).transpose()
|
||||||
.cwiseProduct(rhs.template segment<Index>(S)).sum();
|
.cwiseProduct(rhs.template segment<LoopIndex>(S)).sum();
|
||||||
|
|
||||||
if(!(Mode & UnitDiag))
|
if(!(Mode & UnitDiag))
|
||||||
rhs.coeffRef(RowIndex) /= lhs.coeff(RowIndex,RowIndex);
|
rhs.coeffRef(RowIndex) /= lhs.coeff(RowIndex,RowIndex);
|
||||||
|
|
||||||
triangular_solver_unroller<Lhs,Rhs,Mode,Index+1,Size>::run(lhs,rhs);
|
triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex+1,Size>::run(lhs,rhs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int Mode, int Index, int Size>
|
template<typename Lhs, typename Rhs, int Mode, int LoopIndex, int Size>
|
||||||
struct triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,true> {
|
struct triangular_solver_unroller<Lhs,Rhs,Mode,LoopIndex,Size,true> {
|
||||||
static void run(const Lhs&, Rhs&) {}
|
static void run(const Lhs&, Rhs&) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user