10#ifndef EIGEN_TRIANGULARMATRIXVECTOR_H
11#define EIGEN_TRIANGULARMATRIXVECTOR_H
17template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int StorageOrder,
int Version=Specialized>
20template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
33template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
38 static const Index
PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
45 typename conj_expr_if<ConjLhs,LhsMap>::type
cjLhs(lhs);
49 typename conj_expr_if<ConjRhs,RhsMap>::type
cjRhs(rhs);
63 Index s = IsLower ? ((HasUnitDiag||HasZeroDiag) ? i+1 : i ) :
pi;
65 if ((!(HasUnitDiag||HasZeroDiag)) || (--r)>0)
66 res.segment(s,r) += (alpha *
cjRhs.coeff(i)) *
cjLhs.col(i).segment(s,r);
68 res.coeffRef(i) += alpha *
cjRhs.coeff(i);
74 general_matrix_vector_product<Index,LhsScalar,LhsMapper,ColMajor,ConjLhs,RhsScalar,RhsMapper,ConjRhs,BuiltIn>::run(
78 &res.coeffRef(s),
resIncr, alpha);
81 if((!IsLower) && cols>size)
83 general_matrix_vector_product<Index,LhsScalar,LhsMapper,ColMajor,ConjLhs,RhsScalar,RhsMapper,ConjRhs>::run(
85 LhsMapper(&lhs.coeffRef(0,size), lhsStride),
86 RhsMapper(&rhs.coeffRef(size), rhsIncr),
87 _res, resIncr, alpha);
91template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
104template<
typename Index,
int Mode,
typename LhsScalar,
bool ConjLhs,
typename RhsScalar,
bool ConjRhs,
int Version>
109 static const Index
PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
116 typename conj_expr_if<ConjLhs,LhsMap>::type
cjLhs(lhs);
120 typename conj_expr_if<ConjRhs,RhsMap>::type
cjRhs(rhs);
134 Index s = IsLower ?
pi : ((HasUnitDiag||HasZeroDiag) ? i+1 : i);
136 if ((!(HasUnitDiag||HasZeroDiag)) || (--r)>0)
137 res.coeffRef(i) += alpha * (
cjLhs.row(i).segment(s,r).cwiseProduct(
cjRhs.segment(s,r).transpose())).sum();
139 res.coeffRef(i) += alpha *
cjRhs.coeff(i);
145 general_matrix_vector_product<Index,LhsScalar,LhsMapper,RowMajor,ConjLhs,RhsScalar,RhsMapper,ConjRhs,BuiltIn>::run(
152 if(IsLower && rows>diagSize)
154 general_matrix_vector_product<Index,LhsScalar,LhsMapper,RowMajor,ConjLhs,RhsScalar,RhsMapper,ConjRhs>::run(
156 LhsMapper(&lhs.coeffRef(diagSize,0), lhsStride),
157 RhsMapper(&rhs.coeffRef(0), rhsIncr),
158 &res.coeffRef(diagSize), resIncr, alpha);
166template<
int Mode,
int StorageOrder>
173template<
int Mode,
typename Lhs,
typename Rhs>
176 template<
typename Dest>
static void run(
Dest&
dst,
const Lhs &lhs,
const Rhs &rhs,
const typename Dest::Scalar& alpha)
178 eigen_assert(
dst.rows()==lhs.rows() &&
dst.cols()==rhs.cols());
184template<
int Mode,
typename Lhs,
typename Rhs>
187 template<
typename Dest>
static void run(
Dest&
dst,
const Lhs &lhs,
const Rhs &rhs,
const typename Dest::Scalar& alpha)
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>
207 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
209 typedef typename Lhs::Scalar LhsScalar;
210 typedef typename Rhs::Scalar RhsScalar;
211 typedef typename Dest::Scalar ResScalar;
212 typedef typename Dest::RealScalar RealScalar;
215 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
217 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
224 ResScalar
actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs)
225 * RhsBlasTraits::extractScalarFactor(rhs);
242 ei_declare_aligned_stack_constructed_variable(ResScalar,
actualDestPtr,dest.size(),
247 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
248 Index size = dest.size();
262 LhsScalar, LhsBlasTraits::NeedToConjugate,
263 RhsScalar, RhsBlasTraits::NeedToConjugate,
282 template<
typename Lhs,
typename Rhs,
typename Dest>
283 static void run(
const Lhs &lhs,
const Rhs &rhs,
Dest& dest,
const typename Dest::Scalar& alpha)
285 typedef typename Lhs::Scalar LhsScalar;
286 typedef typename Rhs::Scalar RhsScalar;
287 typedef typename Dest::Scalar ResScalar;
290 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
292 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
298 ResScalar
actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs)
299 * RhsBlasTraits::extractScalarFactor(rhs);
302 DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1
312 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
321 LhsScalar, LhsBlasTraits::NeedToConjugate,
322 RhsScalar, RhsBlasTraits::NeedToConjugate,
327 dest.data(),dest.innerStride(),
Pseudo expression representing a solving operation.
Definition Solve.h:63
@ UnitDiag
Matrix has ones on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:208
@ ZeroDiag
Matrix has zeros on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:210
@ Lower
View matrix as a lower triangular matrix.
Definition Constants.h:204
@ Upper
View matrix as an upper triangular matrix.
Definition Constants.h:206
@ Aligned
Definition Constants.h:235
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:320
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:322
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
Holds information about the various numeric (i.e.
Definition NumTraits.h:108
Definition BlasUtil.h:257
Definition BlasUtil.h:113
Definition ForwardDeclarations.h:17
Definition TriangularMatrixVector.h:18
Definition ProductEvaluators.h:656
Definition TriangularMatrixVector.h:167