some cleaning

This commit is contained in:
Gael Guennebaud 2009-07-26 13:53:24 +02:00
parent f3fde74695
commit 1d4d9a37fd

View File

@ -50,8 +50,6 @@ struct ei_triangular_solver_selector<Lhs,Rhs,Mode,NoUnrolling,RowMajor,1>
const ActualLhsType& actualLhs = LhsProductTraits::extract(lhs);
const int size = lhs.cols();
for(int c=0 ; c<other.cols() ; ++c)
{
for(int pi=IsLowerTriangular ? 0 : size;
IsLowerTriangular ? pi<size : pi>0;
IsLowerTriangular ? pi+=PanelWidth : pi-=PanelWidth)
@ -66,11 +64,11 @@ struct ei_triangular_solver_selector<Lhs,Rhs,Mode,NoUnrolling,RowMajor,1>
// 2 - it is slighlty faster at runtime
int startRow = IsLowerTriangular ? pi : pi-actualPanelWidth;
int startCol = IsLowerTriangular ? 0 : pi;
Block<Rhs,Dynamic,1> target(other,startRow,c,actualPanelWidth,1);
VectorBlock<Rhs,Dynamic> target(other,startRow,actualPanelWidth);
ei_cache_friendly_product_rowmajor_times_vector<LhsProductTraits::NeedToConjugate,false>(
&(actualLhs.const_cast_derived().coeffRef(startRow,startCol)), actualLhs.stride(),
&(other.coeffRef(startCol, c)), r,
&(other.coeffRef(startCol)), r,
target, Scalar(-1));
}
@ -79,12 +77,11 @@ struct ei_triangular_solver_selector<Lhs,Rhs,Mode,NoUnrolling,RowMajor,1>
int i = IsLowerTriangular ? pi+k : pi-k-1;
int s = IsLowerTriangular ? pi : i+1;
if (k>0)
other.coeffRef(i,c) -= ((lhs.row(i).segment(s,k).transpose())
.cwise()*(other.col(c).segment(s,k))).sum();
other.coeffRef(i) -= ((lhs.row(i).segment(s,k).transpose())
.cwise()*(other.segment(s,k))).sum();
if(!(Mode & UnitDiagBit))
other.coeffRef(i,c) /= lhs.coeff(i,i);
}
other.coeffRef(i) /= lhs.coeff(i,i);
}
}
}
@ -109,8 +106,6 @@ struct ei_triangular_solver_selector<Lhs,Rhs,Mode,NoUnrolling,ColMajor,1>
const ActualLhsType& actualLhs = LhsProductTraits::extract(lhs);
const int size = lhs.cols();
for(int c=0 ; c<other.cols() ; ++c)
{
for(int pi=IsLowerTriangular ? 0 : size;
IsLowerTriangular ? pi<size : pi>0;
IsLowerTriangular ? pi+=PanelWidth : pi-=PanelWidth)
@ -123,15 +118,12 @@ struct ei_triangular_solver_selector<Lhs,Rhs,Mode,NoUnrolling,ColMajor,1>
{
int i = IsLowerTriangular ? pi+k : pi-k-1;
if(!(Mode & UnitDiagBit))
other.coeffRef(i,c) /= lhs.coeff(i,i);
other.coeffRef(i) /= lhs.coeff(i,i);
int r = actualPanelWidth - k - 1; // remaining size
int s = IsLowerTriangular ? i+1 : i-r;
if (r>0)
{
other.col(c).segment((IsLowerTriangular ? i+1 : i-r), r) -=
other.coeffRef(i,c)
* Block<Lhs,Dynamic,1>(lhs, (IsLowerTriangular ? i+1 : i-r), i, r, 1);
}
other.segment(s,r) -= other.coeffRef(i) * Block<Lhs,Dynamic,1>(lhs, s, i, r, 1);
}
int r = IsLowerTriangular ? size - endBlock : startBlock; // remaining size
if (r > 0)
@ -142,13 +134,12 @@ struct ei_triangular_solver_selector<Lhs,Rhs,Mode,NoUnrolling,ColMajor,1>
ei_cache_friendly_product_colmajor_times_vector<LhsProductTraits::NeedToConjugate,false>(
r,
&(actualLhs.const_cast_derived().coeffRef(endBlock,startBlock)), actualLhs.stride(),
other.col(c).segment(startBlock, actualPanelWidth),
&(other.coeffRef(endBlock, c)),
other.segment(startBlock, actualPanelWidth),
&(other.coeffRef(endBlock, 0)),
Scalar(-1));
}
}
}
}
};
template <typename Scalar, int LhsStorageOrder, bool ConjugateLhs, int RhsStorageOrder, int Mode>