10#ifndef EIGEN_TRIANGULAR_MATRIX_MATRIX_H
11#define EIGEN_TRIANGULAR_MATRIX_MATRIX_H
44template <
typename Scalar,
typename Index,
45 int Mode,
bool LhsIsTriangular,
46 int LhsStorageOrder,
bool ConjugateLhs,
47 int RhsStorageOrder,
bool ConjugateRhs,
48 int ResStorageOrder,
int ResInnerStride,
49 int Version = Specialized>
52template <
typename Scalar,
typename Index,
61 static EIGEN_STRONG_INLINE
void run(
76 ::run(cols, rows, depth, rhs,
rhsStride, lhs,
lhsStride, res,
resIncr,
resStride, alpha,
blocking);
81template <
typename Scalar,
typename Index,
int Mode,
92 SmallPanelWidth = 2 * EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
97 static EIGEN_DONT_INLINE
void run(
105template <
typename Scalar,
typename Index,
int Mode,
138 std::size_t
sizeA = kc*mc;
139 std::size_t
sizeB = kc*cols;
141 ei_declare_aligned_stack_constructed_variable(Scalar, blockA,
sizeA,
blocking.blockA());
142 ei_declare_aligned_stack_constructed_variable(Scalar, blockB,
sizeB,
blocking.blockB());
161 for(
Index k2=IsLower ? depth : 0;
162 IsLower ?
k2>0 :
k2<depth;
163 IsLower ?
k2-=kc :
k2+=kc)
203 pack_lhs(blockA, LhsMapper(triangularBuffer.data(), triangularBuffer.outerStride()), actualPanelWidth, actualPanelWidth);
205 gebp_kernel(res.getSubMapper(startBlock, 0), blockA, blockB,
206 actualPanelWidth, actualPanelWidth, cols, alpha,
207 actualPanelWidth, actual_kc, 0, blockBOffset);
212 Index startTarget = IsLower ? actual_k2+k1+actualPanelWidth : actual_k2;
214 pack_lhs(blockA, lhs.getSubMapper(startTarget,startBlock), actualPanelWidth, lengthTarget);
216 gebp_kernel(res.getSubMapper(startTarget, 0), blockA, blockB,
217 lengthTarget, actualPanelWidth, cols, alpha,
218 actualPanelWidth, actual_kc, 0, blockBOffset);
224 Index start = IsLower ? k2 : 0;
225 Index end = IsLower ? rows : (std::min)(actual_k2,rows);
226 for(
Index i2=start; i2<end; i2+=mc)
228 const Index actual_mc = (std::min)(i2+mc,end)-i2;
229 gemm_pack_lhs<Scalar, Index, LhsMapper, Traits::mr,Traits::LhsProgress, typename Traits::LhsPacket4Packing, LhsStorageOrder,false>()
230 (blockA, lhs.getSubMapper(i2, actual_k2), actual_kc, actual_mc);
232 gebp_kernel(res.getSubMapper(i2, 0), blockA, blockB, actual_mc,
233 actual_kc, cols, alpha, -1, -1, 0, 0);
240template <
typename Scalar,
typename Index,
int Mode,
241 int LhsStorageOrder,
bool ConjugateLhs,
242 int RhsStorageOrder,
bool ConjugateRhs,
243 int ResInnerStride,
int Version>
250 SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
255 static EIGEN_DONT_INLINE
void run(
263template <
typename Scalar,
typename Index,
int Mode,
293 std::size_t
sizeA = kc*mc;
294 std::size_t
sizeB = kc*cols+EIGEN_MAX_ALIGN_BYTES/
sizeof(Scalar);
296 ei_declare_aligned_stack_constructed_variable(Scalar, blockA,
sizeA,
blocking.blockA());
297 ei_declare_aligned_stack_constructed_variable(Scalar, blockB,
sizeB,
blocking.blockB());
312 for(
Index k2=IsLower ? 0 : depth;
314 IsLower ?
k2+=kc :
k2-=kc)
360 pack_rhs_panel(blockB+j2*actual_kc,
361 RhsMapper(triangularBuffer.data(), triangularBuffer.outerStride()),
362 actualPanelWidth, actualPanelWidth,
367 for (
Index i2=0; i2<rows; i2+=mc)
369 const Index actual_mc = (std::min)(mc,rows-i2);
370 pack_lhs(blockA, lhs.getSubMapper(i2, actual_k2), actual_kc, actual_mc);
375 for (
Index j2=0; j2<actual_kc; j2+=SmallPanelWidth)
377 Index actualPanelWidth = std::min<Index>(actual_kc-j2, SmallPanelWidth);
378 Index panelLength = IsLower ? actual_kc-j2 : j2+actualPanelWidth;
379 Index blockOffset = IsLower ? j2 : 0;
381 gebp_kernel(res.getSubMapper(i2, actual_k2 + j2),
382 blockA, blockB+j2*actual_kc,
383 actual_mc, panelLength, actualPanelWidth,
385 actual_kc, actual_kc,
386 blockOffset, blockOffset);
389 gebp_kernel(res.getSubMapper(i2, IsLower ? 0 : k2),
390 blockA, geb, actual_mc, actual_kc, rs,
404template<
int Mode,
bool LhsIsTriangular,
typename Lhs,
typename Rhs>
407 template<
typename Dest>
static void run(
Dest&
dst,
const Lhs &
a_lhs,
const Rhs &
a_rhs,
const typename Dest::Scalar& alpha)
409 typedef typename Lhs::Scalar LhsScalar;
410 typedef typename Rhs::Scalar RhsScalar;
411 typedef typename Dest::Scalar Scalar;
414 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
415 typedef typename internal::remove_all<ActualLhsType>::type ActualLhsTypeCleaned;
417 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
418 typedef typename internal::remove_all<ActualRhsType>::type ActualRhsTypeCleaned;
428 Lhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxColsAtCompileTime,4>
BlockingType;
434 : ((IsLower) ? rhs.rows() : (std::min)(rhs.rows(),rhs.cols()));
445 &lhs.coeffRef(0,0), lhs.outerStride(),
446 &rhs.coeffRef(0,0), rhs.outerStride(),
447 &
dst.coeffRef(0,0),
dst.innerStride(),
dst.outerStride(),
EIGEN_DEVICE_FUNC Derived & setZero()
Sets all coefficients in this expression to zero.
Definition CwiseNullaryOp.h:546
EIGEN_DEVICE_FUNC Derived & setOnes()
Sets all coefficients in this expression to one.
Definition CwiseNullaryOp.h:698
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
EIGEN_DEVICE_FUNC DiagonalReturnType diagonal()
Definition Diagonal.h:187
Definition GeneralMatrixMatrix.h:248
@ UnitDiag
Matrix has ones on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:213
@ ZeroDiag
Matrix has zeros on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:215
@ Lower
View matrix as a lower triangular matrix.
Definition Constants.h:209
@ Upper
View matrix as an upper triangular matrix.
Definition Constants.h:211
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:321
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition BlasUtil.h:403
Definition DenseStorage.h:25
Definition GeneralBlockPanelKernel.h:1058
Definition GenericPacketMath.h:107
Definition TriangularMatrixMatrix.h:50
Definition ForwardDeclarations.h:17
Definition ProductEvaluators.h:758