All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SMatTSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATTSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATTSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
75 #include <blaze/util/Assert.h>
76 #include <blaze/util/InvalidType.h>
78 #include <blaze/util/SelectType.h>
79 #include <blaze/util/Types.h>
81 #include <blaze/util/Unused.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS SMATTSMATMULTEXPR
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< typename MT1 // Type of the left-hand side sparse matrix
100  , typename MT2 > // Type of the right-hand side sparse matrix
101 class SMatTSMatMultExpr : public SparseMatrix< SMatTSMatMultExpr<MT1,MT2>, false >
102  , private MatMatMultExpr
103  , private Computation
104 {
105  private:
106  //**Type definitions****************************************************************************
107  typedef typename MT1::ResultType RT1;
108  typedef typename MT2::ResultType RT2;
109  typedef typename MT1::CompositeType CT1;
110  typedef typename MT2::CompositeType CT2;
111  //**********************************************************************************************
112 
113  public:
114  //**Type definitions****************************************************************************
120  typedef const ElementType ReturnType;
121  typedef const ResultType CompositeType;
122 
124  typedef typename SelectType< IsExpression<MT1>::value, const MT1, const MT1& >::Type LeftOperand;
125 
127  typedef typename SelectType< IsExpression<MT2>::value, const MT2, const MT2& >::Type RightOperand;
128  //**********************************************************************************************
129 
130  //**Compilation flags***************************************************************************
132  enum { smpAssignable = 0 };
133  //**********************************************************************************************
134 
135  //**Constructor*********************************************************************************
141  explicit inline SMatTSMatMultExpr( const MT1& lhs, const MT2& rhs )
142  : lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
143  , rhs_( rhs ) // Right-hand side sparse matrix of the multiplication expression
144  {
145  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
146  }
147  //**********************************************************************************************
148 
149  //**Access operator*****************************************************************************
156  inline ReturnType operator()( size_t i, size_t j ) const {
157  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
158  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
159 
160  typedef typename RemoveReference<CT1>::Type::ConstIterator LeftIterator;
161  typedef typename RemoveReference<CT2>::Type::ConstIterator RightIterator;
162 
163  ElementType tmp = ElementType();
164 
165  // Early exit
166  if( lhs_.columns() == 0UL )
167  return tmp;
168 
169  // Fast computation in case both the left-hand side and the right-hand side
170  // sparse matrices directly provide iterators
172  {
173  // Evaluation of the left-hand side sparse matrix operand
174  CT1 A( lhs_ );
175 
176  const LeftIterator lend( A.end(i) );
177  LeftIterator lelem( A.begin(i) );
178 
179  // Evaluation of the right-hand side sparse matrix operand
180  CT2 B( rhs_ );
181 
182  const RightIterator rend( B.end(j) );
183  RightIterator relem( B.begin(j) );
184 
185  // Early exit in case row i or column j are empty
186  if( lelem == lend || relem == rend )
187  return tmp;
188 
189  // Calculating element (i,j)
190  while( true ) {
191  if( lelem->index() < relem->index() ) {
192  ++lelem;
193  if( lelem == lend ) break;
194  }
195  else if( relem->index() < lelem->index() ) {
196  ++relem;
197  if( relem == rend ) break;
198  }
199  else {
200  tmp = lelem->value() * relem->value();
201  ++lelem;
202  ++relem;
203  break;
204  }
205  }
206 
207  if( lelem != lend && relem != rend )
208  {
209  while( true ) {
210  if( lelem->index() < relem->index() ) {
211  ++lelem;
212  if( lelem == lend ) break;
213  }
214  else if( relem->index() < lelem->index() ) {
215  ++relem;
216  if( relem == rend ) break;
217  }
218  else {
219  tmp += lelem->value() * relem->value();
220  ++lelem;
221  if( lelem == lend ) break;
222  ++relem;
223  if( relem == rend ) break;
224  }
225  }
226  }
227  }
228 
229  // Optimized computation in case the left-hand side sparse matrix directly provides iterators
231  {
232  // Evaluation of the left-hand side sparse matrix operand
233  CT1 A( lhs_ );
234 
235  const LeftIterator end( A.end(i) );
236  LeftIterator element( A.begin(i) );
237 
238  // Early exit in case row i is empty
239  if( element == end )
240  return tmp;
241 
242  // Calculating element (i,j)
243  tmp = element->value() * rhs_(element->index(),j);
244  ++element;
245  for( ; element!=end; ++element )
246  tmp += element->value() * rhs_(element->index(),j);
247  }
248 
249  // Optimized computation in case the right-hand side sparse matrix directly provides iterators
251  {
252  // Evaluation of the right-hand side sparse matrix operand
253  CT2 B( rhs_ );
254 
255  const RightIterator end( B.end(j) );
256  RightIterator element( B.begin(j) );
257 
258  // Early exit in case row i is empty
259  if( element == end )
260  return tmp;
261 
262  // Calculating element (i,j)
263  tmp = lhs_(i,element->index()) * element->value();
264  ++element;
265  for( ; element!=end; ++element )
266  tmp += lhs_(i,element->index()) * element->value();
267  }
268 
269  // Default computation in case both sparse matrices don't provide iterators
270  else {
271  tmp = lhs_(i,0UL) * rhs_(0UL,j);
272  for( size_t k=1UL; k<lhs_.columns(); ++k ) {
273  tmp += lhs_(i,k) * rhs_(k,j);
274  }
275  }
276 
277  return tmp;
278  }
279  //**********************************************************************************************
280 
281  //**Rows function*******************************************************************************
286  inline size_t rows() const {
287  return lhs_.rows();
288  }
289  //**********************************************************************************************
290 
291  //**Columns function****************************************************************************
296  inline size_t columns() const {
297  return rhs_.columns();
298  }
299  //**********************************************************************************************
300 
301  //**NonZeros function***************************************************************************
306  inline size_t nonZeros() const {
307  return 0UL;
308  }
309  //**********************************************************************************************
310 
311  //**NonZeros function***************************************************************************
317  inline size_t nonZeros( size_t i ) const {
318  UNUSED_PARAMETER( i );
319  return 0UL;
320  }
321  //**********************************************************************************************
322 
323  //**Left operand access*************************************************************************
328  inline LeftOperand leftOperand() const {
329  return lhs_;
330  }
331  //**********************************************************************************************
332 
333  //**Right operand access************************************************************************
338  inline RightOperand rightOperand() const {
339  return rhs_;
340  }
341  //**********************************************************************************************
342 
343  //**********************************************************************************************
349  template< typename T >
350  inline bool canAlias( const T* alias ) const {
351  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
352  }
353  //**********************************************************************************************
354 
355  //**********************************************************************************************
361  template< typename T >
362  inline bool isAliased( const T* alias ) const {
363  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
364  }
365  //**********************************************************************************************
366 
367  //**********************************************************************************************
372  inline bool canSMPAssign() const {
373  return ( rows() > SMP_SMATTSMATMULT_THRESHOLD );
374  }
375  //**********************************************************************************************
376 
377  private:
378  //**Member variables****************************************************************************
381  //**********************************************************************************************
382 
383  //**Assignment to row-major dense matrices******************************************************
396  template< typename MT > // Type of the target dense matrix
397  friend inline void assign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
398  {
400 
401  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
402  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
403 
405 
406  const typename MT2::OppositeType tmp( serial( rhs.rhs_ ) );
407  assign( ~lhs, rhs.lhs_ * tmp );
408  }
410  //**********************************************************************************************
411 
412  //**Assignment to column-major dense matrices***************************************************
425  template< typename MT > // Type of the target dense matrix
426  friend inline void assign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
427  {
429 
430  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
431  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
432 
434 
435  const typename MT1::OppositeType tmp( serial( rhs.lhs_ ) );
436  assign( ~lhs, tmp * rhs.rhs_ );
437  }
439  //**********************************************************************************************
440 
441  //**Assignment to row-major sparse matrices*****************************************************
454  template< typename MT > // Type of the target sparse matrix
455  friend inline void assign( SparseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
456  {
458 
459  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
460  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
461 
463 
464  const typename MT2::OppositeType tmp( serial( rhs.rhs_ ) );
465  assign( ~lhs, rhs.lhs_ * tmp );
466  }
468  //**********************************************************************************************
469 
470  //**Assignment to column-major sparse matrices**************************************************
483  template< typename MT > // Type of the target sparse matrix
484  friend inline void assign( SparseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
485  {
487 
488  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
489  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
490 
492 
493  const typename MT1::OppositeType tmp( serial( rhs.lhs_ ) );
494  assign( ~lhs, tmp * rhs.rhs_ );
495  }
497  //**********************************************************************************************
498 
499  //**Addition assignment to row-major dense matrices*********************************************
512  template< typename MT > // Type of the target dense matrix
513  friend inline void addAssign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
514  {
516 
517  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
518  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
519 
521 
522  const typename MT2::OppositeType tmp( serial( rhs.rhs_ ) );
523  addAssign( ~lhs, rhs.lhs_ * tmp );
524  }
526  //**********************************************************************************************
527 
528  //**Addition assignment to column-major dense matrices******************************************
541  template< typename MT > // Type of the target dense matrix
542  friend inline void addAssign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
543  {
545 
546  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
547  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
548 
550 
551  const typename MT1::OppositeType tmp( serial( rhs.lhs_ ) );
552  addAssign( ~lhs, tmp * rhs.rhs_ );
553  }
555  //**********************************************************************************************
556 
557  //**Addition assignment to sparse matrices******************************************************
558  // No special implementation for the addition assignment to sparse matrices.
559  //**********************************************************************************************
560 
561  //**Subtraction assignment to row-major dense matrices******************************************
574  template< typename MT > // Type of the target dense matrix
575  friend inline void subAssign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
576  {
578 
579  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
580  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
581 
583 
584  const typename MT2::OppositeType tmp( serial( rhs.rhs_ ) );
585  subAssign( ~lhs, rhs.lhs_ * tmp );
586  }
588  //**********************************************************************************************
589 
590  //**Subtraction assignment to column-major dense matrices***************************************
603  template< typename MT > // Type of the target dense matrix
604  friend inline void subAssign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
605  {
607 
608  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
609  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
610 
612 
613  const typename MT1::OppositeType tmp( serial( rhs.lhs_ ) );
614  subAssign( ~lhs, tmp * rhs.rhs_ );
615  }
617  //**********************************************************************************************
618 
619  //**Subtraction assignment to sparse matrices***************************************************
620  // No special implementation for the subtraction assignment to sparse matrices.
621  //**********************************************************************************************
622 
623  //**Multiplication assignment to dense matrices*************************************************
624  // No special implementation for the multiplication assignment to dense matrices.
625  //**********************************************************************************************
626 
627  //**Multiplication assignment to sparse matrices************************************************
628  // No special implementation for the multiplication assignment to sparse matrices.
629  //**********************************************************************************************
630 
631  //**SMP assignment to row-major dense matrices**************************************************
644  template< typename MT > // Type of the target dense matrix
645  friend inline void smpAssign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
646  {
648 
649  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
650  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
651 
653 
654  const typename MT2::OppositeType tmp( rhs.rhs_ );
655  smpAssign( ~lhs, rhs.lhs_ * tmp );
656  }
658  //**********************************************************************************************
659 
660  //**SMP assignment to column-major dense matrices***********************************************
673  template< typename MT > // Type of the target dense matrix
674  friend inline void smpAssign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
675  {
677 
678  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
679  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
680 
682 
683  const typename MT1::OppositeType tmp( rhs.lhs_ );
684  smpAssign( ~lhs, tmp * rhs.rhs_ );
685  }
687  //**********************************************************************************************
688 
689  //**SMP assignment to row-major sparse matrices*************************************************
702  template< typename MT > // Type of the target sparse matrix
703  friend inline void smpAssign( SparseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
704  {
706 
707  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
708  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
709 
711 
712  const typename MT2::OppositeType tmp( rhs.rhs_ );
713  smpAssign( ~lhs, rhs.lhs_ * tmp );
714  }
716  //**********************************************************************************************
717 
718  //**SMP assignment to column-major sparse matrices**********************************************
731  template< typename MT > // Type of the target sparse matrix
732  friend inline void smpAssign( SparseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
733  {
735 
736  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
737  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
738 
740 
741  const typename MT1::OppositeType tmp( rhs.lhs_ );
742  smpAssign( ~lhs, tmp * rhs.rhs_ );
743  }
745  //**********************************************************************************************
746 
747  //**SMP addition assignment to row-major dense matrices*****************************************
760  template< typename MT > // Type of the target dense matrix
761  friend inline void smpAddAssign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
762  {
764 
765  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
766  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
767 
769 
770  const typename MT2::OppositeType tmp( rhs.rhs_ );
771  smpAddAssign( ~lhs, rhs.lhs_ * tmp );
772  }
774  //**********************************************************************************************
775 
776  //**SMP addition assignment to column-major dense matrices**************************************
789  template< typename MT > // Type of the target dense matrix
790  friend inline void smpAddAssign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
791  {
793 
794  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
795  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
796 
798 
799  const typename MT1::OppositeType tmp( rhs.lhs_ );
800  smpAddAssign( ~lhs, tmp * rhs.rhs_ );
801  }
803  //**********************************************************************************************
804 
805  //**SMP addition assignment to sparse matrices**************************************************
806  // No special implementation for the SMP addition assignment to sparse matrices.
807  //**********************************************************************************************
808 
809  //**SMP subtraction assignment to row-major dense matrices**************************************
822  template< typename MT > // Type of the target dense matrix
823  friend inline void smpSubAssign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
824  {
826 
827  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
828  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
829 
831 
832  const typename MT2::OppositeType tmp( rhs.rhs_ );
833  smpSubAssign( ~lhs, rhs.lhs_ * tmp );
834  }
836  //**********************************************************************************************
837 
838  //**SMP subtraction assignment to column-major dense matrices***********************************
851  template< typename MT > // Type of the target dense matrix
852  friend inline void smpSubAssign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
853  {
855 
856  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
857  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
858 
860 
861  const typename MT1::OppositeType tmp( rhs.lhs_ );
862  smpSubAssign( ~lhs, tmp * rhs.rhs_ );
863  }
865  //**********************************************************************************************
866 
867  //**SMP subtraction assignment to sparse matrices***********************************************
868  // No special implementation for the SMP subtraction assignment to sparse matrices.
869  //**********************************************************************************************
870 
871  //**SMP multiplication assignment to dense matrices*********************************************
872  // No special implementation for the SMP multiplication assignment to dense matrices.
873  //**********************************************************************************************
874 
875  //**SMP multiplication assignment to sparse matrices********************************************
876  // No special implementation for the SMP multiplication assignment to sparse matrices.
877  //**********************************************************************************************
878 
879  //**Compile time checks*************************************************************************
886  //**********************************************************************************************
887 };
888 //*************************************************************************************************
889 
890 
891 
892 
893 //=================================================================================================
894 //
895 // GLOBAL BINARY ARITHMETIC OPERATORS
896 //
897 //=================================================================================================
898 
899 //*************************************************************************************************
929 template< typename T1 // Type of the left-hand side sparse matrix
930  , typename T2 > // Type of the right-hand side sparse matrix
931 inline const SMatTSMatMultExpr<T1,T2>
933 {
935 
936  if( (~lhs).columns() != (~rhs).rows() )
937  throw std::invalid_argument( "Matrix sizes do not match" );
938 
939  return SMatTSMatMultExpr<T1,T2>( ~lhs, ~rhs );
940 }
941 //*************************************************************************************************
942 
943 
944 
945 
946 //=================================================================================================
947 //
948 // EXPRESSION TRAIT SPECIALIZATIONS
949 //
950 //=================================================================================================
951 
952 //*************************************************************************************************
954 template< typename MT1, typename MT2, typename VT >
955 struct SMatDVecMultExprTrait< SMatTSMatMultExpr<MT1,MT2>, VT >
956 {
957  public:
958  //**********************************************************************************************
959  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
960  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
961  IsDenseVector<VT>::value && IsColumnVector<VT>::value
962  , typename SMatDVecMultExprTrait< MT1, typename TSMatDVecMultExprTrait<MT2,VT>::Type >::Type
963  , INVALID_TYPE >::Type Type;
964  //**********************************************************************************************
965 };
967 //*************************************************************************************************
968 
969 
970 //*************************************************************************************************
972 template< typename MT1, typename MT2, typename VT >
973 struct SMatSVecMultExprTrait< SMatTSMatMultExpr<MT1,MT2>, VT >
974 {
975  public:
976  //**********************************************************************************************
977  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
978  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
979  IsSparseVector<VT>::value && IsColumnVector<VT>::value
980  , typename SMatSVecMultExprTrait< MT1, typename TSMatSVecMultExprTrait<MT2,VT>::Type >::Type
981  , INVALID_TYPE >::Type Type;
982  //**********************************************************************************************
983 };
985 //*************************************************************************************************
986 
987 
988 //*************************************************************************************************
990 template< typename VT, typename MT1, typename MT2 >
991 struct TDVecSMatMultExprTrait< VT, SMatTSMatMultExpr<MT1,MT2> >
992 {
993  public:
994  //**********************************************************************************************
995  typedef typename SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value &&
996  IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
997  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
998  , typename TDVecTSMatMultExprTrait< typename TDVecSMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
999  , INVALID_TYPE >::Type Type;
1000  //**********************************************************************************************
1001 };
1003 //*************************************************************************************************
1004 
1005 
1006 //*************************************************************************************************
1008 template< typename VT, typename MT1, typename MT2 >
1009 struct TSVecSMatMultExprTrait< VT, SMatTSMatMultExpr<MT1,MT2> >
1010 {
1011  public:
1012  //**********************************************************************************************
1013  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1014  IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1015  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
1016  , typename TDVecTSMatMultExprTrait< typename TDVecSMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
1017  , INVALID_TYPE >::Type Type;
1018  //**********************************************************************************************
1019 };
1021 //*************************************************************************************************
1022 
1023 
1024 //*************************************************************************************************
1026 template< typename MT1, typename MT2, bool AF >
1027 struct SubmatrixExprTrait< SMatTSMatMultExpr<MT1,MT2>, AF >
1028 {
1029  public:
1030  //**********************************************************************************************
1031  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
1032  , typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
1033  //**********************************************************************************************
1034 };
1036 //*************************************************************************************************
1037 
1038 
1039 //*************************************************************************************************
1041 template< typename MT1, typename MT2 >
1042 struct RowExprTrait< SMatTSMatMultExpr<MT1,MT2> >
1043 {
1044  public:
1045  //**********************************************************************************************
1046  typedef typename MultExprTrait< typename RowExprTrait<const MT1>::Type, MT2 >::Type Type;
1047  //**********************************************************************************************
1048 };
1050 //*************************************************************************************************
1051 
1052 
1053 //*************************************************************************************************
1055 template< typename MT1, typename MT2 >
1056 struct ColumnExprTrait< SMatTSMatMultExpr<MT1,MT2> >
1057 {
1058  public:
1059  //**********************************************************************************************
1060  typedef typename MultExprTrait< MT1, typename ColumnExprTrait<const MT2>::Type >::Type Type;
1061  //**********************************************************************************************
1062 };
1064 //*************************************************************************************************
1065 
1066 } // namespace blaze
1067 
1068 #endif
Header file for the SMatDVecMultExprTrait class template.
Header file for the UNUSED_PARAMETER function template.
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
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatTSMatMultExpr.h:317
MT1::CompositeType CT1
Composite type of the left-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:109
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
Header file for the IsSparseMatrix type trait.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
Header file for the ColumnExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatTSMatMultExpr.h:350
Header file for the TSVecTSMatMultExprTrait class template.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Header file for the IsRowVector type trait.
SMatTSMatMultExpr< MT1, MT2 > This
Type of this SMatTSMatMultExpr instance.
Definition: SMatTSMatMultExpr.h:115
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
MT1::ResultType RT1
Result type of the left-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:107
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:127
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:84
MT2::CompositeType CT2
Composite type of the right-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:110
Header file for the TDVecSMatMultExprTrait class template.
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.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SMatTSMatMultExpr.h:372
Header file for the RequiresEvaluation type trait.
Header file for the TSVecSMatMultExprTrait class template.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2404
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
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatTSMatMultExpr.h:121
Header file for the SparseMatrix base class.
Constraint on the data type.
Expression object for sparse matrix-transpose sparse matrix multiplications.The SMatTSMatMultExpr cla...
Definition: Forward.h:105
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
ResultType::ElementType ElementType
Resulting element type.
Definition: SMatTSMatMultExpr.h:119
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 multiplication trait.
#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
Header file for the TDVecTSMatMultExprTrait class template.
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
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatTSMatMultExpr.h:362
Header file for the SMatSVecMultExprTrait class template.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatTSMatMultExpr.h:296
Constraints on the storage order of matrix types.
RightOperand rightOperand() const
Returns the right-hand side transpose sparse matrix operand.
Definition: SMatTSMatMultExpr.h:338
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: SMatTSMatMultExpr.h:380
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatTSMatMultExpr.h:306
Header file for the serial shim.
const size_t SMP_SMATTSMATMULT_THRESHOLD
SMP row-major sparse matrix/column-major sparse matrix multiplication threshold.This threshold specif...
Definition: Thresholds.h:1133
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
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatTSMatMultExpr.h:156
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
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:124
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
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
MultTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: SMatTSMatMultExpr.h:116
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatTSMatMultExpr.h:286
Header file for the RemoveReference type trait.
Header file for the IsDenseVector type trait.
SMatTSMatMultExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the SMatTSMatMultExpr class.
Definition: SMatTSMatMultExpr.h:141
LeftOperand leftOperand() const
Returns the left-hand side sparse matrix operand.
Definition: SMatTSMatMultExpr.h:328
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatTSMatMultExpr.h:379
Header file for the IsRowMajorMatrix type trait.
Header file for the IsComputation type trait class.
#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
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:170
Header file for basic type definitions.
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTSMatMultExpr.h:117
Header file for the IsColumnVector type trait.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:154
#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
#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
MT2::ResultType RT2
Result type of the right-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:108
Header file for the IsExpression type trait class.
Header file for the TSMatSVecMultExprTrait class template.
Header file for the FunctionTrace class.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatTSMatMultExpr.h:118
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatTSMatMultExpr.h:120