10 #ifndef EIGEN_TRIANGULARMATRIXVECTOR_H
11 #define EIGEN_TRIANGULARMATRIXVECTOR_H
17 template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int StorageOrder,
int Version=Specialized>
20 template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
30 const RhsScalar* _rhs,
Index rhsIncr, ResScalar* _res,
Index resIncr,
const RhsScalar&
alpha);
33 template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
60 for (
Index k=0; k<actualPanelWidth; ++k)
63 Index s = IsLower ? ((HasUnitDiag||HasZeroDiag) ?
i+1 :
i ) : pi;
64 Index r = IsLower ? actualPanelWidth-k : k+1;
65 if ((!(HasUnitDiag||HasZeroDiag)) || (--r)>0)
66 res.segment(
s,r) += (
alpha * cjRhs.coeff(
i)) * cjLhs.
col(
i).segment(
s,r);
70 Index r = IsLower ?
rows - pi - actualPanelWidth : pi;
73 Index s = IsLower ? pi+actualPanelWidth : 0;
76 LhsMapper(&lhs.coeffRef(
s,pi), lhsStride),
77 RhsMapper(&rhs.coeffRef(pi), rhsIncr),
85 LhsMapper(&lhs.coeffRef(0,
size), lhsStride),
86 RhsMapper(&rhs.coeffRef(
size), rhsIncr),
87 _res, resIncr,
alpha);
91 template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
101 const RhsScalar* _rhs,
Index rhsIncr, ResScalar* _res,
Index resIncr,
const ResScalar&
alpha);
104 template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
119 const RhsMap rhs(_rhs,
cols);
128 for (
Index pi=0; pi<diagSize; pi+=PanelWidth)
130 Index actualPanelWidth = (
std::min)(PanelWidth, diagSize-pi);
131 for (
Index k=0; k<actualPanelWidth; ++k)
134 Index s = IsLower ? pi : ((HasUnitDiag||HasZeroDiag) ?
i+1 :
i);
135 Index r = IsLower ? k+1 : actualPanelWidth-k;
136 if ((!(HasUnitDiag||HasZeroDiag)) || (--r)>0)
137 res.coeffRef(
i) +=
alpha * (cjLhs.
row(
i).segment(
s,r).cwiseProduct(cjRhs.segment(
s,r).transpose())).sum();
141 Index r = IsLower ? pi :
cols - pi - actualPanelWidth;
144 Index s = IsLower ? 0 : pi + actualPanelWidth;
147 LhsMapper(&lhs.coeffRef(pi,
s), lhsStride),
148 RhsMapper(&rhs.coeffRef(
s), rhsIncr),
152 if(IsLower &&
rows>diagSize)
156 LhsMapper(&lhs.coeffRef(diagSize,0), lhsStride),
157 RhsMapper(&rhs.coeffRef(0), rhsIncr),
158 &
res.coeffRef(diagSize), resIncr,
alpha);
166 template<
int Mode,
int StorageOrder>
173 template<
int Mode,
typename Lhs,
typename Rhs>
178 eigen_assert(dst.rows()==lhs.rows() && dst.cols()==rhs.cols());
184 template<
int Mode,
typename Lhs,
typename Rhs>
189 eigen_assert(dst.rows()==lhs.rows() && dst.cols()==rhs.cols());
194 ::
run(rhs.transpose(),lhs.transpose(), dstT,
alpha);
206 template<
typename Lhs,
typename Rhs,
typename Dest>
215 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
217 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
224 LhsScalar lhs_alpha = LhsBlasTraits::extractScalarFactor(lhs);
225 RhsScalar rhs_alpha = RhsBlasTraits::extractScalarFactor(rhs);
226 ResScalar actualAlpha =
alpha * lhs_alpha * rhs_alpha;
231 EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1,
233 MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal
239 bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
244 evalToDest ? dest.data() : static_dest.data());
248 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
250 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
252 if(!alphaIsCompatible)
254 MappedDest(actualDestPtr, dest.size()).setZero();
255 compatibleAlpha = RhsScalar(1);
258 MappedDest(actualDestPtr, dest.size()) = dest;
263 LhsScalar, LhsBlasTraits::NeedToConjugate,
264 RhsScalar, RhsBlasTraits::NeedToConjugate,
266 ::run(actualLhs.rows(),actualLhs.cols(),
267 actualLhs.data(),actualLhs.outerStride(),
268 actualRhs.data(),actualRhs.innerStride(),
269 actualDestPtr,1,compatibleAlpha);
273 if(!alphaIsCompatible)
274 dest += actualAlpha * MappedDest(actualDestPtr, dest.size());
276 dest = MappedDest(actualDestPtr, dest.size());
282 dest.head(diagSize) -= (lhs_alpha-LhsScalar(1))*rhs.head(diagSize);
289 template<
typename Lhs,
typename Rhs,
typename Dest>
297 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
299 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
305 LhsScalar lhs_alpha = LhsBlasTraits::extractScalarFactor(lhs);
306 RhsScalar rhs_alpha = RhsBlasTraits::extractScalarFactor(rhs);
307 ResScalar actualAlpha =
alpha * lhs_alpha * rhs_alpha;
310 DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1
316 DirectlyUseRhs ?
const_cast<RhsScalar*
>(actualRhs.data()) : static_rhs.data());
320 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
322 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
329 LhsScalar, LhsBlasTraits::NeedToConjugate,
330 RhsScalar, RhsBlasTraits::NeedToConjugate,
332 ::run(actualLhs.rows(),actualLhs.cols(),
333 actualLhs.data(),actualLhs.outerStride(),
335 dest.data(),dest.innerStride(),
341 dest.head(diagSize) -= (lhs_alpha-LhsScalar(1))*rhs.head(diagSize);
350 #endif // EIGEN_TRIANGULARMATRIXVECTOR_H