All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMatTSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATTSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATTSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
51 #include <blaze/math/shims/Reset.h>
77 #include <blaze/util/Assert.h>
79 #include <blaze/util/DisableIf.h>
80 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/InvalidType.h>
83 #include <blaze/util/SelectType.h>
84 #include <blaze/util/Types.h>
86 
87 
88 namespace blaze {
89 
90 //=================================================================================================
91 //
92 // CLASS DMATTSMATMULTEXPR
93 //
94 //=================================================================================================
95 
96 //*************************************************************************************************
103 template< typename MT1 // Type of the left-hand side dense matrix
104  , typename MT2 > // Type of the right-hand side sparse matrix
105 class DMatTSMatMultExpr : public DenseMatrix< DMatTSMatMultExpr<MT1,MT2>, false >
106  , private MatMatMultExpr
107  , private Computation
108 {
109  private:
110  //**Type definitions****************************************************************************
111  typedef typename MT1::ResultType RT1;
112  typedef typename MT2::ResultType RT2;
113  typedef typename RT1::ElementType ET1;
114  typedef typename RT2::ElementType ET2;
115  typedef typename MT1::CompositeType CT1;
116  typedef typename MT2::CompositeType CT2;
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
122  //**********************************************************************************************
123 
124  //**********************************************************************************************
126  enum { evaluateRight = IsComputation<MT2>::value || RequiresEvaluation<MT2>::value };
127  //**********************************************************************************************
128 
129  //**********************************************************************************************
131 
135  template< typename MT >
136  struct UseSMPAssign {
137  enum { value = ( evaluateLeft || evaluateRight ) };
138  };
140  //**********************************************************************************************
141 
142  public:
143  //**Type definitions****************************************************************************
149  typedef const ElementType ReturnType;
150  typedef const ResultType CompositeType;
151 
153  typedef typename SelectType< IsExpression<MT1>::value, const MT1, const MT1& >::Type LeftOperand;
154 
156  typedef typename SelectType< IsExpression<MT2>::value, const MT2, const MT2& >::Type RightOperand;
157 
160 
163  //**********************************************************************************************
164 
165  //**Compilation flags***************************************************************************
167  enum { vectorizable = 0 };
168 
170  enum { smpAssignable = !evaluateLeft && MT1::smpAssignable &&
171  !evaluateRight && MT2::smpAssignable };
172  //**********************************************************************************************
173 
174  //**Constructor*********************************************************************************
180  explicit inline DMatTSMatMultExpr( const MT1& lhs, const MT2& rhs )
181  : lhs_( lhs ) // Left-hand side dense matrix of the multiplication expression
182  , rhs_( rhs ) // Right-hand side sparse matrix of the multiplication expression
183  {
184  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
185  }
186  //**********************************************************************************************
187 
188  //**Access operator*****************************************************************************
195  inline ReturnType operator()( size_t i, size_t j ) const {
196  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
197  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
198 
200 
201  ElementType tmp = ElementType();
202 
203  // Early exit
204  if( lhs_.columns() == 0UL )
205  return tmp;
206 
207  // Fast computation in case the right-hand side sparse matrix directly provides iterators
209  {
210  CT2 B( rhs_ ); // Evaluation of the right-hand side sparse matrix operand
211 
212  const ConstIterator end( B.end(j) );
213  ConstIterator element( B.begin(j) );
214 
215  // Early exit in case column j is empty
216  if( element == end )
217  return tmp;
218 
219  // Calculating element (i,j)
220  tmp = lhs_(i,element->index()) * element->value();
221  ++element;
222  for( ; element!=end; ++element )
223  tmp += lhs_(i,element->index()) * element->value();
224  }
225 
226  // Default computation in case the right-hand side sparse matrix doesn't provide iterators
227  else {
228  tmp = lhs_(i,0UL) * rhs_(0UL,j);
229  for( size_t k=1UL; k<lhs_.columns(); ++k ) {
230  tmp += lhs_(i,k) * rhs_(k,j);
231  }
232  }
233 
234  return tmp;
235  }
236  //**********************************************************************************************
237 
238  //**Rows function*******************************************************************************
243  inline size_t rows() const {
244  return lhs_.rows();
245  }
246  //**********************************************************************************************
247 
248  //**Columns function****************************************************************************
253  inline size_t columns() const {
254  return rhs_.columns();
255  }
256  //**********************************************************************************************
257 
258  //**Left operand access*************************************************************************
263  inline LeftOperand leftOperand() const {
264  return lhs_;
265  }
266  //**********************************************************************************************
267 
268  //**Right operand access************************************************************************
273  inline RightOperand rightOperand() const {
274  return rhs_;
275  }
276  //**********************************************************************************************
277 
278  //**********************************************************************************************
284  template< typename T >
285  inline bool canAlias( const T* alias ) const {
286  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
287  }
288  //**********************************************************************************************
289 
290  //**********************************************************************************************
296  template< typename T >
297  inline bool isAliased( const T* alias ) const {
298  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
299  }
300  //**********************************************************************************************
301 
302  //**********************************************************************************************
307  inline bool isAligned() const {
308  return lhs_.isAligned();
309  }
310  //**********************************************************************************************
311 
312  //**********************************************************************************************
317  inline bool canSMPAssign() const {
318  return ( rows() > SMP_DMATTSMATMULT_THRESHOLD );
319  }
320  //**********************************************************************************************
321 
322  private:
323  //**Member variables****************************************************************************
326  //**********************************************************************************************
327 
328  //**Assignment to dense matrices****************************************************************
341  template< typename MT // Type of the target dense matrix
342  , bool SO > // Storage order of the target dense matrix
343  friend inline void assign( DenseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
344  {
346 
347  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
348  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
349 
350  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
351  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
352 
353  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
354  BLAZE_INTERNAL_ASSERT( A.columns() == B.rows() , "Invalid matrix sizes" );
355  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns(), "Invalid number of columns" );
356 
357  DMatTSMatMultExpr::selectAssignKernel( ~lhs, A, B );
358  }
360  //**********************************************************************************************
361 
362  //**Default assignment to dense matrices********************************************************
376  template< typename MT3 // Type of the left-hand side target matrix
377  , typename MT4 // Type of the left-hand side matrix operand
378  , typename MT5 > // Type of the right-hand side matrix operand
379  static inline void selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
380  {
381  typedef typename MT5::ConstIterator ConstIterator;
382 
383  for( size_t i=0UL; i<C.rows(); ++i ) {
384  for( size_t j=0UL; j<C.columns(); ++j )
385  {
386  ConstIterator element( B.begin(j) );
387  const ConstIterator end( B.end(j) );
388 
389  if( element == end ) {
390  reset( C(i,j) );
391  continue;
392  }
393 
394  C(i,j) = A(i,element->index()) * element->value();
395  ++element;
396  for( ; element!=end; ++element )
397  C(i,j) += A(i,element->index()) * element->value();
398  }
399  }
400  }
402  //**********************************************************************************************
403 
404  //**Assignment to sparse matrices***************************************************************
417  template< typename MT // Type of the target sparse matrix
418  , bool SO > // Storage order of the target sparse matrix
419  friend inline void assign( SparseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
420  {
422 
423  typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
424 
431 
432  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
433  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
434 
435  const TmpType tmp( serial( rhs ) );
436  assign( ~lhs, tmp );
437  }
439  //**********************************************************************************************
440 
441  //**Addition assignment to dense matrices*******************************************************
454  template< typename MT // Type of the target dense matrix
455  , bool SO > // Storage order of the target dense matrix
456  friend inline void addAssign( DenseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
457  {
459 
460  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
461  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
462 
463  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
464  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
465 
466  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
467  BLAZE_INTERNAL_ASSERT( A.columns() == B.rows() , "Invalid matrix sizes" );
468  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns(), "Invalid number of columns" );
469 
470  DMatTSMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
471  }
473  //**********************************************************************************************
474 
475  //**Default addition assignment to dense matrices***********************************************
489  template< typename MT3 // Type of the left-hand side target matrix
490  , typename MT4 // Type of the left-hand side matrix operand
491  , typename MT5 > // Type of the right-hand side matrix operand
492  static inline void selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
493  {
494  typedef typename MT5::ConstIterator ConstIterator;
495 
496  for( size_t i=0UL; i<C.rows(); ++i ) {
497  for( size_t j=0UL; j<C.columns(); ++j )
498  {
499  ConstIterator element( B.begin(j) );
500  const ConstIterator end( B.end(j) );
501 
502  for( ; element!=end; ++element )
503  C(i,j) += A(i,element->index()) * element->value();
504  }
505  }
506  }
508  //**********************************************************************************************
509 
510  //**Addition assignment to sparse matrices******************************************************
511  // No special implementation for the addition assignment to sparse matrices.
512  //**********************************************************************************************
513 
514  //**Subtraction assignment to dense matrices****************************************************
527  template< typename MT // Type of the target dense matrix
528  , bool SO > // Storage order of the target dense matrix
529  friend inline void subAssign( DenseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
530  {
532 
533  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
534  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
535 
536  LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side dense matrix operand
537  RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
538 
539  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
540  BLAZE_INTERNAL_ASSERT( A.columns() == B.rows() , "Invalid matrix sizes" );
541  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns(), "Invalid number of columns" );
542 
543  DMatTSMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
544  }
546  //**********************************************************************************************
547 
548  //**Default subtraction assignment to dense matrices***********************************************
562  template< typename MT3 // Type of the left-hand side target matrix
563  , typename MT4 // Type of the left-hand side matrix operand
564  , typename MT5 > // Type of the right-hand side matrix operand
565  static inline void selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
566  {
567  typedef typename MT5::ConstIterator ConstIterator;
568 
569  for( size_t i=0UL; i<C.rows(); ++i ) {
570  for( size_t j=0UL; j<C.columns(); ++j )
571  {
572  ConstIterator element( B.begin(j) );
573  const ConstIterator end( B.end(j) );
574 
575  for( ; element!=end; ++element )
576  C(i,j) -= A(i,element->index()) * element->value();
577  }
578  }
579  }
581  //**********************************************************************************************
582 
583  //**Subtraction assignment to sparse matrices***************************************************
584  // No special implementation for the subtraction assignment to sparse matrices.
585  //**********************************************************************************************
586 
587  //**Multiplication assignment to dense matrices*************************************************
588  // No special implementation for the multiplication assignment to dense matrices.
589  //**********************************************************************************************
590 
591  //**Multiplication assignment to sparse matrices************************************************
592  // No special implementation for the multiplication assignment to sparse matrices.
593  //**********************************************************************************************
594 
595  //**SMP assignment to dense matrices************************************************************
610  template< typename MT // Type of the target dense matrix
611  , bool SO > // Storage order of the target dense matrix
612  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
613  smpAssign( DenseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
614  {
616 
617  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
618  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
619 
620  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
621  RT B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
622 
623  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
624  BLAZE_INTERNAL_ASSERT( A.columns() == B.rows() , "Invalid matrix sizes" );
625  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns(), "Invalid number of columns" );
626 
627  smpAssign( ~lhs, A * B );
628  }
630  //**********************************************************************************************
631 
632  //**SMP assignment to sparse matrices***********************************************************
647  template< typename MT // Type of the target sparse matrix
648  , bool SO > // Storage order of the target sparse matrix
649  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
650  smpAssign( SparseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
651  {
653 
654  typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
655 
662 
663  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
664  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
665 
666  const TmpType tmp( rhs );
667  smpAssign( ~lhs, tmp );
668  }
670  //**********************************************************************************************
671 
672  //**SMP addition assignment to dense matrices***************************************************
687  template< typename MT // Type of the target dense matrix
688  , bool SO > // Storage order of the target dense matrix
689  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
690  smpAddAssign( DenseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
691  {
693 
694  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
695  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
696 
697  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
698  RT B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
699 
700  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
701  BLAZE_INTERNAL_ASSERT( A.columns() == B.rows() , "Invalid matrix sizes" );
702  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns(), "Invalid number of columns" );
703 
704  smpAddAssign( ~lhs, A * B );
705  }
707  //**********************************************************************************************
708 
709  //**SMP addition assignment to sparse matrices**************************************************
710  // No special implementation for the SMP addition assignment to sparse matrices.
711  //**********************************************************************************************
712 
713  //**SMP subtraction assignment to dense matrices************************************************
728  template< typename MT // Type of the target dense matrix
729  , bool SO > // Storage order of the target dense matrix
730  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
731  smpSubAssign( DenseMatrix<MT,SO>& lhs, const DMatTSMatMultExpr& rhs )
732  {
734 
735  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
736  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
737 
738  LT A( rhs.lhs_ ); // Evaluation of the left-hand side dense matrix operand
739  RT B( rhs.rhs_ ); // Evaluation of the right-hand side sparse matrix operand
740 
741  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
742  BLAZE_INTERNAL_ASSERT( A.columns() == B.rows() , "Invalid matrix sizes" );
743  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns(), "Invalid number of columns" );
744 
745  smpSubAssign( ~lhs, A * B );
746  }
748  //**********************************************************************************************
749 
750  //**SMP subtraction assignment to sparse matrices***********************************************
751  // No special implementation for the SMP subtraction assignment to sparse matrices.
752  //**********************************************************************************************
753 
754  //**SMP multiplication assignment to dense matrices*********************************************
755  // No special implementation for the SMP multiplication assignment to dense matrices.
756  //**********************************************************************************************
757 
758  //**SMP multiplication assignment to sparse matrices********************************************
759  // No special implementation for the SMP multiplication assignment to sparse matrices.
760  //**********************************************************************************************
761 
762  //**Compile time checks*************************************************************************
769  //**********************************************************************************************
770 };
771 //*************************************************************************************************
772 
773 
774 
775 
776 //=================================================================================================
777 //
778 // GLOBAL BINARY ARITHMETIC OPERATORS
779 //
780 //=================================================================================================
781 
782 //*************************************************************************************************
812 template< typename T1 // Type of the left-hand side dense matrix
813  , typename T2 > // Type of the right-hand side sparse matrix
814 inline const DMatTSMatMultExpr<T1,T2>
816 {
818 
819  if( (~lhs).columns() != (~rhs).rows() )
820  throw std::invalid_argument( "Matrix sizes do not match" );
821 
822  return DMatTSMatMultExpr<T1,T2>( ~lhs, ~rhs );
823 }
824 //*************************************************************************************************
825 
826 
827 
828 
829 //=================================================================================================
830 //
831 // EXPRESSION TRAIT SPECIALIZATIONS
832 //
833 //=================================================================================================
834 
835 //*************************************************************************************************
837 template< typename MT1, typename MT2, typename VT >
838 struct DMatDVecMultExprTrait< DMatTSMatMultExpr<MT1,MT2>, VT >
839 {
840  public:
841  //**********************************************************************************************
842  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
843  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
844  IsDenseVector<VT>::value && IsColumnVector<VT>::value
845  , typename DMatDVecMultExprTrait< MT1, typename TSMatDVecMultExprTrait<MT2,VT>::Type >::Type
846  , INVALID_TYPE >::Type Type;
847  //**********************************************************************************************
848 };
850 //*************************************************************************************************
851 
852 
853 //*************************************************************************************************
855 template< typename MT1, typename MT2, typename VT >
856 struct DMatSVecMultExprTrait< DMatTSMatMultExpr<MT1,MT2>, VT >
857 {
858  public:
859  //**********************************************************************************************
860  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
861  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
862  IsSparseVector<VT>::value && IsColumnVector<VT>::value
863  , typename DMatSVecMultExprTrait< MT1, typename TSMatSVecMultExprTrait<MT2,VT>::Type >::Type
864  , INVALID_TYPE >::Type Type;
865  //**********************************************************************************************
866 };
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
873 template< typename VT, typename MT1, typename MT2 >
874 struct TDVecDMatMultExprTrait< VT, DMatTSMatMultExpr<MT1,MT2> >
875 {
876  public:
877  //**********************************************************************************************
878  typedef typename SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value &&
879  IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
880  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
881  , typename TDVecTSMatMultExprTrait< typename TDVecDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
882  , INVALID_TYPE >::Type Type;
883  //**********************************************************************************************
884 };
886 //*************************************************************************************************
887 
888 
889 //*************************************************************************************************
891 template< typename VT, typename MT1, typename MT2 >
892 struct TSVecDMatMultExprTrait< VT, DMatTSMatMultExpr<MT1,MT2> >
893 {
894  public:
895  //**********************************************************************************************
896  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
897  IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
898  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
899  , typename TDVecTSMatMultExprTrait< typename TSVecDMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
900  , INVALID_TYPE >::Type Type;
901  //**********************************************************************************************
902 };
904 //*************************************************************************************************
905 
906 
907 //*************************************************************************************************
909 template< typename MT1, typename MT2, bool AF >
910 struct SubmatrixExprTrait< DMatTSMatMultExpr<MT1,MT2>, AF >
911 {
912  public:
913  //**********************************************************************************************
914  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
915  , typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
916  //**********************************************************************************************
917 };
919 //*************************************************************************************************
920 
921 
922 //*************************************************************************************************
924 template< typename MT1, typename MT2 >
925 struct RowExprTrait< DMatTSMatMultExpr<MT1,MT2> >
926 {
927  public:
928  //**********************************************************************************************
929  typedef typename MultExprTrait< typename RowExprTrait<const MT1>::Type, MT2 >::Type Type;
930  //**********************************************************************************************
931 };
933 //*************************************************************************************************
934 
935 
936 //*************************************************************************************************
938 template< typename MT1, typename MT2 >
939 struct ColumnExprTrait< DMatTSMatMultExpr<MT1,MT2> >
940 {
941  public:
942  //**********************************************************************************************
943  typedef typename MultExprTrait< MT1, typename ColumnExprTrait<const MT2>::Type >::Type Type;
944  //**********************************************************************************************
945 };
947 //*************************************************************************************************
948 
949 } // namespace blaze
950 
951 #endif
ResultType::ElementType ElementType
Resulting element type.
Definition: DMatTSMatMultExpr.h:148
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4599
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatTSMatMultExpr.h:195
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:4329
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatTSMatMultExpr.h:153
MT2::CompositeType CT2
Composite type of the right-hand side sparse matrix expression.
Definition: DMatTSMatMultExpr.h:116
const size_t SMP_DMATTSMATMULT_THRESHOLD
SMP row-major dense matrix/column-major sparse matrix multiplication threshold.This threshold specifi...
Definition: Thresholds.h:949
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatTSMatMultExpr.h:285
Header file for the IsSparseMatrix type trait.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
#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:79
Header file for the ColumnExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatTSMatMultExpr.h:147
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Header file for the IsRowVector type trait.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
Header file for the RequiresEvaluation type trait.
LeftOperand leftOperand() const
Returns the left-hand side dense matrix operand.
Definition: DMatTSMatMultExpr.h:263
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:107
Constraint on the data type.
const ResultType CompositeType
Data type for composite expression templates.
Definition: DMatTSMatMultExpr.h:150
Constraint on the data type.
Constraint on the data type.
Header file for the MultExprTrait class template.
void smpAddAssign(DenseMatrix< 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:122
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatTSMatMultExpr.h:307
DMatTSMatMultExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the DMatTSMatMultExpr class.
Definition: DMatTSMatMultExpr.h:180
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
Header file for the multiplication trait.
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatTSMatMultExpr.h:243
#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: StorageOrder.h:161
MT1::CompositeType CT1
Composite type of the left-hand side dense matrix expression.
Definition: DMatTSMatMultExpr.h:115
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
Header file for the TDVecTSMatMultExprTrait class template.
Header file for the DenseMatrix base class.
Header file for the TSMatDVecMultExprTrait class template.
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:271
RT2::ElementType ET2
Element type of the right-hand side sparse matrix expression.
Definition: DMatTSMatMultExpr.h:114
SelectType< evaluateLeft, const RT1, CT1 >::Type LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: DMatTSMatMultExpr.h:159
Header file for the DMatDVecMultExprTrait class template.
MT1::ResultType RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatTSMatMultExpr.h:111
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatTSMatMultExpr.h:146
#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:78
Constraints on the storage order of matrix types.
RT1::ElementType ET1
Element type of the left-hand side dense matrix expression.
Definition: DMatTSMatMultExpr.h:113
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: DMatTSMatMultExpr.h:325
Header file for the SelectType class template.
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 serial shim.
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
Base class for all matrix/matrix multiplication expression templates.The MatMatMultExpr class serves ...
Definition: MatMatMultExpr.h:65
Header file for the IsSparseVector type trait.
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: StorageOrder.h:81
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for run time assertion macros.
Utility type for generic codes.
Base template for the MultTrait class.
Definition: MultTrait.h:141
const ElementType ReturnType
Return type for expression template evaluations.
Definition: DMatTSMatMultExpr.h:149
MultTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DMatTSMatMultExpr.h:145
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:301
RightOperand rightOperand() const
Returns the right-hand side transpose sparse matrix operand.
Definition: DMatTSMatMultExpr.h:273
Header file for the reset shim.
SelectType< evaluateRight, const RT2, CT2 >::Type RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: DMatTSMatMultExpr.h:162
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:331
Expression object for dense matrix-transpose sparse matrix multiplications.The DMatTSMatMultExpr clas...
Definition: DMatTSMatMultExpr.h:105
Header file for the RemoveReference type trait.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatTSMatMultExpr.h:297
#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:283
Header file for the IsDenseVector type trait.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatTSMatMultExpr.h:317
LeftOperand lhs_
Left-hand side dense matrix of the multiplication expression.
Definition: DMatTSMatMultExpr.h:324
Header file for the IsRowMajorMatrix type trait.
Header file for the IsComputation type trait class.
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
Header file for the TDVecDMatMultExprTrait 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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
Header file for basic type definitions.
Header file for the TSVecDMatMultExprTrait class template.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatTSMatMultExpr.h:253
MT2::ResultType RT2
Result type of the right-hand side sparse matrix expression.
Definition: DMatTSMatMultExpr.h:112
Header file for the DMatSVecMultExprTrait class template.
Header file for the IsColumnVector 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
DMatTSMatMultExpr< MT1, MT2 > This
Type of this DMatTSMatMultExpr instance.
Definition: DMatTSMatMultExpr.h:144
#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:79
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: DMatTSMatMultExpr.h:156
Header file for the IsExpression type trait class.
Header file for the TSMatSVecMultExprTrait class template.
Header file for the FunctionTrace class.