TSMatTDMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATTDMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATTDMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
55 #include <blaze/math/Functions.h>
57 #include <blaze/math/shims/Reset.h>
97 #include <blaze/util/Assert.h>
98 #include <blaze/util/DisableIf.h>
99 #include <blaze/util/EnableIf.h>
101 #include <blaze/util/InvalidType.h>
103 #include <blaze/util/mpl/And.h>
104 #include <blaze/util/mpl/If.h>
105 #include <blaze/util/mpl/Or.h>
106 #include <blaze/util/Types.h>
107 
108 
109 namespace blaze {
110 
111 //=================================================================================================
112 //
113 // CLASS SMATDMATMULTEXPR
114 //
115 //=================================================================================================
116 
117 //*************************************************************************************************
124 template< typename MT1 // Type of the left-hand side dense matrix
125  , typename MT2 > // Type of the right-hand side sparse matrix
126 class TSMatTDMatMultExpr : public DenseMatrix< TSMatTDMatMultExpr<MT1,MT2>, true >
127  , private MatMatMultExpr
128  , private Computation
129 {
130  private:
131  //**Type definitions****************************************************************************
138  //**********************************************************************************************
139 
140  //**********************************************************************************************
142  enum : bool { evaluateLeft = IsComputation<MT1>::value || RequiresEvaluation<MT1>::value };
143  //**********************************************************************************************
144 
145  //**********************************************************************************************
147  enum : bool { evaluateRight = IsComputation<MT2>::value || RequiresEvaluation<MT2>::value };
148  //**********************************************************************************************
149 
150  //**********************************************************************************************
152 
157  template< typename T1, typename T2, typename T3 >
158  struct CanExploitSymmetry {
159  enum : bool { value = ( IsSymmetric<T2>::value || IsSymmetric<T3>::value ) };
160  };
162  //**********************************************************************************************
163 
164  //**********************************************************************************************
166 
170  template< typename T1, typename T2, typename T3 >
171  struct IsEvaluationRequired {
172  enum : bool { value = ( evaluateLeft || evaluateRight ) &&
173  !CanExploitSymmetry<T1,T2,T3>::value };
174  };
176  //**********************************************************************************************
177 
178  //**********************************************************************************************
180 
184  template< typename T1, typename T2, typename T3 >
185  struct UseOptimizedKernel {
186  enum : bool { value = useOptimizedKernels &&
187  !IsDiagonal<T3>::value &&
188  !IsResizable< ElementType_<T1> >::value &&
189  !IsResizable<ET1>::value };
190  };
192  //**********************************************************************************************
193 
194  //**********************************************************************************************
196 
199  template< typename T1, typename T2, typename T3 >
200  struct UseDefaultKernel {
201  enum : bool { value = !UseOptimizedKernel<T1,T2,T3>::value };
202  };
204  //**********************************************************************************************
205 
206  public:
207  //**Type definitions****************************************************************************
213  typedef const ElementType ReturnType;
214  typedef const ResultType CompositeType;
215 
217  typedef If_< IsExpression<MT1>, const MT1, const MT1& > LeftOperand;
218 
220  typedef If_< IsExpression<MT2>, const MT2, const MT2& > RightOperand;
221 
224 
227  //**********************************************************************************************
228 
229  //**Compilation flags***************************************************************************
231  enum : bool { simdEnabled = false };
232 
234  enum : bool { smpAssignable = !evaluateLeft && MT1::smpAssignable &&
235  !evaluateRight && MT2::smpAssignable };
236  //**********************************************************************************************
237 
238  //**Constructor*********************************************************************************
244  explicit inline TSMatTDMatMultExpr( const MT1& lhs, const MT2& rhs ) noexcept
245  : lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
246  , rhs_( rhs ) // Right-hand side dense matrix of the multiplication expression
247  {
248  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
249  }
250  //**********************************************************************************************
251 
252  //**Access operator*****************************************************************************
259  inline ReturnType operator()( size_t i, size_t j ) const {
260  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
261  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
262 
263  if( IsDiagonal<MT1>::value ) {
264  return lhs_(i,i) * rhs_(i,j);
265  }
266  else if( IsDiagonal<MT2>::value ) {
267  return lhs_(i,j) * rhs_(j,j);
268  }
270  const size_t begin( ( IsUpper<MT1>::value )
271  ?( ( IsLower<MT2>::value )
272  ?( max( ( IsStrictlyUpper<MT1>::value ? i+1UL : i )
273  , ( IsStrictlyLower<MT2>::value ? j+1UL : j ) ) )
274  :( IsStrictlyUpper<MT1>::value ? i+1UL : i ) )
275  :( ( IsLower<MT2>::value )
276  ?( IsStrictlyLower<MT2>::value ? j+1UL : j )
277  :( 0UL ) ) );
278  const size_t end( ( IsLower<MT1>::value )
279  ?( ( IsUpper<MT2>::value )
280  ?( min( ( IsStrictlyLower<MT1>::value ? i : i+1UL )
281  , ( IsStrictlyUpper<MT2>::value ? j : j+1UL ) ) )
282  :( IsStrictlyLower<MT1>::value ? i : i+1UL ) )
283  :( ( IsUpper<MT2>::value )
284  ?( IsStrictlyUpper<MT2>::value ? j : j+1UL )
285  :( lhs_.columns() ) ) );
286 
287  if( begin >= end ) return ElementType();
288 
289  const size_t n( end - begin );
290 
291  return subvector( row( lhs_, i ), begin, n ) * subvector( column( rhs_, j ), begin, n );
292  }
293  else {
294  return row( lhs_, i ) * column( rhs_, j );
295  }
296  }
297  //**********************************************************************************************
298 
299  //**At function*********************************************************************************
307  inline ReturnType at( size_t i, size_t j ) const {
308  if( i >= lhs_.rows() ) {
309  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
310  }
311  if( j >= rhs_.columns() ) {
312  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
313  }
314  return (*this)(i,j);
315  }
316  //**********************************************************************************************
317 
318  //**Rows function*******************************************************************************
323  inline size_t rows() const noexcept {
324  return lhs_.rows();
325  }
326  //**********************************************************************************************
327 
328  //**Columns function****************************************************************************
333  inline size_t columns() const noexcept {
334  return rhs_.columns();
335  }
336  //**********************************************************************************************
337 
338  //**Left operand access*************************************************************************
343  inline LeftOperand leftOperand() const noexcept {
344  return lhs_;
345  }
346  //**********************************************************************************************
347 
348  //**Right operand access************************************************************************
353  inline RightOperand rightOperand() const noexcept {
354  return rhs_;
355  }
356  //**********************************************************************************************
357 
358  //**********************************************************************************************
364  template< typename T >
365  inline bool canAlias( const T* alias ) const noexcept {
366  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
367  }
368  //**********************************************************************************************
369 
370  //**********************************************************************************************
376  template< typename T >
377  inline bool isAliased( const T* alias ) const noexcept {
378  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
379  }
380  //**********************************************************************************************
381 
382  //**********************************************************************************************
387  inline bool isAligned() const noexcept {
388  return rhs_.isAligned();
389  }
390  //**********************************************************************************************
391 
392  //**********************************************************************************************
397  inline bool canSMPAssign() const noexcept {
398  return ( rows() * columns() >= SMP_TSMATTDMATMULT_THRESHOLD );
399  }
400  //**********************************************************************************************
401 
402  private:
403  //**Member variables****************************************************************************
404  LeftOperand lhs_;
405  RightOperand rhs_;
406  //**********************************************************************************************
407 
408  //**Assignment to dense matrices****************************************************************
421  template< typename MT // Type of the target dense matrix
422  , bool SO > // Storage order of the target dense matrix
424  assign( DenseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
425  {
427 
428  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
429  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
430 
431  LT A( serial( rhs.lhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
432  RT B( serial( rhs.rhs_ ) ); // Evaluation of the left-hand side dense matrix operand
433 
434  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
435  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
436  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
437  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
438  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
439  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
440 
441  TSMatTDMatMultExpr::selectAssignKernel( ~lhs, A, B );
442  }
444  //**********************************************************************************************
445 
446  //**Assignment to dense matrices (kernel selection)*********************************************
457  template< typename MT3 // Type of the left-hand side target matrix
458  , typename MT4 // Type of the left-hand side matrix operand
459  , typename MT5 > // Type of the right-hand side matrix operand
460  static inline void selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
461  {
462  const size_t size( C.rows() * C.columns() );
463 
464  if( ( IsRowMajorMatrix<MT3>::value && size < TSMATTDMATMULT_THRESHOLD ) ||
465  ( IsColumnMajorMatrix<MT3>::value && size < 625UL ) )
466  selectSmallAssignKernel( C, A, B );
467  else
468  selectLargeAssignKernel( C, A, B );
469  }
471  //**********************************************************************************************
472 
473  //**Default assignment to dense matrices********************************************************
488  template< typename MT3 // Type of the left-hand side target matrix
489  , typename MT4 // Type of the left-hand side matrix operand
490  , typename MT5 > // Type of the right-hand side matrix operand
491  static inline void selectDefaultAssignKernel( MT3& C, const MT4& A, const MT5& B )
492  {
493  typedef ConstIterator_<MT4> ConstIterator;
494 
495  reset( C );
496 
497  if( IsDiagonal<MT5>::value )
498  {
499  for( size_t i=0UL; i<A.columns(); ++i )
500  {
501  const ConstIterator end( A.end(i) );
502  ConstIterator element( A.begin(i) );
503 
504  for( ; element!=end; ++element ) {
505  C(element->index(),i) = element->value() * B(i,i);
506  }
507  }
508  }
509  else
510  {
511  const size_t block( 64UL );
512 
513  for( size_t jj=0UL; jj<B.columns(); jj+=block )
514  {
515  const size_t jpos( ( jj+block > B.columns() )?( B.columns() ):( jj+block ) );
516 
517  for( size_t i=0UL; i<A.columns(); ++i )
518  {
519  const ConstIterator end( A.end(i) );
520  ConstIterator element( A.begin(i) );
521 
522  const size_t jbegin( ( IsUpper<MT5>::value )
523  ?( max( IsStrictlyUpper<MT5>::value ? i+1UL : i, jj ) )
524  :( jj ) );
525  const size_t jend( ( IsLower<MT5>::value )
526  ?( min( IsStrictlyLower<MT5>::value ? i : i+1UL, jpos ) )
527  :( jpos ) );
528 
529  if( jbegin >= jend )
530  continue;
531 
532  for( ; element!=end; ++element ) {
533  for( size_t j=jbegin; j<jend; ++j ) {
534  if( isDefault( C(element->index(),j) ) )
535  C(element->index(),j) = element->value() * B(i,j);
536  else
537  C(element->index(),j) += element->value() * B(i,j);
538  }
539  }
540  }
541  }
542  }
543  }
545  //**********************************************************************************************
546 
547  //**Default assignment to dense matrices (small matrices)***************************************
561  template< typename MT3 // Type of the left-hand side target matrix
562  , typename MT4 // Type of the left-hand side matrix operand
563  , typename MT5 > // Type of the right-hand side matrix operand
564  static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
565  selectSmallAssignKernel( MT3& C, const MT4& A, const MT5& B )
566  {
567  selectDefaultAssignKernel( C, A, B );
568  }
570  //**********************************************************************************************
571 
572  //**Optimized assignment to dense matrices (small matrices)*************************************
587  template< typename MT3 // Type of the left-hand side target matrix
588  , typename MT4 // Type of the left-hand side matrix operand
589  , typename MT5 > // Type of the right-hand side matrix operand
590  static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
591  selectSmallAssignKernel( MT3& C, const MT4& A, const MT5& B )
592  {
593  typedef ConstIterator_<MT4> ConstIterator;
594 
595  const size_t block( IsRowMajorMatrix<MT3>::value ? 128UL : 64UL );
596 
597  for( size_t jj=0UL; jj<B.columns(); jj+=block )
598  {
599  const size_t jpos( ( jj+block > B.columns() )?( B.columns() ):( jj+block ) );
600 
601  for( size_t i=0UL; i<A.rows(); ++i ) {
602  for( size_t j=jj; j<jpos; ++j ) {
603  reset( C(i,j) );
604  }
605  }
606 
607  for( size_t i=0UL; i<A.columns(); ++i )
608  {
609  const size_t jbegin( ( IsUpper<MT5>::value )
610  ?( max( IsStrictlyUpper<MT5>::value ? i+1UL : i, jj ) )
611  :( jj ) );
612  const size_t jend( ( IsLower<MT5>::value )
613  ?( min( IsStrictlyLower<MT5>::value ? i : i+1UL, jpos ) )
614  :( jpos ) );
615 
616  if( jbegin >= jend )
617  continue;
618 
619  const ConstIterator end( A.end(i) );
620  ConstIterator element( A.begin(i) );
621 
622  const size_t nonzeros( A.nonZeros(i) );
623  const size_t kpos( nonzeros & size_t(-4) );
624  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
625 
626  for( size_t k=0UL; k<kpos; k+=4UL )
627  {
628  const size_t i1( element->index() );
629  const ET1 v1( element->value() );
630  ++element;
631  const size_t i2( element->index() );
632  const ET1 v2( element->value() );
633  ++element;
634  const size_t i3( element->index() );
635  const ET1 v3( element->value() );
636  ++element;
637  const size_t i4( element->index() );
638  const ET1 v4( element->value() );
639  ++element;
640 
641  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
642 
643  for( size_t j=jbegin; j<jend; ++j ) {
644  C(i1,j) += v1 * B(i,j);
645  C(i2,j) += v2 * B(i,j);
646  C(i3,j) += v3 * B(i,j);
647  C(i4,j) += v4 * B(i,j);
648  }
649  }
650 
651  for( ; element!=end; ++element ) {
652  for( size_t j=jbegin; j<jend; ++j ) {
653  C(element->index(),j) += element->value() * B(i,j);
654  }
655  }
656  }
657  }
658  }
660  //**********************************************************************************************
661 
662  //**Default assignment to dense matrices (large matrices)***************************************
676  template< typename MT3 // Type of the left-hand side target matrix
677  , typename MT4 // Type of the left-hand side matrix operand
678  , typename MT5 > // Type of the right-hand side matrix operand
679  static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
680  selectLargeAssignKernel( MT3& C, const MT4& A, const MT5& B )
681  {
682  selectDefaultAssignKernel( C, A, B );
683  }
685  //**********************************************************************************************
686 
687  //**Optimized assignment to dense matrices (large matrices)*************************************
702  template< typename MT3 // Type of the left-hand side target matrix
703  , typename MT4 // Type of the left-hand side matrix operand
704  , typename MT5 > // Type of the right-hand side matrix operand
705  static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
706  selectLargeAssignKernel( MT3& C, const MT4& A, const MT5& B )
707  {
709 
710  const OppositeType_<MT4> tmp( serial( A ) );
711  assign( C, tmp * B );
712  }
714  //**********************************************************************************************
715 
716  //**Assignment to sparse matrices***************************************************************
729  template< typename MT // Type of the target sparse matrix
730  , bool SO > // Storage order of the target sparse matrix
731  friend inline DisableIf_< CanExploitSymmetry<MT,MT1,MT2> >
732  assign( SparseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
733  {
735 
736  typedef IfTrue_< SO, ResultType, OppositeType > TmpType;
737 
743  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<TmpType> );
744 
745  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
746  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
747 
748  const TmpType tmp( serial( rhs ) );
749  assign( ~lhs, tmp );
750  }
752  //**********************************************************************************************
753 
754  //**Restructuring assignment********************************************************************
769  template< typename MT // Type of the target matrix
770  , bool SO > // Storage order of the target matrix
771  friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
772  assign( Matrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
773  {
775 
777 
778  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
779  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
780 
781  if( IsSymmetric<MT1>::value && IsSymmetric<MT2>::value )
782  assign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
783  else if( IsSymmetric<MT1>::value )
784  assign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
785  else
786  assign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
787  }
789  //**********************************************************************************************
790 
791  //**Addition assignment to dense matrices*******************************************************
804  template< typename MT // Type of the target dense matrix
805  , bool SO > // Storage order of the target dense matrix
806  friend inline DisableIf_< CanExploitSymmetry<MT,MT1,MT2> >
807  addAssign( DenseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
808  {
810 
811  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
812  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
813 
814  LT A( serial( rhs.lhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
815  RT B( serial( rhs.rhs_ ) ); // Evaluation of the left-hand side dense matrix operand
816 
817  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
818  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
819  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
820  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
821  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
822  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
823 
824  TSMatTDMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
825  }
827  //**********************************************************************************************
828 
829  //**Addition assignment to dense matrices (kernel selection)************************************
840  template< typename MT3 // Type of the left-hand side target matrix
841  , typename MT4 // Type of the left-hand side matrix operand
842  , typename MT5 > // Type of the right-hand side matrix operand
843  static inline void selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
844  {
845  const size_t size( C.rows() * C.columns() );
846 
847  if( ( IsRowMajorMatrix<MT3>::value && size < TSMATTDMATMULT_THRESHOLD ) ||
848  ( IsColumnMajorMatrix<MT3>::value && size < 625UL ) )
849  selectSmallAddAssignKernel( C, A, B );
850  else
851  selectLargeAddAssignKernel( C, A, B );
852  }
854  //**********************************************************************************************
855 
856  //**Default addition assignment to dense matrices***********************************************
871  template< typename MT3 // Type of the left-hand side target matrix
872  , typename MT4 // Type of the left-hand side matrix operand
873  , typename MT5 > // Type of the right-hand side matrix operand
874  static inline void selectDefaultAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
875  {
876  typedef ConstIterator_<MT4> ConstIterator;
877 
878  if( IsDiagonal<MT5>::value )
879  {
880  for( size_t i=0UL; i<A.columns(); ++i )
881  {
882  const ConstIterator end( A.end(i) );
883  ConstIterator element( A.begin(i) );
884 
885  for( ; element!=end; ++element ) {
886  C(element->index(),i) += element->value() * B(i,i);
887  }
888  }
889  }
890  else
891  {
892  const size_t block( 64UL );
893 
894  for( size_t jj=0UL; jj<B.columns(); jj+=block )
895  {
896  const size_t jpos( ( jj+block > B.columns() )?( B.columns() ):( jj+block ) );
897 
898  for( size_t i=0UL; i<A.columns(); ++i )
899  {
900  const ConstIterator end( A.end(i) );
901  ConstIterator element( A.begin(i) );
902 
903  const size_t jbegin( ( IsUpper<MT5>::value )
904  ?( max( IsStrictlyUpper<MT5>::value ? i+1UL : i, jj ) )
905  :( jj ) );
906  const size_t jend( ( IsLower<MT5>::value )
907  ?( min( IsStrictlyLower<MT5>::value ? i : i+1UL, jpos ) )
908  :( jpos ) );
909 
910  if( jbegin >= jend )
911  continue;
912 
913  for( ; element!=end; ++element ) {
914  for( size_t j=jbegin; j<jend; ++j ) {
915  C(element->index(),j) += element->value() * B(i,j);
916  }
917  }
918  }
919  }
920  }
921  }
923  //**********************************************************************************************
924 
925  //**Default addition assignment to dense matrices (small matrices)******************************
939  template< typename MT3 // Type of the left-hand side target matrix
940  , typename MT4 // Type of the left-hand side matrix operand
941  , typename MT5 > // Type of the right-hand side matrix operand
942  static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
943  selectSmallAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
944  {
945  selectDefaultAddAssignKernel( C, A, B );
946  }
948  //**********************************************************************************************
949 
950  //**Optimized addition assignment to dense matrices (small matrices)****************************
965  template< typename MT3 // Type of the left-hand side target matrix
966  , typename MT4 // Type of the left-hand side matrix operand
967  , typename MT5 > // Type of the right-hand side matrix operand
968  static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
969  selectSmallAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
970  {
971  typedef ConstIterator_<MT4> ConstIterator;
972 
973  const size_t block( IsRowMajorMatrix<MT3>::value ? 128UL : 64UL );
974 
975  for( size_t jj=0UL; jj<B.columns(); jj+=block )
976  {
977  const size_t jpos( ( jj+block > B.columns() )?( B.columns() ):( jj+block ) );
978 
979  for( size_t i=0UL; i<A.columns(); ++i )
980  {
981  const size_t jbegin( ( IsUpper<MT5>::value )
982  ?( max( IsStrictlyUpper<MT5>::value ? i+1UL : i, jj ) )
983  :( jj ) );
984  const size_t jend( ( IsLower<MT5>::value )
985  ?( min( IsStrictlyLower<MT5>::value ? i : i+1UL, jpos ) )
986  :( jpos ) );
987 
988  if( jbegin >= jend )
989  continue;
990 
991  const ConstIterator end( A.end(i) );
992  ConstIterator element( A.begin(i) );
993 
994  const size_t nonzeros( A.nonZeros(i) );
995  const size_t kpos( nonzeros & size_t(-4) );
996  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
997 
998  for( size_t k=0UL; k<kpos; k+=4UL )
999  {
1000  const size_t i1( element->index() );
1001  const ET1 v1( element->value() );
1002  ++element;
1003  const size_t i2( element->index() );
1004  const ET1 v2( element->value() );
1005  ++element;
1006  const size_t i3( element->index() );
1007  const ET1 v3( element->value() );
1008  ++element;
1009  const size_t i4( element->index() );
1010  const ET1 v4( element->value() );
1011  ++element;
1012 
1013  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1014 
1015  for( size_t j=jbegin; j<jend; ++j ) {
1016  C(i1,j) += v1 * B(i,j);
1017  C(i2,j) += v2 * B(i,j);
1018  C(i3,j) += v3 * B(i,j);
1019  C(i4,j) += v4 * B(i,j);
1020  }
1021  }
1022 
1023  for( ; element!=end; ++element ) {
1024  for( size_t j=jbegin; j<jend; ++j ) {
1025  C(element->index(),j) += element->value() * B(i,j);
1026  }
1027  }
1028  }
1029  }
1030  }
1032  //**********************************************************************************************
1033 
1034  //**Default addition assignment to dense matrices (large matrices)******************************
1048  template< typename MT3 // Type of the left-hand side target matrix
1049  , typename MT4 // Type of the left-hand side matrix operand
1050  , typename MT5 > // Type of the right-hand side matrix operand
1051  static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
1052  selectLargeAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
1053  {
1054  selectDefaultAddAssignKernel( C, A, B );
1055  }
1057  //**********************************************************************************************
1058 
1059  //**Optimized addition assignment to dense matrices (large matrices)****************************
1074  template< typename MT3 // Type of the left-hand side target matrix
1075  , typename MT4 // Type of the left-hand side matrix operand
1076  , typename MT5 > // Type of the right-hand side matrix operand
1077  static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
1078  selectLargeAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
1079  {
1080  BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( OppositeType_<MT4> );
1081 
1082  const OppositeType_<MT4> tmp( serial( A ) );
1083  addAssign( C, tmp * B );
1084  }
1086  //**********************************************************************************************
1087 
1088  //**Restructuring addition assignment***********************************************************
1103  template< typename MT // Type of the target matrix
1104  , bool SO > // Storage order of the target matrix
1105  friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1106  addAssign( Matrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1107  {
1109 
1111 
1112  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1113  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1114 
1115  if( IsSymmetric<MT1>::value && IsSymmetric<MT2>::value )
1116  addAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1117  else if( IsSymmetric<MT1>::value )
1118  addAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1119  else
1120  addAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1121  }
1123  //**********************************************************************************************
1124 
1125  //**Addition assignment to sparse matrices******************************************************
1126  // No special implementation for the addition assignment to sparse matrices.
1127  //**********************************************************************************************
1128 
1129  //**Subtraction assignment to dense matrices****************************************************
1142  template< typename MT // Type of the target dense matrix
1143  , bool SO > // Storage order of the target dense matrix
1144  friend inline DisableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1145  subAssign( DenseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1146  {
1148 
1149  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1150  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1151 
1152  LT A( serial( rhs.lhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
1153  RT B( serial( rhs.rhs_ ) ); // Evaluation of the left-hand side dense matrix operand
1154 
1155  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1156  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1157  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1158  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1159  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1160  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1161 
1162  TSMatTDMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
1163  }
1165  //**********************************************************************************************
1166 
1167  //**Subtraction assignment to dense matrices (kernel selection)*********************************
1178  template< typename MT3 // Type of the left-hand side target matrix
1179  , typename MT4 // Type of the left-hand side matrix operand
1180  , typename MT5 > // Type of the right-hand side matrix operand
1181  static inline void selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1182  {
1183  const size_t size( C.rows() * C.columns() );
1184 
1185  if( ( IsRowMajorMatrix<MT3>::value && size < TSMATTDMATMULT_THRESHOLD ) ||
1186  ( IsColumnMajorMatrix<MT3>::value && size < 625UL ) )
1187  selectSmallSubAssignKernel( C, A, B );
1188  else
1189  selectLargeSubAssignKernel( C, A, B );
1190  }
1192  //**********************************************************************************************
1193 
1194  //**Default subtraction assignment to dense matrices********************************************
1209  template< typename MT3 // Type of the left-hand side target matrix
1210  , typename MT4 // Type of the left-hand side matrix operand
1211  , typename MT5 > // Type of the right-hand side matrix operand
1212  static inline void selectDefaultSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1213  {
1214  typedef ConstIterator_<MT4> ConstIterator;
1215 
1216  if( IsDiagonal<MT5>::value )
1217  {
1218  for( size_t i=0UL; i<A.columns(); ++i )
1219  {
1220  const ConstIterator end( A.end(i) );
1221  ConstIterator element( A.begin(i) );
1222 
1223  for( ; element!=end; ++element ) {
1224  C(element->index(),i) -= element->value() * B(i,i);
1225  }
1226  }
1227  }
1228  else
1229  {
1230  const size_t block( 64UL );
1231 
1232  for( size_t jj=0UL; jj<B.columns(); jj+=block )
1233  {
1234  const size_t jpos( ( jj+block > B.columns() )?( B.columns() ):( jj+block ) );
1235 
1236  for( size_t i=0UL; i<A.columns(); ++i )
1237  {
1238  const ConstIterator end( A.end(i) );
1239  ConstIterator element( A.begin(i) );
1240 
1241  const size_t jbegin( ( IsUpper<MT5>::value )
1242  ?( max( IsStrictlyUpper<MT5>::value ? i+1UL : i, jj ) )
1243  :( jj ) );
1244  const size_t jend( ( IsLower<MT5>::value )
1245  ?( min( IsStrictlyLower<MT5>::value ? i : i+1UL, jpos ) )
1246  :( jpos ) );
1247 
1248  if( jbegin >= jend )
1249  continue;
1250 
1251  for( ; element!=end; ++element ) {
1252  for( size_t j=jbegin; j<jend; ++j ) {
1253  C(element->index(),j) -= element->value() * B(i,j);
1254  }
1255  }
1256  }
1257  }
1258  }
1259  }
1261  //**********************************************************************************************
1262 
1263  //**Default subtraction assignment to dense matrices (small matrices)***************************
1277  template< typename MT3 // Type of the left-hand side target matrix
1278  , typename MT4 // Type of the left-hand side matrix operand
1279  , typename MT5 > // Type of the right-hand side matrix operand
1280  static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
1281  selectSmallSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1282  {
1283  selectDefaultSubAssignKernel( C, A, B );
1284  }
1286  //**********************************************************************************************
1287 
1288  //**Optimized subtraction assignment to dense matrices (small matrices)*************************
1303  template< typename MT3 // Type of the left-hand side target matrix
1304  , typename MT4 // Type of the left-hand side matrix operand
1305  , typename MT5 > // Type of the right-hand side matrix operand
1306  static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
1307  selectSmallSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1308  {
1309  typedef ConstIterator_<MT4> ConstIterator;
1310 
1311  const size_t block( IsRowMajorMatrix<MT3>::value ? 128UL : 64UL );
1312 
1313  for( size_t jj=0UL; jj<B.columns(); jj+=block )
1314  {
1315  const size_t jpos( ( jj+block > B.columns() )?( B.columns() ):( jj+block ) );
1316 
1317  for( size_t i=0UL; i<A.columns(); ++i )
1318  {
1319  const size_t jbegin( ( IsUpper<MT5>::value )
1320  ?( max( IsStrictlyUpper<MT5>::value ? i+1UL : i, jj ) )
1321  :( jj ) );
1322  const size_t jend( ( IsLower<MT5>::value )
1323  ?( min( IsStrictlyLower<MT5>::value ? i : i+1UL, jpos ) )
1324  :( jpos ) );
1325 
1326  if( jbegin >= jend )
1327  continue;
1328 
1329  const ConstIterator end( A.end(i) );
1330  ConstIterator element( A.begin(i) );
1331 
1332  const size_t nonzeros( A.nonZeros(i) );
1333  const size_t kpos( nonzeros & size_t(-4) );
1334  BLAZE_INTERNAL_ASSERT( ( nonzeros - ( nonzeros % 4UL ) ) == kpos, "Invalid end calculation" );
1335 
1336  for( size_t k=0UL; k<kpos; k+=4UL )
1337  {
1338  const size_t i1( element->index() );
1339  const ET1 v1( element->value() );
1340  ++element;
1341  const size_t i2( element->index() );
1342  const ET1 v2( element->value() );
1343  ++element;
1344  const size_t i3( element->index() );
1345  const ET1 v3( element->value() );
1346  ++element;
1347  const size_t i4( element->index() );
1348  const ET1 v4( element->value() );
1349  ++element;
1350 
1351  BLAZE_INTERNAL_ASSERT( i1 < i2 && i2 < i3 && i3 < i4, "Invalid sparse matrix index detected" );
1352 
1353  for( size_t j=jbegin; j<jend; ++j ) {
1354  C(i1,j) -= v1 * B(i,j);
1355  C(i2,j) -= v2 * B(i,j);
1356  C(i3,j) -= v3 * B(i,j);
1357  C(i4,j) -= v4 * B(i,j);
1358  }
1359  }
1360 
1361  for( ; element!=end; ++element ) {
1362  for( size_t j=jbegin; j<jend; ++j ) {
1363  C(element->index(),j) -= element->value() * B(i,j);
1364  }
1365  }
1366  }
1367  }
1368  }
1370  //**********************************************************************************************
1371 
1372  //**Default subtraction assignment to dense matrices (large matrices)***************************
1386  template< typename MT3 // Type of the left-hand side target matrix
1387  , typename MT4 // Type of the left-hand side matrix operand
1388  , typename MT5 > // Type of the right-hand side matrix operand
1389  static inline EnableIf_< UseDefaultKernel<MT3,MT4,MT5> >
1390  selectLargeSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1391  {
1392  selectDefaultSubAssignKernel( C, A, B );
1393  }
1395  //**********************************************************************************************
1396 
1397  //**Optimized subtraction assignment to dense matrices (large matrices)*************************
1412  template< typename MT3 // Type of the left-hand side target matrix
1413  , typename MT4 // Type of the left-hand side matrix operand
1414  , typename MT5 > // Type of the right-hand side matrix operand
1415  static inline EnableIf_< UseOptimizedKernel<MT3,MT4,MT5> >
1416  selectLargeSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
1417  {
1418  BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( OppositeType_<MT4> );
1419 
1420  const OppositeType_<MT4> tmp( serial( A ) );
1421  subAssign( C, tmp * B );
1422  }
1424  //**********************************************************************************************
1425 
1426  //**Restructuring subtraction assignment********************************************************
1441  template< typename MT // Type of the target matrix
1442  , bool SO > // Storage order of the target matrix
1443  friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1444  subAssign( Matrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1445  {
1447 
1449 
1450  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1451  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1452 
1453  if( IsSymmetric<MT1>::value && IsSymmetric<MT2>::value )
1454  subAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1455  else if( IsSymmetric<MT1>::value )
1456  subAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1457  else
1458  subAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1459  }
1461  //**********************************************************************************************
1462 
1463  //**Subtraction assignment to sparse matrices***************************************************
1464  // No special implementation for the subtraction assignment to sparse matrices.
1465  //**********************************************************************************************
1466 
1467  //**Multiplication assignment to dense matrices*************************************************
1468  // No special implementation for the multiplication assignment to dense matrices.
1469  //**********************************************************************************************
1470 
1471  //**Multiplication assignment to sparse matrices************************************************
1472  // No special implementation for the multiplication assignment to sparse matrices.
1473  //**********************************************************************************************
1474 
1475  //**SMP assignment to dense matrices************************************************************
1491  template< typename MT // Type of the target dense matrix
1492  , bool SO > // Storage order of the target dense matrix
1493  friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1494  smpAssign( DenseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1495  {
1497 
1498  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1499  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1500 
1501  LT A( rhs.lhs_ ); // Evaluation of the right-hand side sparse matrix operand
1502  RT B( rhs.rhs_ ); // Evaluation of the left-hand side dense matrix operand
1503 
1504  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1505  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1506  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1507  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1508  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1509  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1510 
1511  smpAssign( ~lhs, A * B );
1512  }
1514  //**********************************************************************************************
1515 
1516  //**SMP assignment to sparse matrices***********************************************************
1532  template< typename MT // Type of the target sparse matrix
1533  , bool SO > // Storage order of the target sparse matrix
1534  friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1535  smpAssign( SparseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1536  {
1538 
1539  typedef IfTrue_< SO, ResultType, OppositeType > TmpType;
1540 
1546  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<TmpType> );
1547 
1548  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1549  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1550 
1551  const TmpType tmp( rhs );
1552  smpAssign( ~lhs, tmp );
1553  }
1555  //**********************************************************************************************
1556 
1557  //**Restructuring SMP assignment****************************************************************
1572  template< typename MT // Type of the target matrix
1573  , bool SO > // Storage order of the target matrix
1574  friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1575  smpAssign( Matrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1576  {
1578 
1580 
1581  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1582  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1583 
1584  if( IsSymmetric<MT1>::value && IsSymmetric<MT2>::value )
1585  smpAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1586  else if( IsSymmetric<MT1>::value )
1587  smpAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1588  else
1589  smpAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1590  }
1592  //**********************************************************************************************
1593 
1594  //**SMP addition assignment to dense matrices***************************************************
1610  template< typename MT // Type of the target dense matrix
1611  , bool SO > // Storage order of the target dense matrix
1612  friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1613  smpAddAssign( DenseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1614  {
1616 
1617  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1618  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1619 
1620  LT A( rhs.lhs_ ); // Evaluation of the right-hand side sparse matrix operand
1621  RT B( rhs.rhs_ ); // Evaluation of the left-hand side dense matrix operand
1622 
1623  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1624  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1625  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1626  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1627  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1628  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1629 
1630  smpAddAssign( ~lhs, A * B );
1631  }
1633  //**********************************************************************************************
1634 
1635  //**Restructuring SMP addition assignment*******************************************************
1650  template< typename MT // Type of the target matrix
1651  , bool SO > // Storage order of the target matrix
1652  friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1653  smpAddAssign( Matrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1654  {
1656 
1658 
1659  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1660  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1661 
1662  if( IsSymmetric<MT1>::value && IsSymmetric<MT2>::value )
1663  smpAddAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1664  else if( IsSymmetric<MT1>::value )
1665  smpAddAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1666  else
1667  smpAddAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1668  }
1670  //**********************************************************************************************
1671 
1672  //**SMP addition assignment to sparse matrices**************************************************
1673  // No special implementation for the SMP addition assignment to sparse matrices.
1674  //**********************************************************************************************
1675 
1676  //**SMP subtraction assignment to dense matrices************************************************
1692  template< typename MT // Type of the target dense matrix
1693  , bool SO > // Storage order of the target dense matrix
1694  friend inline EnableIf_< IsEvaluationRequired<MT,MT1,MT2> >
1695  smpSubAssign( DenseMatrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1696  {
1698 
1699  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1700  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1701 
1702  LT A( rhs.lhs_ ); // Evaluation of the right-hand side sparse matrix operand
1703  RT B( rhs.rhs_ ); // Evaluation of the left-hand side dense matrix operand
1704 
1705  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
1706  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
1707  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
1708  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
1709  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
1710  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
1711 
1712  smpSubAssign( ~lhs, A * B );
1713  }
1715  //**********************************************************************************************
1716 
1717  //**Restructuring SMP subtraction assignment****************************************************
1732  template< typename MT // Type of the target matrix
1733  , bool SO > // Storage order of the target matrix
1734  friend inline EnableIf_< CanExploitSymmetry<MT,MT1,MT2> >
1735  smpSubAssign( Matrix<MT,SO>& lhs, const TSMatTDMatMultExpr& rhs )
1736  {
1738 
1740 
1741  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1742  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1743 
1744  if( IsSymmetric<MT1>::value && IsSymmetric<MT2>::value )
1745  smpSubAssign( ~lhs, trans( rhs.lhs_ ) * trans( rhs.rhs_ ) );
1746  else if( IsSymmetric<MT1>::value )
1747  smpSubAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1748  else
1749  smpSubAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1750  }
1752  //**********************************************************************************************
1753 
1754  //**SMP subtraction assignment to sparse matrices***********************************************
1755  // No special implementation for the SMP subtraction assignment to sparse matrices.
1756  //**********************************************************************************************
1757 
1758  //**SMP multiplication assignment to dense matrices*********************************************
1759  // No special implementation for the SMP multiplication assignment to dense matrices.
1760  //**********************************************************************************************
1761 
1762  //**SMP multiplication assignment to sparse matrices********************************************
1763  // No special implementation for the SMP multiplication assignment to sparse matrices.
1764  //**********************************************************************************************
1765 
1766  //**Compile time checks*************************************************************************
1774  //**********************************************************************************************
1775 };
1776 //*************************************************************************************************
1777 
1778 
1779 
1780 
1781 //=================================================================================================
1782 //
1783 // GLOBAL BINARY ARITHMETIC OPERATORS
1784 //
1785 //=================================================================================================
1786 
1787 //*************************************************************************************************
1816 template< typename T1 // Type of the left-hand side sparse matrix
1817  , typename T2 > // Type of the right-hand side dense matrix
1818 inline const TSMatTDMatMultExpr<T1,T2>
1820 {
1822 
1823  if( (~lhs).columns() != (~rhs).rows() ) {
1824  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1825  }
1826 
1827  return TSMatTDMatMultExpr<T1,T2>( ~lhs, ~rhs );
1828 }
1829 //*************************************************************************************************
1830 
1831 
1832 
1833 
1834 //=================================================================================================
1835 //
1836 // ROWS SPECIALIZATIONS
1837 //
1838 //=================================================================================================
1839 
1840 //*************************************************************************************************
1842 template< typename MT1, typename MT2 >
1843 struct Rows< TSMatTDMatMultExpr<MT1,MT2> > : public Rows<MT1>
1844 {};
1846 //*************************************************************************************************
1847 
1848 
1849 
1850 
1851 //=================================================================================================
1852 //
1853 // COLUMNS SPECIALIZATIONS
1854 //
1855 //=================================================================================================
1856 
1857 //*************************************************************************************************
1859 template< typename MT1, typename MT2 >
1860 struct Columns< TSMatTDMatMultExpr<MT1,MT2> > : public Columns<MT2>
1861 {};
1863 //*************************************************************************************************
1864 
1865 
1866 
1867 
1868 //=================================================================================================
1869 //
1870 // ISALIGNED SPECIALIZATIONS
1871 //
1872 //=================================================================================================
1873 
1874 //*************************************************************************************************
1876 template< typename MT1, typename MT2 >
1877 struct IsAligned< TSMatTDMatMultExpr<MT1,MT2> >
1878  : public BoolConstant< IsAligned<MT2>::value >
1879 {};
1881 //*************************************************************************************************
1882 
1883 
1884 
1885 
1886 //=================================================================================================
1887 //
1888 // ISLOWER SPECIALIZATIONS
1889 //
1890 //=================================================================================================
1891 
1892 //*************************************************************************************************
1894 template< typename MT1, typename MT2 >
1895 struct IsLower< TSMatTDMatMultExpr<MT1,MT2> >
1896  : public BoolConstant< And< IsLower<MT1>, IsLower<MT2> >::value >
1897 {};
1899 //*************************************************************************************************
1900 
1901 
1902 
1903 
1904 //=================================================================================================
1905 //
1906 // ISUNILOWER SPECIALIZATIONS
1907 //
1908 //=================================================================================================
1909 
1910 //*************************************************************************************************
1912 template< typename MT1, typename MT2 >
1913 struct IsUniLower< TSMatTDMatMultExpr<MT1,MT2> >
1914  : public BoolConstant< And< IsUniLower<MT1>, IsUniLower<MT2> >::value >
1915 {};
1917 //*************************************************************************************************
1918 
1919 
1920 
1921 
1922 //=================================================================================================
1923 //
1924 // ISSTRICTLYLOWER SPECIALIZATIONS
1925 //
1926 //=================================================================================================
1927 
1928 //*************************************************************************************************
1930 template< typename MT1, typename MT2 >
1931 struct IsStrictlyLower< TSMatTDMatMultExpr<MT1,MT2> >
1932  : public BoolConstant< Or< And< IsStrictlyLower<MT1>, IsLower<MT2> >
1933  , And< IsStrictlyLower<MT2>, IsLower<MT1> > >::value >
1934 {};
1936 //*************************************************************************************************
1937 
1938 
1939 
1940 
1941 //=================================================================================================
1942 //
1943 // ISUPPER SPECIALIZATIONS
1944 //
1945 //=================================================================================================
1946 
1947 //*************************************************************************************************
1949 template< typename MT1, typename MT2 >
1950 struct IsUpper< TSMatTDMatMultExpr<MT1,MT2> >
1951  : public BoolConstant< And< IsUpper<MT1>, IsUpper<MT2> >::value >
1952 {};
1954 //*************************************************************************************************
1955 
1956 
1957 
1958 
1959 //=================================================================================================
1960 //
1961 // ISUNIUPPER SPECIALIZATIONS
1962 //
1963 //=================================================================================================
1964 
1965 //*************************************************************************************************
1967 template< typename MT1, typename MT2 >
1968 struct IsUniUpper< TSMatTDMatMultExpr<MT1,MT2> >
1969  : public BoolConstant< And< IsUniUpper<MT1>, IsUniUpper<MT2> >::value >
1970 {};
1972 //*************************************************************************************************
1973 
1974 
1975 
1976 
1977 //=================================================================================================
1978 //
1979 // ISSTRICTLYUPPER SPECIALIZATIONS
1980 //
1981 //=================================================================================================
1982 
1983 //*************************************************************************************************
1985 template< typename MT1, typename MT2 >
1986 struct IsStrictlyUpper< TSMatTDMatMultExpr<MT1,MT2> >
1987  : public BoolConstant< Or< And< IsStrictlyUpper<MT1>, IsUpper<MT2> >
1988  , And< IsStrictlyUpper<MT2>, IsUpper<MT1> > >::value >
1989 {};
1991 //*************************************************************************************************
1992 
1993 
1994 
1995 
1996 //=================================================================================================
1997 //
1998 // EXPRESSION TRAIT SPECIALIZATIONS
1999 //
2000 //=================================================================================================
2001 
2002 //*************************************************************************************************
2004 template< typename MT1, typename MT2, typename VT >
2005 struct TDMatDVecMultExprTrait< TSMatTDMatMultExpr<MT1,MT2>, VT >
2006 {
2007  public:
2008  //**********************************************************************************************
2009  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2010  , IsDenseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2011  , IsDenseVector<VT>, IsColumnVector<VT> >
2012  , TSMatDVecMultExprTrait_< MT1, TDMatDVecMultExprTrait_<MT2,VT> >
2013  , INVALID_TYPE >;
2014  //**********************************************************************************************
2015 };
2017 //*************************************************************************************************
2018 
2019 
2020 //*************************************************************************************************
2022 template< typename MT1, typename MT2, typename VT >
2023 struct TDMatSVecMultExprTrait< TSMatTDMatMultExpr<MT1,MT2>, VT >
2024 {
2025  public:
2026  //**********************************************************************************************
2027  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2028  , IsDenseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2029  , IsSparseVector<VT>, IsColumnVector<VT> >
2030  , TSMatDVecMultExprTrait_< MT1, TDMatSVecMultExprTrait_<MT2,VT> >
2031  , INVALID_TYPE >;
2032  //**********************************************************************************************
2033 };
2035 //*************************************************************************************************
2036 
2037 
2038 //*************************************************************************************************
2040 template< typename VT, typename MT1, typename MT2 >
2041 struct TDVecTDMatMultExprTrait< VT, TSMatTDMatMultExpr<MT1,MT2> >
2042 {
2043  public:
2044  //**********************************************************************************************
2045  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT>
2046  , IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2047  , IsDenseMatrix<MT2>, IsColumnMajorMatrix<MT2> >
2048  , TDVecTDMatMultExprTrait_< TDVecTSMatMultExprTrait_<VT,MT1>, MT2 >
2049  , INVALID_TYPE >;
2050  //**********************************************************************************************
2051 };
2053 //*************************************************************************************************
2054 
2055 
2056 //*************************************************************************************************
2058 template< typename VT, typename MT1, typename MT2 >
2059 struct TSVecTDMatMultExprTrait< VT, TSMatTDMatMultExpr<MT1,MT2> >
2060 {
2061  public:
2062  //**********************************************************************************************
2063  using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT>
2064  , IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2065  , IsDenseMatrix<MT2>, IsColumnMajorMatrix<MT2> >
2066  , TSVecTDMatMultExprTrait_< TSVecTSMatMultExprTrait_<VT,MT1>, MT2 >
2067  , INVALID_TYPE >;
2068  //**********************************************************************************************
2069 };
2071 //*************************************************************************************************
2072 
2073 
2074 //*************************************************************************************************
2076 template< typename MT1, typename MT2, bool AF >
2077 struct SubmatrixExprTrait< TSMatTDMatMultExpr<MT1,MT2>, AF >
2078 {
2079  public:
2080  //**********************************************************************************************
2081  using Type = MultExprTrait_< SubmatrixExprTrait_<const MT1,AF>
2082  , SubmatrixExprTrait_<const MT2,AF> >;
2083  //**********************************************************************************************
2084 };
2086 //*************************************************************************************************
2087 
2088 
2089 //*************************************************************************************************
2091 template< typename MT1, typename MT2 >
2092 struct RowExprTrait< TSMatTDMatMultExpr<MT1,MT2> >
2093 {
2094  public:
2095  //**********************************************************************************************
2096  using Type = MultExprTrait_< RowExprTrait_<const MT1>, MT2 >;
2097  //**********************************************************************************************
2098 };
2100 //*************************************************************************************************
2101 
2102 
2103 //*************************************************************************************************
2105 template< typename MT1, typename MT2 >
2106 struct ColumnExprTrait< TSMatTDMatMultExpr<MT1,MT2> >
2107 {
2108  public:
2109  //**********************************************************************************************
2110  using Type = MultExprTrait_< MT1, ColumnExprTrait_<const MT2> >;
2111  //**********************************************************************************************
2112 };
2114 //*************************************************************************************************
2115 
2116 } // namespace blaze
2117 
2118 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatTDMatMultExpr.h:211
Header file for auxiliary alias declarations.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
Header file for mathematical functions.
constexpr bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
ElementType_< ResultType > ElementType
Resulting element type.
Definition: TSMatTDMatMultExpr.h:212
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TSMatTDMatMultExpr.h:307
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
If_< IsExpression< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTDMatMultExpr.h:217
Compile time check for triangular matrix types.This type trait tests whether or not the given templat...
Definition: IsTriangular.h:87
Header file for basic type definitions.
Expression object for transpose sparse matrix-transpose dense matrix multiplications.The TSMatTDMatMultExpr class represents the compile time expression for multiplications between a column-major sparse matrix and a column-major dense matrix.
Definition: Forward.h:146
IfTrue_< evaluateLeft, const RT1, CT1 > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: TSMatTDMatMultExpr.h:223
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseMatrix type trait.
Header file for the serial shim.
Header file for the IsDiagonal type trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
Header file for the ColumnExprTrait class template.
TSMatTDMatMultExpr< MT1, MT2 > This
Type of this TSMatTDMatMultExpr instance.
Definition: TSMatTDMatMultExpr.h:208
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Header file for the IsColumnMajorMatrix type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
Header file for the TSVecTSMatMultExprTrait class template.
Header file for the IsRowVector type trait.
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TSMatTDMatMultExpr.h:333
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
IfTrue_< evaluateRight, const RT2, CT2 > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: TSMatTDMatMultExpr.h:226
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
System settings for performance optimizations.
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatTDMatMultExpr.h:210
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1716
If_< IsExpression< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: TSMatTDMatMultExpr.h:220
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatTDMatMultExpr.h:365
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
CompositeType_< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTDMatMultExpr.h:136
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
TSMatTDMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TSMatTDMatMultExpr class.
Definition: TSMatTDMatMultExpr.h:244
Constraint on the data type.
Constraint on the data type.
Header file for the MultExprTrait class template.
ElementType_< RT1 > ET1
Element type of the left-hand side dense matrix expression.
Definition: TSMatTDMatMultExpr.h:134
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
SubvectorExprTrait_< VT, unaligned > subvector(Vector< VT, TF > &vector, size_t index, size_t size)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:152
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
RightOperand rightOperand() const noexcept
Returns the right-hand side transpose dense matrix operand.
Definition: TSMatTDMatMultExpr.h:353
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Compile time check for row-major matrix types.This type trait tests whether or not the given template...
Definition: IsRowMajorMatrix.h:83
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
Header file for the TSVecTDMatMultExprTrait class template.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatTDMatMultExpr.h:377
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Header file for the Or class template.
Header file for the TDMatSVecMultExprTrait class template.
Header file for the TDVecTSMatMultExprTrait class template.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
Header file for the TSMatDVecMultExprTrait class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatTDMatMultExpr.h:343
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for the IsLower type trait.
RightOperand rhs_
Right-hand side dense matrix of the multiplication expression.
Definition: TSMatTDMatMultExpr.h:405
Header file for the IsAligned type trait.
ResultType_< MT2 > RT2
Result type of the right-hand side dense matrix expression.
Definition: TSMatTDMatMultExpr.h:133
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:90
ElementType_< RT2 > ET2
Element type of the right-hand side sparse matrix expression.
Definition: TSMatTDMatMultExpr.h:135
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatTDMatMultExpr.h:397
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
Header file for the IsTriangular type trait.
Constraints on the storage order of matrix types.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatTDMatMultExpr.h:213
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Header file for the IsDenseMatrix type trait.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/matrix ...
Definition: MatMatMultExpr.h:109
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatTDMatMultExpr.h:404
ResultType_< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatTDMatMultExpr.h:132
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatTDMatMultExpr.h:214
Header file for the IsSparseVector type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
Header file for the SubmatrixExprTrait class template.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TSMatTDMatMultExpr.h:387
MultTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TSMatTDMatMultExpr.h:209
Header file for run time assertion macros.
Compile time check for column-major matrix types.This type trait tests whether or not the given templ...
Definition: IsColumnMajorMatrix.h:83
Utility type for generic codes.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
Header file for the reset shim.
Header file for the isDefault shim.
Constraints on the storage order of matrix types.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
CompositeType_< MT2 > CT2
Composite type of the right-hand side dense matrix expression.
Definition: TSMatTDMatMultExpr.h:137
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
#define BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.In case either of the two given data types T1 or T2 is not a matrix type ...
Definition: StorageOrder.h:84
Header file for the IsDenseVector type trait.
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
Header file for the IsRowMajorMatrix type trait.
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
Header file for the IsComputation type trait class.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatTDMatMultExpr.h:259
Header file for the TDMatDVecMultExprTrait class template.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
Header file for the IntegralConstant class template.
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsUpper type trait.
Header file for the IsColumnVector type trait.
Constraint on the data type.
Header file for the IsResizable type trait.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TDVecTDMatMultExprTrait class template.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TSMatTDMatMultExpr.h:323
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.