10 #ifndef EIGEN_GENERAL_MATRIX_MATRIX_H
11 #define EIGEN_GENERAL_MATRIX_MATRIX_H
22 typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
23 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
32 const LhsScalar* lhs,
Index lhsStride,
33 const RhsScalar* rhs,
Index rhsStride,
44 ::run(
cols,
rows,
depth,rhs,rhsStride,lhs,lhsStride,
res,resIncr,resStride,
alpha,blocking,
info);
52 typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
53 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
62 const LhsScalar* _lhs,
Index lhsStride,
63 const RhsScalar* _rhs,
Index rhsStride,
72 LhsMapper lhs(_lhs, lhsStride);
73 RhsMapper rhs(_rhs, rhsStride);
74 ResMapper
res(_res, resStride, resIncr);
84 #ifdef EIGEN_HAS_OPENMP
91 LhsScalar* blockA = blocking.
blockA();
104 pack_rhs(blockB, rhs.getSubMapper(k,0), actual_kc,
nc);
112 while(
info[tid].users!=0) {}
113 info[tid].users = threads;
115 pack_lhs(blockA+
info[tid].lhs_start*actual_kc, lhs.getSubMapper(
info[tid].lhs_start,k), actual_kc,
info[tid].lhs_length);
121 for(
int shift=0; shift<threads; ++shift)
123 int i = (tid+shift)%threads;
129 while(
info[
i].sync!=k) {
133 gebp(
res.getSubMapper(
info[
i].lhs_start, 0), blockA+
info[
i].lhs_start*actual_kc, blockB,
info[
i].lhs_length, actual_kc,
nc,
alpha);
142 pack_rhs(blockB, rhs.getSubMapper(k,
j), actual_kc, actual_nc);
145 gebp(
res.getSubMapper(0,
j), blockA, blockB,
rows, actual_kc, actual_nc,
alpha);
158 #endif // EIGEN_HAS_OPENMP
184 pack_lhs(blockA, lhs.getSubMapper(i2,k2), actual_kc, actual_mc);
194 if((!pack_rhs_once) || i2==0)
195 pack_rhs(blockB, rhs.getSubMapper(k2,j2), actual_kc, actual_nc);
198 gebp(
res.getSubMapper(i2, j2), blockA, blockB, actual_mc, actual_kc, actual_nc,
alpha);
212 template<
typename Scalar,
typename Index,
typename Gemm,
typename Lhs,
typename Rhs,
typename Dest,
typename BlockingType>
237 typedef typename Gemm::Traits
Traits;
247 template<
int StorageOrder,
typename LhsScalar,
typename RhsScalar,
int MaxRows,
int MaxCols,
int MaxDepth,
int KcFactor=1,
250 template<
typename _LhsScalar,
typename _RhsScalar>
278 template<
int StorageOrder,
typename _LhsScalar,
typename _RhsScalar,
int MaxRows,
int MaxCols,
int MaxDepth,
int KcFactor>
281 typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
282 typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
293 SizeA = ActualRows * MaxDepth,
294 SizeB = ActualCols * MaxDepth
297 #if EIGEN_MAX_STATIC_ALIGN_BYTES >= EIGEN_DEFAULT_ALIGN_BYTES
309 this->m_mc = ActualRows;
310 this->m_nc = ActualCols;
311 this->m_kc = MaxDepth;
312 #if EIGEN_MAX_STATIC_ALIGN_BYTES >= EIGEN_DEFAULT_ALIGN_BYTES
313 this->m_blockA = m_staticA;
314 this->m_blockB = m_staticB;
329 template<
int StorageOrder,
typename _LhsScalar,
typename _RhsScalar,
int MaxRows,
int MaxCols,
int MaxDepth,
int KcFactor>
332 typename conditional<StorageOrder==RowMajor,_RhsScalar,_LhsScalar>::type,
333 typename conditional<StorageOrder==RowMajor,_LhsScalar,_RhsScalar>::type>
355 computeProductBlockingSizes<LhsScalar,RhsScalar,KcFactor>(this->m_kc, this->m_mc, this->m_nc, num_threads);
360 computeProductBlockingSizes<LhsScalar,RhsScalar,KcFactor>(this->m_kc, this->m_mc,
n, num_threads);
363 m_sizeA = this->m_mc * this->m_kc;
364 m_sizeB = this->m_kc * this->m_nc;
375 computeProductBlockingSizes<LhsScalar,RhsScalar,KcFactor>(this->m_kc,
m, this->m_nc, num_threads);
376 m_sizeA = this->m_mc * this->m_kc;
377 m_sizeB = this->m_kc * this->m_nc;
382 if(this->m_blockA==0)
383 this->m_blockA = aligned_new<LhsScalar>(m_sizeA);
388 if(this->m_blockB==0)
389 this->m_blockB = aligned_new<RhsScalar>(m_sizeB);
409 template<
typename Lhs,
typename Rhs>
431 template<
typename Dst>
445 scaleAndAddTo(dst, lhs, rhs,
Scalar(1));
449 template<
typename Dst>
455 scaleAndAddTo(dst,lhs, rhs,
Scalar(1));
458 template<
typename Dst>
464 scaleAndAddTo(dst, lhs, rhs,
Scalar(-1));
467 template<
typename Dest>
470 eigen_assert(dst.rows()==a_lhs.rows() && dst.cols()==a_rhs.cols());
471 if(a_lhs.cols()==0 || a_lhs.rows()==0 || a_rhs.cols()==0)
481 else if (dst.rows() == 1)
495 Dest::MaxRowsAtCompileTime,Dest::MaxColsAtCompileTime,MaxDepthAtCompileTime> BlockingType;
504 Dest::InnerStrideAtCompileTime>,
507 BlockingType blocking(dst.rows(), dst.cols(), lhs.cols(), 1,
true);
509 (GemmFunctor(lhs, rhs, dst, actualAlpha, blocking), a_lhs.rows(), a_rhs.cols(), a_lhs.cols(), Dest::Flags&
RowMajorBit);
517 #endif // EIGEN_GENERAL_MATRIX_MATRIX_H