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 <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
70 #include <blaze/math/views/Check.h>
73 #include <blaze/util/Assert.h>
74 #include <blaze/util/DisableIf.h>
75 #include <blaze/util/EnableIf.h>
77 #include <blaze/util/mpl/And.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/mpl/Or.h>
80 #include <blaze/util/Types.h>
82 #include <blaze/util/Unused.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS SMATTSMATMULTEXPR
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
100 template< typename MT1 // Type of the left-hand side sparse matrix
101  , typename MT2 > // Type of the right-hand side sparse matrix
102 class SMatTSMatMultExpr
103  : public MatMatMultExpr< SparseMatrix< SMatTSMatMultExpr<MT1,MT2>, false > >
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
112  //**********************************************************************************************
113 
114  //**********************************************************************************************
116 
123  template< typename T1, typename T2, typename T3 >
124  struct CanExploitSymmetry {
125  enum : bool { value = ( IsRowMajorMatrix<T1>::value && IsSymmetric<T3>::value ) ||
127  };
129  //**********************************************************************************************
130 
131  public:
132  //**Type definitions****************************************************************************
138  using ReturnType = const ElementType;
139  using CompositeType = const ResultType;
140 
142  using LeftOperand = If_< IsExpression<MT1>, const MT1, const MT1& >;
143 
145  using RightOperand = If_< IsExpression<MT2>, const MT2, const MT2& >;
146  //**********************************************************************************************
147 
148  //**Compilation flags***************************************************************************
150  enum : bool { smpAssignable = false };
151  //**********************************************************************************************
152 
153  //**Constructor*********************************************************************************
159  explicit inline SMatTSMatMultExpr( const MT1& lhs, const MT2& rhs ) noexcept
160  : lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
161  , rhs_( rhs ) // Right-hand side sparse matrix of the multiplication expression
162  {
163  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
164  }
165  //**********************************************************************************************
166 
167  //**Access operator*****************************************************************************
174  inline ReturnType operator()( size_t i, size_t j ) const {
175  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
176  BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
177 
178  return row( lhs_, i, unchecked ) * column( rhs_, j, unchecked );
179  }
180  //**********************************************************************************************
181 
182  //**At function*********************************************************************************
190  inline ReturnType at( size_t i, size_t j ) const {
191  if( i >= lhs_.rows() ) {
192  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
193  }
194  if( j >= rhs_.columns() ) {
195  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
196  }
197  return (*this)(i,j);
198  }
199  //**********************************************************************************************
200 
201  //**Rows function*******************************************************************************
206  inline size_t rows() const noexcept {
207  return lhs_.rows();
208  }
209  //**********************************************************************************************
210 
211  //**Columns function****************************************************************************
216  inline size_t columns() const noexcept {
217  return rhs_.columns();
218  }
219  //**********************************************************************************************
220 
221  //**NonZeros function***************************************************************************
226  inline constexpr size_t nonZeros() const noexcept {
227  return 0UL;
228  }
229  //**********************************************************************************************
230 
231  //**NonZeros function***************************************************************************
237  inline size_t nonZeros( size_t i ) const noexcept {
238  UNUSED_PARAMETER( i );
239  return 0UL;
240  }
241  //**********************************************************************************************
242 
243  //**Left operand access*************************************************************************
248  inline LeftOperand leftOperand() const noexcept {
249  return lhs_;
250  }
251  //**********************************************************************************************
252 
253  //**Right operand access************************************************************************
258  inline RightOperand rightOperand() const noexcept {
259  return rhs_;
260  }
261  //**********************************************************************************************
262 
263  //**********************************************************************************************
269  template< typename T >
270  inline bool canAlias( const T* alias ) const noexcept {
271  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
272  }
273  //**********************************************************************************************
274 
275  //**********************************************************************************************
281  template< typename T >
282  inline bool isAliased( const T* alias ) const noexcept {
283  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
284  }
285  //**********************************************************************************************
286 
287  //**********************************************************************************************
292  inline bool canSMPAssign() const noexcept {
293  return ( rows() * columns() >= SMP_SMATTSMATMULT_THRESHOLD );
294  }
295  //**********************************************************************************************
296 
297  private:
298  //**Member variables****************************************************************************
301  //**********************************************************************************************
302 
303  //**Assignment to row-major matrices************************************************************
316  template< typename MT > // Type of the target matrix
318  assign( Matrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
319  {
321 
322  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
323  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
324 
326 
327  const OppositeType_<MT2> tmp( serial( rhs.rhs_ ) );
328  assign( ~lhs, rhs.lhs_ * tmp );
329  }
331  //**********************************************************************************************
332 
333  //**Restructuring assignment to row-major matrices**********************************************
348  template< typename MT > // Type of the target matrix
350  assign( Matrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
351  {
353 
354  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
355  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
356 
357  assign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
358  }
360  //**********************************************************************************************
361 
362  //**Assignment to column-major matrices*********************************************************
375  template< typename MT > // Type of the target matrix
377  assign( Matrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
378  {
380 
382 
383  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
384  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
385 
387 
388  const OppositeType_<MT1> tmp( serial( rhs.lhs_ ) );
389  assign( ~lhs, tmp * rhs.rhs_ );
390  }
392  //**********************************************************************************************
393 
394  //**Restructuring assignment to column-major matrices*******************************************
409  template< typename MT > // Type of the target matrix
411  assign( Matrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
412  {
414 
416 
417  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
418  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
419 
420  assign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
421  }
423  //**********************************************************************************************
424 
425  //**Addition assignment to row-major dense matrices*********************************************
438  template< typename MT > // Type of the target dense matrix
440  addAssign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
441  {
443 
444  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
445  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
446 
448 
449  const OppositeType_<MT2> tmp( serial( rhs.rhs_ ) );
450  addAssign( ~lhs, rhs.lhs_ * tmp );
451  }
453  //**********************************************************************************************
454 
455  //**Restructuring addition assignment to row-major matrices*************************************
470  template< typename MT > // Type of the target matrix
472  addAssign( Matrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
473  {
475 
476  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
477  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
478 
479  addAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
480  }
482  //**********************************************************************************************
483 
484  //**Addition assignment to column-major dense matrices******************************************
497  template< typename MT > // Type of the target dense matrix
499  addAssign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
500  {
502 
504 
505  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
506  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
507 
509 
510  const OppositeType_<MT1> tmp( serial( rhs.lhs_ ) );
511  addAssign( ~lhs, tmp * rhs.rhs_ );
512  }
514  //**********************************************************************************************
515 
516  //**Restructuring addition assignment to column-major matrices**********************************
531  template< typename MT > // Type of the target matrix
533  addAssign( Matrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
534  {
536 
538 
539  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
540  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
541 
542  addAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
543  }
545  //**********************************************************************************************
546 
547  //**Addition assignment to sparse matrices******************************************************
548  // No special implementation for the addition assignment to sparse matrices.
549  //**********************************************************************************************
550 
551  //**Subtraction assignment to row-major dense matrices******************************************
564  template< typename MT > // Type of the target dense matrix
566  subAssign( DenseMatrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
567  {
569 
570  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
571  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
572 
574 
575  const OppositeType_<MT2> tmp( serial( rhs.rhs_ ) );
576  subAssign( ~lhs, rhs.lhs_ * tmp );
577  }
579  //**********************************************************************************************
580 
581  //**Restructuring subtraction assignment to row-major matrices**********************************
596  template< typename MT > // Type of the target matrix
598  subAssign( Matrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
599  {
601 
602  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
603  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
604 
605  subAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
606  }
608  //**********************************************************************************************
609 
610  //**Subtraction assignment to column-major dense matrices***************************************
623  template< typename MT > // Type of the target dense matrix
625  subAssign( DenseMatrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
626  {
628 
630 
631  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
632  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
633 
635 
636  const OppositeType_<MT1> tmp( serial( rhs.lhs_ ) );
637  subAssign( ~lhs, tmp * rhs.rhs_ );
638  }
640  //**********************************************************************************************
641 
642  //**Restructuring subtraction assignment to column-major matrices*******************************
657  template< typename MT > // Type of the target matrix
659  subAssign( Matrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
660  {
662 
664 
665  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
666  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
667 
668  subAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
669  }
671  //**********************************************************************************************
672 
673  //**Subtraction assignment to sparse matrices***************************************************
674  // No special implementation for the subtraction assignment to sparse matrices.
675  //**********************************************************************************************
676 
677  //**Schur product assignment to row-major dense matrices****************************************
690  template< typename MT // Type of the target dense matrix
691  , bool SO > // Storage order of the target dense matrix
692  friend inline void schurAssign( DenseMatrix<MT,SO>& lhs, const SMatTSMatMultExpr& rhs )
693  {
695 
699 
700  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
701  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
702 
703  const ResultType tmp( serial( rhs ) );
704  schurAssign( ~lhs, tmp );
705  }
707  //**********************************************************************************************
708 
709  //**Schur product assignment to sparse matrices*************************************************
710  // No special implementation for the Schur product assignment to sparse matrices.
711  //**********************************************************************************************
712 
713  //**Multiplication assignment to dense matrices*************************************************
714  // No special implementation for the multiplication assignment to dense matrices.
715  //**********************************************************************************************
716 
717  //**Multiplication assignment to sparse matrices************************************************
718  // No special implementation for the multiplication assignment to sparse matrices.
719  //**********************************************************************************************
720 
721  //**SMP assignment to row-major matrices********************************************************
736  template< typename MT > // Type of the target matrix
738  smpAssign( Matrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
739  {
741 
742  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
743  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
744 
746 
747  const OppositeType_<MT2> tmp( rhs.rhs_ );
748  smpAssign( ~lhs, rhs.lhs_ * tmp );
749  }
751  //**********************************************************************************************
752 
753  //**Restructuring SMP assignment to row-major matrices******************************************
768  template< typename MT > // Type of the target matrix
770  smpAssign( Matrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
771  {
773 
774  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
775  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
776 
777  smpAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
778  }
780  //**********************************************************************************************
781 
782  //**SMP assignment to column-major matrices*****************************************************
797  template< typename MT > // Type of the target matrix
799  smpAssign( Matrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
800  {
802 
804 
805  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
806  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
807 
809 
810  const OppositeType_<MT1> tmp( rhs.lhs_ );
811  smpAssign( ~lhs, tmp * rhs.rhs_ );
812  }
814  //**********************************************************************************************
815 
816  //**Restructuring SMP assignment to column-major matrices***************************************
831  template< typename MT > // Type of the target matrix
833  smpAssign( Matrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
834  {
836 
838 
839  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
840  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
841 
842  smpAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
843  }
845  //**********************************************************************************************
846 
847  //**SMP addition assignment to row-major dense matrices*****************************************
862  template< typename MT > // Type of the target dense matrix
865  {
867 
868  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
869  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
870 
872 
873  const OppositeType_<MT2> tmp( rhs.rhs_ );
874  smpAddAssign( ~lhs, rhs.lhs_ * tmp );
875  }
877  //**********************************************************************************************
878 
879  //**SMP addition assignment to column-major dense matrices**************************************
894  template< typename MT > // Type of the target dense matrix
897  {
899 
901 
902  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
903  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
904 
906 
907  const OppositeType_<MT1> tmp( rhs.lhs_ );
908  smpAddAssign( ~lhs, tmp * rhs.rhs_ );
909  }
911  //**********************************************************************************************
912 
913  //**Restructuring SMP addition assignment to row-major matrices*********************************
928  template< typename MT > // Type of the target matrix
931  {
933 
934  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
935  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
936 
937  smpAddAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
938  }
940  //**********************************************************************************************
941 
942  //**Restructuring SMP addition assignment to column-major matrices******************************
957  template< typename MT > // Type of the target matrix
960  {
962 
964 
965  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
966  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
967 
968  smpAddAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
969  }
971  //**********************************************************************************************
972 
973  //**SMP addition assignment to sparse matrices**************************************************
974  // No special implementation for the SMP addition assignment to sparse matrices.
975  //**********************************************************************************************
976 
977  //**SMP subtraction assignment to row-major dense matrices**************************************
992  template< typename MT > // Type of the target dense matrix
995  {
997 
998  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
999  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1000 
1002 
1003  const OppositeType_<MT2> tmp( rhs.rhs_ );
1004  smpSubAssign( ~lhs, rhs.lhs_ * tmp );
1005  }
1007  //**********************************************************************************************
1008 
1009  //**SMP subtraction assignment to column-major dense matrices***********************************
1024  template< typename MT > // Type of the target dense matrix
1027  {
1029 
1031 
1032  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1033  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1034 
1036 
1037  const OppositeType_<MT1> tmp( rhs.lhs_ );
1038  smpSubAssign( ~lhs, tmp * rhs.rhs_ );
1039  }
1041  //**********************************************************************************************
1042 
1043  //**Restructuring SMP subtraction assignment to row-major matrices******************************
1058  template< typename MT > // Type of the target matrix
1060  smpSubAssign( Matrix<MT,false>& lhs, const SMatTSMatMultExpr& rhs )
1061  {
1063 
1064  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1065  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1066 
1067  smpSubAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
1068  }
1070  //**********************************************************************************************
1071 
1072  //**Restructuring SMP subtraction assignment to column-major matrices***************************
1087  template< typename MT > // Type of the target matrix
1089  smpSubAssign( Matrix<MT,true>& lhs, const SMatTSMatMultExpr& rhs )
1090  {
1092 
1094 
1095  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1096  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1097 
1098  smpSubAssign( ~lhs, trans( rhs.lhs_ ) * rhs.rhs_ );
1099  }
1101  //**********************************************************************************************
1102 
1103  //**SMP subtraction assignment to sparse matrices***********************************************
1104  // No special implementation for the SMP subtraction assignment to sparse matrices.
1105  //**********************************************************************************************
1106 
1107  //**SMP Schur product assignment to row-major dense matrices************************************
1120  template< typename MT // Type of the target dense matrix
1121  , bool SO > // Storage order of the target dense matrix
1122  friend inline void smpSchurAssign( DenseMatrix<MT,SO>& lhs, const SMatTSMatMultExpr& rhs )
1123  {
1125 
1129 
1130  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
1131  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
1132 
1133  const ResultType tmp( rhs );
1134  smpSchurAssign( ~lhs, tmp );
1135  }
1137  //**********************************************************************************************
1138 
1139  //**SMP Schur product assignment to sparse matrices*********************************************
1140  // No special implementation for the SMP Schur product assignment to sparse matrices.
1141  //**********************************************************************************************
1142 
1143  //**SMP multiplication assignment to dense matrices*********************************************
1144  // No special implementation for the SMP multiplication assignment to dense matrices.
1145  //**********************************************************************************************
1146 
1147  //**SMP multiplication assignment to sparse matrices********************************************
1148  // No special implementation for the SMP multiplication assignment to sparse matrices.
1149  //**********************************************************************************************
1150 
1151  //**Compile time checks*************************************************************************
1159  //**********************************************************************************************
1160 };
1161 //*************************************************************************************************
1162 
1163 
1164 
1165 
1166 //=================================================================================================
1167 //
1168 // GLOBAL BINARY ARITHMETIC OPERATORS
1169 //
1170 //=================================================================================================
1171 
1172 //*************************************************************************************************
1202 template< typename MT1 // Type of the left-hand side sparse matrix
1203  , typename MT2 > // Type of the right-hand side sparse matrix
1204 inline decltype(auto)
1205  operator*( const SparseMatrix<MT1,false>& lhs, const SparseMatrix<MT2,true>& rhs )
1206 {
1208 
1209  if( (~lhs).columns() != (~rhs).rows() ) {
1210  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1211  }
1212 
1213  using ReturnType = const SMatTSMatMultExpr<MT1,MT2>;
1214  return ReturnType( ~lhs, ~rhs );
1215 }
1216 //*************************************************************************************************
1217 
1218 
1219 
1220 
1221 //=================================================================================================
1222 //
1223 // SIZE SPECIALIZATIONS
1224 //
1225 //=================================================================================================
1226 
1227 //*************************************************************************************************
1229 template< typename MT1, typename MT2 >
1230 struct Size< SMatTSMatMultExpr<MT1,MT2>, 0UL >
1231  : public Size<MT1,0UL>
1232 {};
1233 
1234 template< typename MT1, typename MT2 >
1235 struct Size< SMatTSMatMultExpr<MT1,MT2>, 1UL >
1236  : public Size<MT2,1UL>
1237 {};
1239 //*************************************************************************************************
1240 
1241 
1242 
1243 
1244 //=================================================================================================
1245 //
1246 // ISLOWER SPECIALIZATIONS
1247 //
1248 //=================================================================================================
1249 
1250 //*************************************************************************************************
1252 template< typename MT1, typename MT2 >
1253 struct IsLower< SMatTSMatMultExpr<MT1,MT2> >
1254  : public And< IsLower<MT1>, IsLower<MT2> >
1255 {};
1257 //*************************************************************************************************
1258 
1259 
1260 
1261 
1262 //=================================================================================================
1263 //
1264 // ISUNILOWER SPECIALIZATIONS
1265 //
1266 //=================================================================================================
1267 
1268 //*************************************************************************************************
1270 template< typename MT1, typename MT2 >
1271 struct IsUniLower< SMatTSMatMultExpr<MT1,MT2> >
1272  : public And< IsUniLower<MT1>, IsUniLower<MT2> >
1273 {};
1275 //*************************************************************************************************
1276 
1277 
1278 
1279 
1280 //=================================================================================================
1281 //
1282 // ISSTRICTLYLOWER SPECIALIZATIONS
1283 //
1284 //=================================================================================================
1285 
1286 //*************************************************************************************************
1288 template< typename MT1, typename MT2 >
1289 struct IsStrictlyLower< SMatTSMatMultExpr<MT1,MT2> >
1290  : public Or< And< IsStrictlyLower<MT1>, IsLower<MT2> >
1291  , And< IsStrictlyLower<MT2>, IsLower<MT1> > >
1292 {};
1294 //*************************************************************************************************
1295 
1296 
1297 
1298 
1299 //=================================================================================================
1300 //
1301 // ISUPPER SPECIALIZATIONS
1302 //
1303 //=================================================================================================
1304 
1305 //*************************************************************************************************
1307 template< typename MT1, typename MT2 >
1308 struct IsUpper< SMatTSMatMultExpr<MT1,MT2> >
1309  : public And< IsUpper<MT1>, IsUpper<MT2> >
1310 {};
1312 //*************************************************************************************************
1313 
1314 
1315 
1316 
1317 //=================================================================================================
1318 //
1319 // ISUNIUPPER SPECIALIZATIONS
1320 //
1321 //=================================================================================================
1322 
1323 //*************************************************************************************************
1325 template< typename MT1, typename MT2 >
1326 struct IsUniUpper< SMatTSMatMultExpr<MT1,MT2> >
1327  : public And< IsUniUpper<MT1>, IsUniUpper<MT2> >
1328 {};
1330 //*************************************************************************************************
1331 
1332 
1333 
1334 
1335 //=================================================================================================
1336 //
1337 // ISSTRICTLYUPPER SPECIALIZATIONS
1338 //
1339 //=================================================================================================
1340 
1341 //*************************************************************************************************
1343 template< typename MT1, typename MT2 >
1344 struct IsStrictlyUpper< SMatTSMatMultExpr<MT1,MT2> >
1345  : public Or< And< IsStrictlyUpper<MT1>, IsUpper<MT2> >
1346  , And< IsStrictlyUpper<MT2>, IsUpper<MT1> > >
1347 {};
1349 //*************************************************************************************************
1350 
1351 } // namespace blaze
1352 
1353 #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
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatTSMatMultExpr.h:138
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
EnableIf_< IsDenseMatrix< MT1 > > smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:196
Header file for basic type definitions.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatTSMatMultExpr.h:216
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:164
Header file for the serial shim.
Header file for the IsColumnMajorMatrix type trait.
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatTSMatMultExpr.h:139
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the And class template.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
Header file for the Computation base class.
Header file for the MatMatMultExpr base class.
RightOperand rightOperand() const noexcept
Returns the right-hand side transpose sparse matrix operand.
Definition: SMatTSMatMultExpr.h:258
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
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:343
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:133
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
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:126
ResultType_< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:109
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatTSMatMultExpr.h:174
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
Header file for the DisableIf class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatTSMatMultExpr.h:248
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:58
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:110
#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
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatTSMatMultExpr.h:136
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatTSMatMultExpr.h:282
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:102
Header file for the Or 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
constexpr size_t nonZeros() const noexcept
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatTSMatMultExpr.h:226
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.
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTSMatMultExpr.h:135
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
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
Constraint on the data type.
Header file for all forward declarations for expression class templates.
SMatTSMatMultExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the SMatTSMatMultExpr class.
Definition: SMatTSMatMultExpr.h:159
If_< IsExpression< MT1 >, const MT1, const MT1 &> LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:142
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatTSMatMultExpr.h:206
#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:107
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:86
CompositeType_< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:111
#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
#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
If_< IsExpression< MT2 >, const MT2, const MT2 &> RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:145
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:110
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:154
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatTSMatMultExpr.h:270
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatTSMatMultExpr.h:190
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
LeftOperand lhs_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatTSMatMultExpr.h:299
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:263
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
ResultType_< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:108
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
MultTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SMatTSMatMultExpr.h:134
Header file for the IsRowMajorMatrix type trait.
Header file for the IsComputation type trait class.
size_t nonZeros(size_t i) const noexcept
Returns the number of non-zero elements in the specified row.
Definition: SMatTSMatMultExpr.h:237
Compile time logical &#39;or&#39; evaluation.The Or alias declaration performs at compile time a logical &#39;or&#39;...
Definition: Or.h:76
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
Compile time logical &#39;and&#39; evaluation.The And alias declaration performs at compile time a logical &#39;a...
Definition: And.h:76
RightOperand rhs_
Right-hand side sparse matrix of the multiplication expression.
Definition: SMatTSMatMultExpr.h:300
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatTSMatMultExpr.h:292
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Constraint on the data type.
CompositeType_< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: SMatTSMatMultExpr.h:110
Header file for the Size 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
#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 function trace functionality.
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SMatTSMatMultExpr.h:137