10 #ifndef EIGEN_TRIANGULAR_SOLVER_VECTOR_H
11 #define EIGEN_TRIANGULAR_SOLVER_VECTOR_H
17 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int Mode,
bool Conjugate,
int StorageOrder>
18 struct triangular_solve_vector<LhsScalar, RhsScalar, Index,
OnTheRight, Mode, Conjugate, StorageOrder>
20 static void run(Index size,
const LhsScalar* _lhs, Index lhsStride, RhsScalar* rhs)
22 triangular_solve_vector<LhsScalar,RhsScalar,Index,
OnTheLeft,
25 >::run(size, _lhs, lhsStride, rhs);
30 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int Mode,
bool Conjugate>
31 struct triangular_solve_vector<LhsScalar, RhsScalar, Index,
OnTheLeft, Mode, Conjugate,
RowMajor>
36 static void run(Index size,
const LhsScalar* _lhs, Index lhsStride, RhsScalar* rhs)
38 typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,RowMajor>, 0, OuterStride<> > LhsMap;
39 const LhsMap lhs(_lhs,size,size,OuterStride<>(lhsStride));
40 typename internal::conditional<
42 const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
45 static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
46 for(Index pi=IsLower ? 0 : size;
47 IsLower ? pi<size : pi>0;
48 IsLower ? pi+=PanelWidth : pi-=PanelWidth)
50 Index actualPanelWidth = (std::min)(IsLower ? size - pi : pi, PanelWidth);
52 Index r = IsLower ? pi : size - pi;
58 Index startRow = IsLower ? pi : pi-actualPanelWidth;
59 Index startCol = IsLower ? 0 : pi;
61 general_matrix_vector_product<Index,LhsScalar,RowMajor,Conjugate,RhsScalar,false>::run(
63 &lhs.coeffRef(startRow,startCol), lhsStride,
69 for(Index k=0; k<actualPanelWidth; ++k)
71 Index i = IsLower ? pi+k : pi-k-1;
72 Index s = IsLower ? pi : i+1;
74 rhs[i] -= (cjLhs.row(i).segment(s,k).transpose().cwiseProduct(Map<
const Matrix<RhsScalar,Dynamic,1> >(rhs+s,k))).sum();
84 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int Mode,
bool Conjugate>
85 struct triangular_solve_vector<LhsScalar, RhsScalar, Index,
OnTheLeft, Mode, Conjugate,
ColMajor>
90 static void run(Index size,
const LhsScalar* _lhs, Index lhsStride, RhsScalar* rhs)
92 typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > LhsMap;
93 const LhsMap lhs(_lhs,size,size,OuterStride<>(lhsStride));
94 typename internal::conditional<Conjugate,
95 const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,
98 static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
100 for(Index pi=IsLower ? 0 : size;
101 IsLower ? pi<size : pi>0;
102 IsLower ? pi+=PanelWidth : pi-=PanelWidth)
104 Index actualPanelWidth = (std::min)(IsLower ? size - pi : pi, PanelWidth);
105 Index startBlock = IsLower ? pi : pi-actualPanelWidth;
106 Index endBlock = IsLower ? pi + actualPanelWidth : 0;
108 for(Index k=0; k<actualPanelWidth; ++k)
110 Index i = IsLower ? pi+k : pi-k-1;
112 rhs[i] /= cjLhs.coeff(i,i);
114 Index r = actualPanelWidth - k - 1;
115 Index s = IsLower ? i+1 : i-r;
117 Map<Matrix<RhsScalar,Dynamic,1> >(rhs+s,r) -= rhs[i] * cjLhs.col(i).segment(s,r);
119 Index r = IsLower ? size - endBlock : startBlock;
125 general_matrix_vector_product<Index,LhsScalar,ColMajor,Conjugate,RhsScalar,false>::run(
127 &lhs.coeffRef(endBlock,startBlock), lhsStride,
129 rhs+endBlock, 1, RhsScalar(-1));
139 #endif // EIGEN_TRIANGULAR_SOLVER_VECTOR_H
Definition: Constants.h:167
Definition: Constants.h:264
Definition: Constants.h:169
Definition: Constants.h:279
Definition: Constants.h:171
Definition: Constants.h:266
Definition: Constants.h:277