SMatScalarMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSCALARMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATSCALARMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
48 #include <blaze/math/Exception.h>
84 #include <blaze/util/Assert.h>
88 #include <blaze/util/EnableIf.h>
90 #include <blaze/util/InvalidType.h>
92 #include <blaze/util/mpl/And.h>
93 #include <blaze/util/mpl/If.h>
94 #include <blaze/util/mpl/Or.h>
95 #include <blaze/util/Types.h>
98 
99 
100 namespace blaze {
101 
102 //=================================================================================================
103 //
104 // CLASS SMATSCALARMULTEXPR
105 //
106 //=================================================================================================
107 
108 //*************************************************************************************************
115 template< typename MT // Type of the left-hand side sparse matrix
116  , typename ST // Type of the right-hand side scalar value
117  , bool SO > // Storage order
118 class SMatScalarMultExpr : public SparseMatrix< SMatScalarMultExpr<MT,ST,SO>, SO >
119  , private MatScalarMultExpr
120  , private Computation
121 {
122  private:
123  //**Type definitions****************************************************************************
124  typedef ResultType_<MT> RT;
125  typedef ReturnType_<MT> RN;
127  //**********************************************************************************************
128 
129  //**Return type evaluation**********************************************************************
131 
136  enum : bool { returnExpr = !IsTemporary<RN>::value };
137 
140  //**********************************************************************************************
141 
142  //**Serial evaluation strategy******************************************************************
144 
150  enum : bool { useAssign = RequiresEvaluation<MT>::value };
151 
153  template< typename MT2 >
155  struct UseAssign {
156  enum : bool { value = useAssign };
157  };
159  //**********************************************************************************************
160 
161  //**Parallel evaluation strategy****************************************************************
163 
169  template< typename MT2 >
170  struct UseSMPAssign {
171  enum : bool { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
172  };
174  //**********************************************************************************************
175 
176  public:
177  //**Type definitions****************************************************************************
183 
186 
189 
191  typedef If_< IsExpression<MT>, const MT, const MT& > LeftOperand;
192 
194  typedef ST RightOperand;
195  //**********************************************************************************************
196 
197  //**ConstIterator class definition**************************************************************
201  {
202  public:
203  //**Type definitions*************************************************************************
206 
209 
210  typedef std::forward_iterator_tag IteratorCategory;
211  typedef Element ValueType;
212  typedef ValueType* PointerType;
213  typedef ValueType& ReferenceType;
215 
216  // STL iterator requirements
217  typedef IteratorCategory iterator_category;
218  typedef ValueType value_type;
219  typedef PointerType pointer;
220  typedef ReferenceType reference;
221  typedef DifferenceType difference_type;
222  //*******************************************************************************************
223 
224  //**Constructor******************************************************************************
227  inline ConstIterator( IteratorType matrix, RightOperand scalar )
228  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
229  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
230  {}
231  //*******************************************************************************************
232 
233  //**Prefix increment operator****************************************************************
239  ++matrix_;
240  return *this;
241  }
242  //*******************************************************************************************
243 
244  //**Element access operator******************************************************************
249  inline const Element operator*() const {
250  return Element( matrix_->value() * scalar_, matrix_->index() );
251  }
252  //*******************************************************************************************
253 
254  //**Element access operator******************************************************************
259  inline const ConstIterator* operator->() const {
260  return this;
261  }
262  //*******************************************************************************************
263 
264  //**Value function***************************************************************************
269  inline ReturnType value() const {
270  return matrix_->value() * scalar_;
271  }
272  //*******************************************************************************************
273 
274  //**Index function***************************************************************************
279  inline size_t index() const {
280  return matrix_->index();
281  }
282  //*******************************************************************************************
283 
284  //**Equality operator************************************************************************
290  inline bool operator==( const ConstIterator& rhs ) const {
291  return matrix_ == rhs.matrix_;
292  }
293  //*******************************************************************************************
294 
295  //**Inequality operator**********************************************************************
301  inline bool operator!=( const ConstIterator& rhs ) const {
302  return matrix_ != rhs.matrix_;
303  }
304  //*******************************************************************************************
305 
306  //**Subtraction operator*********************************************************************
312  inline DifferenceType operator-( const ConstIterator& rhs ) const {
313  return matrix_ - rhs.matrix_;
314  }
315  //*******************************************************************************************
316 
317  private:
318  //**Member variables*************************************************************************
319  IteratorType matrix_;
320  RightOperand scalar_;
321  //*******************************************************************************************
322  };
323  //**********************************************************************************************
324 
325  //**Compilation flags***************************************************************************
327  enum : bool { smpAssignable = false };
328  //**********************************************************************************************
329 
330  //**Constructor*********************************************************************************
336  explicit inline SMatScalarMultExpr( const MT& matrix, ST scalar ) noexcept
337  : matrix_( matrix ) // Left-hand side sparse matrix of the multiplication expression
338  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
339  {}
340  //**********************************************************************************************
341 
342  //**Access operator*****************************************************************************
349  inline ReturnType operator()( size_t i, size_t j ) const {
350  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
351  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
352  return matrix_(i,j) * scalar_;
353  }
354  //**********************************************************************************************
355 
356  //**At function*********************************************************************************
364  inline ReturnType at( size_t i, size_t j ) const {
365  if( i >= matrix_.rows() ) {
366  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
367  }
368  if( j >= matrix_.columns() ) {
369  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
370  }
371  return (*this)(i,j);
372  }
373  //**********************************************************************************************
374 
375  //**Begin function******************************************************************************
381  inline ConstIterator begin( size_t i ) const {
382  return ConstIterator( matrix_.begin(i), scalar_ );
383  }
384  //**********************************************************************************************
385 
386  //**End function********************************************************************************
392  inline ConstIterator end( size_t i ) const {
393  return ConstIterator( matrix_.end(i), scalar_ );
394  }
395  //**********************************************************************************************
396 
397  //**Rows function*******************************************************************************
402  inline size_t rows() const noexcept {
403  return matrix_.rows();
404  }
405  //**********************************************************************************************
406 
407  //**Columns function****************************************************************************
412  inline size_t columns() const noexcept {
413  return matrix_.columns();
414  }
415  //**********************************************************************************************
416 
417  //**NonZeros function***************************************************************************
422  inline size_t nonZeros() const {
423  return matrix_.nonZeros();
424  }
425  //**********************************************************************************************
426 
427  //**NonZeros function***************************************************************************
433  inline size_t nonZeros( size_t i ) const {
434  return matrix_.nonZeros(i);
435  }
436  //**********************************************************************************************
437 
438  //**Find function*******************************************************************************
445  inline ConstIterator find( size_t i, size_t j ) const {
447  return ConstIterator( matrix_.find( i, j ), scalar_ );
448  }
449  //**********************************************************************************************
450 
451  //**LowerBound function*************************************************************************
458  inline ConstIterator lowerBound( size_t i, size_t j ) const {
460  return ConstIterator( matrix_.lowerBound( i, j ), scalar_ );
461  }
462  //**********************************************************************************************
463 
464  //**UpperBound function*************************************************************************
471  inline ConstIterator upperBound( size_t i, size_t j ) const {
473  return ConstIterator( matrix_.upperBound( i, j ), scalar_ );
474  }
475  //**********************************************************************************************
476 
477  //**Left operand access*************************************************************************
482  inline LeftOperand leftOperand() const noexcept {
483  return matrix_;
484  }
485  //**********************************************************************************************
486 
487  //**Right operand access************************************************************************
492  inline RightOperand rightOperand() const noexcept {
493  return scalar_;
494  }
495  //**********************************************************************************************
496 
497  //**********************************************************************************************
503  template< typename T >
504  inline bool canAlias( const T* alias ) const noexcept {
505  return matrix_.canAlias( alias );
506  }
507  //**********************************************************************************************
508 
509  //**********************************************************************************************
515  template< typename T >
516  inline bool isAliased( const T* alias ) const noexcept {
517  return matrix_.isAliased( alias );
518  }
519  //**********************************************************************************************
520 
521  private:
522  //**Member variables****************************************************************************
523  LeftOperand matrix_;
524  RightOperand scalar_;
525  //**********************************************************************************************
526 
527  //**Assignment to dense matrices****************************************************************
541  template< typename MT2 // Type of the target dense matrix
542  , bool SO2 > // Storage order of the target dense matrix
543  friend inline EnableIf_< UseAssign<MT2> >
544  assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
545  {
547 
548  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
549  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
550 
551  assign( ~lhs, rhs.matrix_ );
552  (~lhs) *= rhs.scalar_;
553  }
555  //**********************************************************************************************
556 
557  //**Assignment to sparse matrices***************************************************************
571  template< typename MT2 // Type of the target sparse matrix
572  , bool SO2 > // Storage order of the target sparse matrix
573  friend inline EnableIf_< UseAssign<MT2> >
574  assign( SparseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
575  {
577 
578  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
579  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
580 
581  assign( ~lhs, rhs.matrix_ );
582  (~lhs) *= rhs.scalar_;
583  }
585  //**********************************************************************************************
586 
587  //**Addition assignment to dense matrices*******************************************************
601  template< typename MT2 // Type of the target dense matrix
602  , bool SO2 > // Storage order of the target dense matrix
603  friend inline EnableIf_< UseAssign<MT2> >
604  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
605  {
607 
609  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
610 
611  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
612  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
613 
614  const ResultType tmp( serial( rhs ) );
615  addAssign( ~lhs, tmp );
616  }
618  //**********************************************************************************************
619 
620  //**Addition assignment to sparse matrices******************************************************
621  // No special implementation for the addition assignment to sparse matrices.
622  //**********************************************************************************************
623 
624  //**Subtraction assignment to dense matrices****************************************************
638  template< typename MT2 // Type of the target dense matrix
639  , bool SO2 > // Storage order of the target dense matrix
640  friend inline EnableIf_< UseAssign<MT2> >
641  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
642  {
644 
646  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
647 
648  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
649  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
650 
651  const ResultType tmp( serial( rhs ) );
652  subAssign( ~lhs, tmp );
653  }
655  //**********************************************************************************************
656 
657  //**Subtraction assignment to sparse matrices***************************************************
658  // No special implementation for the subtraction assignment to sparse matrices.
659  //**********************************************************************************************
660 
661  //**Multiplication assignment to dense matrices*************************************************
662  // No special implementation for the multiplication assignment to dense matrices.
663  //**********************************************************************************************
664 
665  //**Multiplication assignment to sparse matrices************************************************
666  // No special implementation for the multiplication assignment to sparse matrices.
667  //**********************************************************************************************
668 
669  //**SMP assignment to dense matrices************************************************************
670  // No special implementation for the SMP assignment to dense matrices.
671  //**********************************************************************************************
672 
673  //**SMP assignment to sparse matrices***********************************************************
674  // No special implementation for the SMP assignment to sparse matrices.
675  //**********************************************************************************************
676 
677  //**SMP addition assignment to dense matrices***************************************************
691  template< typename MT2 // Type of the target dense matrix
692  , bool SO2 > // Storage order of the target dense matrix
693  friend inline EnableIf_< UseSMPAssign<MT2> >
694  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
695  {
697 
699  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
700 
701  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
702  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
703 
704  const ResultType tmp( rhs );
705  smpAddAssign( ~lhs, tmp );
706  }
708  //**********************************************************************************************
709 
710  //**SMP addition assignment to sparse matrices**************************************************
711  // No special implementation for the SMP addition assignment to sparse matrices.
712  //**********************************************************************************************
713 
714  //**SMP subtraction assignment to dense matrices************************************************
728  template< typename MT2 // Type of the target dense matrix
729  , bool SO2 > // Storage order of the target dense matrix
730  friend inline EnableIf_< UseSMPAssign<MT2> >
731  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
732  {
734 
736  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
737 
738  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
739  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
740 
741  const ResultType tmp( rhs );
742  smpSubAssign( ~lhs, tmp );
743  }
745  //**********************************************************************************************
746 
747  //**SMP subtraction assignment to sparse matrices***********************************************
748  // No special implementation for the SMP subtraction assignment to sparse matrices.
749  //**********************************************************************************************
750 
751  //**SMP multiplication assignment to dense matrices*********************************************
752  // No special implementation for the SMP multiplication assignment to dense matrices.
753  //**********************************************************************************************
754 
755  //**SMP multiplication assignment to sparse matrices********************************************
756  // No special implementation for the SMP multiplication assignment to sparse matrices.
757  //**********************************************************************************************
758 
759  //**Compile time checks*************************************************************************
764  BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ST, RightOperand );
766  //**********************************************************************************************
767 };
768 //*************************************************************************************************
769 
770 
771 
772 
773 //=================================================================================================
774 //
775 // GLOBAL UNARY ARITHMETIC OPERATORS
776 //
777 //=================================================================================================
778 
779 //*************************************************************************************************
796 template< typename MT // Data type of the sparse matrix
797  , bool SO > // Storage order
798 inline const SMatScalarMultExpr<MT,UnderlyingBuiltin_<MT>,SO>
800 {
802 
805 }
806 //*************************************************************************************************
807 
808 
809 
810 
811 //=================================================================================================
812 //
813 // GLOBAL BINARY ARITHMETIC OPERATORS
814 //
815 //=================================================================================================
816 
817 //*************************************************************************************************
838 template< typename T1 // Type of the left-hand side sparse matrix
839  , bool SO // Storage order of the left-hand side sparse matrix
840  , typename T2 > // Type of the right-hand side scalar
841 inline const EnableIf_< IsNumeric<T2>, MultExprTrait_<T1,T2> >
842  operator*( const SparseMatrix<T1,SO>& mat, T2 scalar )
843 {
845 
846  return MultExprTrait_<T1,T2>( ~mat, scalar );
847 }
848 //*************************************************************************************************
849 
850 
851 //*************************************************************************************************
872 template< typename T1 // Type of the left-hand side scalar
873  , typename T2 // Type of the right-hand side sparse matrix
874  , bool SO > // Storage order of the right-hand side sparse matrix
875 inline const EnableIf_< IsNumeric<T1>, MultExprTrait_<T1,T2> >
876  operator*( T1 scalar, const SparseMatrix<T2,SO>& mat )
877 {
879 
880  return MultExprTrait_<T1,T2>( ~mat, scalar );
881 }
882 //*************************************************************************************************
883 
884 
885 
886 
887 //=================================================================================================
888 //
889 // GLOBAL RESTRUCTURING UNARY ARITHMETIC OPERATORS
890 //
891 //=================================================================================================
892 
893 //*************************************************************************************************
905 template< typename VT // Type of the sparse matrix
906  , typename ST // Type of the scalar
907  , bool TF > // Transpose flag
908 inline const SMatScalarMultExpr<VT,ST,TF>
909  operator-( const SMatScalarMultExpr<VT,ST,TF>& sm )
910 {
912 
913  return SMatScalarMultExpr<VT,ST,TF>( sm.leftOperand(), -sm.rightOperand() );
914 }
916 //*************************************************************************************************
917 
918 
919 
920 
921 //=================================================================================================
922 //
923 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
924 //
925 //=================================================================================================
926 
927 //*************************************************************************************************
940 template< typename MT // Type of the sparse matrix
941  , typename ST1 // Type of the first scalar
942  , bool SO // Storage order of the sparse matrix
943  , typename ST2 > // Type of the second scalar
944 inline const EnableIf_< IsNumeric<ST2>
945  , MultExprTrait_< SMatScalarMultExpr<MT,ST1,SO>, ST2 > >
946  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, ST2 scalar )
947 {
949 
950  return mat.leftOperand() * ( mat.rightOperand() * scalar );
951 }
953 //*************************************************************************************************
954 
955 
956 //*************************************************************************************************
969 template< typename ST1 // Type of the first scalar
970  , typename MT // Type of the sparse matrix
971  , typename ST2 // Type of the second scalar
972  , bool SO > // Storage order of the sparse matrix
973 inline const EnableIf_< IsNumeric<ST1>
974  , MultExprTrait_< ST1, SMatScalarMultExpr<MT,ST2,SO> > >
975  operator*( ST1 scalar, const SMatScalarMultExpr<MT,ST2,SO>& mat )
976 {
978 
979  return mat.leftOperand() * ( scalar * mat.rightOperand() );
980 }
982 //*************************************************************************************************
983 
984 
985 //*************************************************************************************************
998 template< typename MT // Type of the sparse matrix
999  , typename ST1 // Type of the first scalar
1000  , bool SO // Storage order of the sparse matrix
1001  , typename ST2 > // Type of the second scalar
1002 inline const EnableIf_< And< IsNumeric<ST2>, Or< IsInvertible<ST1>, IsInvertible<ST2> > >
1003  , DivExprTrait_< SMatScalarMultExpr<MT,ST1,SO>, ST2 > >
1004  operator/( const SMatScalarMultExpr<MT,ST1,SO>& mat, ST2 scalar )
1005 {
1007 
1008  return mat.leftOperand() * ( mat.rightOperand() / scalar );
1009 }
1011 //*************************************************************************************************
1012 
1013 
1014 //*************************************************************************************************
1028 template< typename MT // Type of the sparse matrix of the left-hand side expression
1029  , typename ST // Type of the scalar of the left-hand side expression
1030  , bool SO // Storage order of the left-hand side expression
1031  , typename VT > // Type of the right-hand side dense vector
1032 inline const MultExprTrait_< SMatScalarMultExpr<MT,ST,SO>, VT >
1033  operator*( const SMatScalarMultExpr<MT,ST,SO>& mat, const DenseVector<VT,false>& vec )
1034 {
1036 
1037  return ( mat.leftOperand() * (~vec) ) * mat.rightOperand();
1038 }
1040 //*************************************************************************************************
1041 
1042 
1043 //*************************************************************************************************
1057 template< typename VT // Type of the left-hand side dense vector
1058  , typename MT // Type of the sparse matrix of the right-hand side expression
1059  , typename ST // Type of the scalar of the right-hand side expression
1060  , bool SO > // Storage order of the right-hand side expression
1061 inline const MultExprTrait_< VT, SMatScalarMultExpr<MT,ST,SO> >
1062  operator*( const DenseVector<VT,true>& vec, const SMatScalarMultExpr<MT,ST,SO>& mat )
1063 {
1065 
1066  return ( (~vec) * mat.leftOperand() ) * mat.rightOperand();
1067 }
1069 //*************************************************************************************************
1070 
1071 
1072 //*************************************************************************************************
1088 template< typename MT // Type of the sparse matrix of the left-hand side expression
1089  , typename ST1 // Type of the scalar of the left-hand side expression
1090  , bool SO // Storage order of the left-hand side expression
1091  , typename VT // Type of the dense vector of the right-hand side expression
1092  , typename ST2 > // Type of the scalar of the right-hand side expression
1093 inline const MultExprTrait_< SMatScalarMultExpr<MT,ST1,SO>, DVecScalarMultExpr<VT,ST2,false> >
1094  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, const DVecScalarMultExpr<VT,ST2,false>& vec )
1095 {
1097 
1098  return ( mat.leftOperand() * vec.leftOperand() ) * ( mat.rightOperand() * vec.rightOperand() );
1099 }
1101 //*************************************************************************************************
1102 
1103 
1104 //*************************************************************************************************
1120 template< typename VT // Type of the dense vector of the left-hand side expression
1121  , typename ST1 // Type of the scalar of the left-hand side expression
1122  , typename MT // Type of the sparse matrix of the right-hand side expression
1123  , typename ST2 // Type of the scalar of the right-hand side expression
1124  , bool SO > // Storage order of the right-hand side expression
1125 inline const MultExprTrait_< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,SO> >
1126  operator*( const DVecScalarMultExpr<VT,ST1,true>& vec, const SMatScalarMultExpr<MT,ST2,SO>& mat )
1127 {
1129 
1130  return ( vec.leftOperand() * mat.leftOperand() ) * ( vec.rightOperand() * mat.rightOperand() );
1131 }
1133 //*************************************************************************************************
1134 
1135 
1136 //*************************************************************************************************
1150 template< typename MT // Type of the sparse matrix of the left-hand side expression
1151  , typename ST // Type of the scalar of the left-hand side expression
1152  , bool SO // Storage order of the left-hand side expression
1153  , typename VT > // Type of the right-hand side sparse vector
1154 inline const MultExprTrait_< SMatScalarMultExpr<MT,ST,SO>, VT >
1155  operator*( const SMatScalarMultExpr<MT,ST,SO>& mat, const SparseVector<VT,false>& vec )
1156 {
1158 
1159  return ( mat.leftOperand() * (~vec) ) * mat.rightOperand();
1160 }
1162 //*************************************************************************************************
1163 
1164 
1165 //*************************************************************************************************
1179 template< typename VT // Type of the left-hand side sparse vector
1180  , typename MT // Type of the sparse matrix of the right-hand side expression
1181  , typename ST // Type of the scalar of the right-hand side expression
1182  , bool SO > // Storage order of the right-hand side expression
1183 inline const MultExprTrait_< VT, SMatScalarMultExpr<MT,ST,SO> >
1184  operator*( const SparseVector<VT,true>& vec, const SMatScalarMultExpr<MT,ST,SO>& mat )
1185 {
1187 
1188  return ( (~vec) * mat.leftOperand() ) * mat.rightOperand();
1189 }
1191 //*************************************************************************************************
1192 
1193 
1194 //*************************************************************************************************
1210 template< typename MT // Type of the sparse matrix of the left-hand side expression
1211  , typename ST1 // Type of the scalar of the left-hand side expression
1212  , bool SO // Storage order of the left-hand side expression
1213  , typename VT // Type of the sparse vector of the right-hand side expression
1214  , typename ST2 > // Type of the scalar of the right-hand side expression
1215 inline const MultExprTrait_< SMatScalarMultExpr<MT,ST1,SO>, SVecScalarMultExpr<VT,ST2,false> >
1216  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, const SVecScalarMultExpr<VT,ST2,false>& vec )
1217 {
1219 
1220  return ( mat.leftOperand() * vec.leftOperand() ) * ( mat.rightOperand() * vec.rightOperand() );
1221 }
1223 //*************************************************************************************************
1224 
1225 
1226 //*************************************************************************************************
1242 template< typename VT // Type of the sparse vector of the left-hand side expression
1243  , typename ST1 // Type of the scalar of the left-hand side expression
1244  , typename MT // Type of the sparse matrix of the right-hand side expression
1245  , typename ST2 // Type of the scalar of the right-hand side expression
1246  , bool SO > // Storage order of the right-hand side expression
1247 inline const MultExprTrait_< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,SO> >
1248  operator*( const SVecScalarMultExpr<VT,ST1,true>& vec, const SMatScalarMultExpr<MT,ST2,SO>& mat )
1249 {
1251 
1252  return ( vec.leftOperand() * mat.leftOperand() ) * ( vec.rightOperand() * mat.rightOperand() );
1253 }
1255 //*************************************************************************************************
1256 
1257 
1258 //*************************************************************************************************
1272 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1273  , typename ST // Type of the scalar of the left-hand side expression
1274  , bool SO1 // Storage order of the left-hand side expression
1275  , typename MT2 // Type of the right-hand side dense matrix
1276  , bool SO2 > // Storage order of the right-hand side dense matrix
1277 inline const MultExprTrait_< SMatScalarMultExpr<MT1,ST,SO1>, MT2 >
1278  operator*( const SMatScalarMultExpr<MT1,ST,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1279 {
1281 
1282  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1283 }
1285 //*************************************************************************************************
1286 
1287 
1288 //*************************************************************************************************
1302 template< typename MT1 // Type of the left-hand side dense matrix
1303  , bool SO1 // Storage order of the left-hand side dense matrix
1304  , typename MT2 // Type of the sparse matrix of the right-hand side expression
1305  , typename ST // Type of the scalar of the right-hand side expression
1306  , bool SO2 > // Storage order of the right-hand side expression
1307 inline const MultExprTrait_< MT1, SMatScalarMultExpr<MT2,ST,SO2> >
1308  operator*( const DenseMatrix<MT1,SO1>& lhs, const SMatScalarMultExpr<MT2,ST,SO2>& rhs )
1309 {
1311 
1312  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1313 }
1315 //*************************************************************************************************
1316 
1317 
1318 //*************************************************************************************************
1332 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1333  , typename ST // Type of the scalar of the left-hand side expression
1334  , bool SO1 // Storage order of the left-hand side expression
1335  , typename MT2 // Type of the right-hand side sparse matrix
1336  , bool SO2 > // Storage order of the right-hand side sparse matrix
1337 inline const MultExprTrait_< SMatScalarMultExpr<MT1,ST,SO1>, MT2 >
1338  operator*( const SMatScalarMultExpr<MT1,ST,SO1>& lhs, const SparseMatrix<MT2,SO2>& rhs )
1339 {
1341 
1342  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1343 }
1345 //*************************************************************************************************
1346 
1347 
1348 //*************************************************************************************************
1362 template< typename MT1 // Type of the left-hand side sparse matrix
1363  , bool SO1 // Storage order of the left-hand side sparse matrix
1364  , typename MT2 // Type of the sparse matrix of the right-hand side expression
1365  , typename ST // Type of the scalar of the right-hand side expression
1366  , bool SO2 > // Storage order of the right-hand side expression
1367 inline const MultExprTrait_< MT1, SMatScalarMultExpr<MT2,ST,SO2> >
1368  operator*( const SparseMatrix<MT1,SO1>& lhs, const SMatScalarMultExpr<MT2,ST,SO2>& rhs )
1369 {
1371 
1372  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1373 }
1375 //*************************************************************************************************
1376 
1377 
1378 //*************************************************************************************************
1392 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1393  , typename ST1 // Type of the scalar of the left-hand side expression
1394  , bool SO1 // Storage order of the left-hand side expression
1395  , typename MT2 // Type of the right-hand side sparse matrix
1396  , typename ST2 // Type of the scalar of the right-hand side expression
1397  , bool SO2 > // Storage order of the right-hand side expression
1398 inline const MultExprTrait_< SMatScalarMultExpr<MT1,ST1,SO1>, SMatScalarMultExpr<MT2,ST2,SO2> >
1399  operator*( const SMatScalarMultExpr<MT1,ST1,SO1>& lhs, const SMatScalarMultExpr<MT2,ST2,SO2>& rhs )
1400 {
1402 
1403  return ( lhs.leftOperand() * rhs.leftOperand() ) * ( lhs.rightOperand() * rhs.rightOperand() );
1404 }
1406 //*************************************************************************************************
1407 
1408 
1409 
1410 
1411 //=================================================================================================
1412 //
1413 // ROWS SPECIALIZATIONS
1414 //
1415 //=================================================================================================
1416 
1417 //*************************************************************************************************
1419 template< typename MT, typename ST, bool SO >
1420 struct Rows< SMatScalarMultExpr<MT,ST,SO> > : public Columns<MT>
1421 {};
1423 //*************************************************************************************************
1424 
1425 
1426 
1427 
1428 //=================================================================================================
1429 //
1430 // COLUMNS SPECIALIZATIONS
1431 //
1432 //=================================================================================================
1433 
1434 //*************************************************************************************************
1436 template< typename MT, typename ST, bool SO >
1437 struct Columns< SMatScalarMultExpr<MT,ST,SO> > : public Rows<MT>
1438 {};
1440 //*************************************************************************************************
1441 
1442 
1443 
1444 
1445 //=================================================================================================
1446 //
1447 // ISSYMMETRIC SPECIALIZATIONS
1448 //
1449 //=================================================================================================
1450 
1451 //*************************************************************************************************
1453 template< typename MT, typename ST, bool SO >
1454 struct IsSymmetric< SMatScalarMultExpr<MT,ST,SO> >
1455  : public BoolConstant< IsSymmetric<MT>::value >
1456 {};
1458 //*************************************************************************************************
1459 
1460 
1461 
1462 
1463 //=================================================================================================
1464 //
1465 // ISHERMITIAN SPECIALIZATIONS
1466 //
1467 //=================================================================================================
1468 
1469 //*************************************************************************************************
1471 template< typename MT, typename ST, bool SO >
1472 struct IsHermitian< SMatScalarMultExpr<MT,ST,SO> >
1473  : public BoolConstant< IsHermitian<MT>::value >
1474 {};
1476 //*************************************************************************************************
1477 
1478 
1479 
1480 
1481 //=================================================================================================
1482 //
1483 // ISLOWER SPECIALIZATIONS
1484 //
1485 //=================================================================================================
1486 
1487 //*************************************************************************************************
1489 template< typename MT, typename ST, bool SO >
1490 struct IsLower< SMatScalarMultExpr<MT,ST,SO> >
1491  : public BoolConstant< IsLower<MT>::value >
1492 {};
1494 //*************************************************************************************************
1495 
1496 
1497 
1498 
1499 //=================================================================================================
1500 //
1501 // ISSTRICTLYLOWER SPECIALIZATIONS
1502 //
1503 //=================================================================================================
1504 
1505 //*************************************************************************************************
1507 template< typename MT, typename ST, bool SO >
1508 struct IsStrictlyLower< SMatScalarMultExpr<MT,ST,SO> >
1509  : public BoolConstant< IsStrictlyLower<MT>::value >
1510 {};
1512 //*************************************************************************************************
1513 
1514 
1515 
1516 
1517 //=================================================================================================
1518 //
1519 // ISUPPER SPECIALIZATIONS
1520 //
1521 //=================================================================================================
1522 
1523 //*************************************************************************************************
1525 template< typename MT, typename ST, bool SO >
1526 struct IsUpper< SMatScalarMultExpr<MT,ST,SO> >
1527  : public BoolConstant< IsUpper<MT>::value >
1528 {};
1530 //*************************************************************************************************
1531 
1532 
1533 
1534 
1535 //=================================================================================================
1536 //
1537 // ISSTRICTLYUPPER SPECIALIZATIONS
1538 //
1539 //=================================================================================================
1540 
1541 //*************************************************************************************************
1543 template< typename MT, typename ST, bool SO >
1544 struct IsStrictlyUpper< SMatScalarMultExpr<MT,ST,SO> >
1545  : public BoolConstant< IsStrictlyUpper<MT>::value >
1546 {};
1548 //*************************************************************************************************
1549 
1550 
1551 
1552 
1553 //=================================================================================================
1554 //
1555 // SMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1556 //
1557 //=================================================================================================
1558 
1559 //*************************************************************************************************
1561 template< typename MT, typename ST1, typename ST2 >
1562 struct SMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1563 {
1564  public:
1565  //**********************************************************************************************
1566  using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1567  , IsNumeric<ST1>, IsNumeric<ST2> >
1568  , SMatScalarMultExprTrait_< MT, MultTrait_<ST1,ST2> >
1569  , INVALID_TYPE >;
1570  //**********************************************************************************************
1571 };
1573 //*************************************************************************************************
1574 
1575 
1576 
1577 
1578 //=================================================================================================
1579 //
1580 // TSMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1581 //
1582 //=================================================================================================
1583 
1584 //*************************************************************************************************
1586 template< typename MT, typename ST1, typename ST2 >
1587 struct TSMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1588 {
1589  public:
1590  //**********************************************************************************************
1591  using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1592  , IsNumeric<ST1>, IsNumeric<ST2> >
1593  , TSMatScalarMultExprTrait_< MT, MultTrait_<ST1,ST2> >
1594  , INVALID_TYPE >;
1595  //**********************************************************************************************
1596 };
1598 //*************************************************************************************************
1599 
1600 
1601 
1602 
1603 //=================================================================================================
1604 //
1605 // SMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1606 //
1607 //=================================================================================================
1608 
1609 //*************************************************************************************************
1611 template< typename MT, typename ST1, typename ST2 >
1612 struct SMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1613 {
1614  private:
1615  //**********************************************************************************************
1616  using ScalarType = DivTrait_<ST1,ST2>;
1617  //**********************************************************************************************
1618 
1619  public:
1620  //**********************************************************************************************
1621  using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1622  , IsNumeric<ST1>, IsNumeric<ST2> >
1623  , If_< IsInvertible<ScalarType>
1624  , SMatScalarMultExprTrait_<MT,ScalarType>
1625  , SMatScalarDivExprTrait_<MT,ScalarType> >
1626  , INVALID_TYPE >;
1627  //**********************************************************************************************
1628 };
1630 //*************************************************************************************************
1631 
1632 
1633 
1634 
1635 //=================================================================================================
1636 //
1637 // TSMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1638 //
1639 //=================================================================================================
1640 
1641 //*************************************************************************************************
1643 template< typename MT, typename ST1, typename ST2 >
1644 struct TSMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1645 {
1646  private:
1647  //**********************************************************************************************
1648  using ScalarType = DivTrait_<ST1,ST2>;
1649  //**********************************************************************************************
1650 
1651  public:
1652  //**********************************************************************************************
1653  using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1654  , IsNumeric<ST1>, IsNumeric<ST2> >
1655  , If_< IsInvertible<ScalarType>
1656  , TSMatScalarMultExprTrait_<MT,ScalarType>
1657  , TSMatScalarDivExprTrait_<MT,ScalarType> >
1658  , INVALID_TYPE >;
1659  //**********************************************************************************************
1660 };
1662 //*************************************************************************************************
1663 
1664 
1665 
1666 
1667 //=================================================================================================
1668 //
1669 // SMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1670 //
1671 //=================================================================================================
1672 
1673 //*************************************************************************************************
1675 template< typename MT, typename ST, typename VT >
1676 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1677 {
1678  public:
1679  //**********************************************************************************************
1680  using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1681  , IsDenseVector<VT>, IsColumnVector<VT>
1682  , IsNumeric<ST> >
1683  , DVecScalarMultExprTrait_< SMatDVecMultExprTrait_<MT,VT>, ST >
1684  , INVALID_TYPE >;
1685  //**********************************************************************************************
1686 };
1688 //*************************************************************************************************
1689 
1690 
1691 //*************************************************************************************************
1693 template< typename MT, typename ST1, typename VT, typename ST2 >
1694 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, DVecScalarMultExpr<VT,ST2,false> >
1695 {
1696  public:
1697  //**********************************************************************************************
1698  using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1699  , IsDenseVector<VT>, IsColumnVector<VT>
1700  , IsNumeric<ST1>, IsNumeric<ST2> >
1701  , DVecScalarMultExprTrait_< SMatDVecMultExprTrait_<MT,VT>, MultTrait_<ST1,ST2> >
1702  , INVALID_TYPE >;
1703  //**********************************************************************************************
1704 };
1706 //*************************************************************************************************
1707 
1708 
1709 
1710 
1711 //=================================================================================================
1712 //
1713 // TSMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1714 //
1715 //=================================================================================================
1716 
1717 //*************************************************************************************************
1719 template< typename MT, typename ST, typename VT >
1720 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1721 {
1722  public:
1723  //**********************************************************************************************
1724  using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1725  , IsDenseVector<VT>, IsColumnVector<VT>
1726  , IsNumeric<ST> >
1727  , DVecScalarMultExprTrait_< TSMatDVecMultExprTrait_<MT,VT>, ST >
1728  , INVALID_TYPE >;
1729  //**********************************************************************************************
1730 };
1732 //*************************************************************************************************
1733 
1734 
1735 //*************************************************************************************************
1737 template< typename MT, typename ST1, typename VT, typename ST2 >
1738 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, DVecScalarMultExpr<VT,ST2,false> >
1739 {
1740  public:
1741  //**********************************************************************************************
1742  using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1743  , IsDenseVector<VT>, IsColumnVector<VT>
1744  , IsNumeric<ST1>, IsNumeric<ST2> >
1745  , DVecScalarMultExprTrait_< TSMatDVecMultExprTrait_<MT,VT>, MultTrait_<ST1,ST2> >
1746  , INVALID_TYPE >;
1747  //**********************************************************************************************
1748 };
1750 //*************************************************************************************************
1751 
1752 
1753 
1754 
1755 //=================================================================================================
1756 //
1757 // TDVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1758 //
1759 //=================================================================================================
1760 
1761 //*************************************************************************************************
1763 template< typename VT, typename MT, typename ST >
1764 struct TDVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1765 {
1766  public:
1767  //**********************************************************************************************
1768  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT>
1769  , IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1770  , IsNumeric<ST> >
1771  , TDVecScalarMultExprTrait_< TDVecSMatMultExprTrait_<VT,MT>, ST >
1772  , INVALID_TYPE >;
1773  //**********************************************************************************************
1774 };
1776 //*************************************************************************************************
1777 
1778 
1779 //*************************************************************************************************
1781 template< typename VT, typename ST1, typename MT, typename ST2 >
1782 struct TDVecSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1783 {
1784  public:
1785  //**********************************************************************************************
1786  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT>
1787  , IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1788  , IsNumeric<ST1>, IsNumeric<ST2> >
1789  , TDVecScalarMultExprTrait_< TDVecSMatMultExprTrait_<VT,MT>, MultTrait_<ST1,ST2> >
1790  , INVALID_TYPE >;
1791  //**********************************************************************************************
1792 };
1794 //*************************************************************************************************
1795 
1796 
1797 
1798 
1799 //=================================================================================================
1800 //
1801 // TDVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1802 //
1803 //=================================================================================================
1804 
1805 //*************************************************************************************************
1807 template< typename VT, typename MT, typename ST >
1808 struct TDVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1809 {
1810  public:
1811  //**********************************************************************************************
1812  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT>
1813  , IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1814  , IsNumeric<ST> >
1815  , TDVecScalarMultExprTrait_< TDVecTSMatMultExprTrait_<VT,MT>, ST >
1816  , INVALID_TYPE >;
1817  //**********************************************************************************************
1818 };
1820 //*************************************************************************************************
1821 
1822 
1823 //*************************************************************************************************
1825 template< typename VT, typename ST1, typename MT, typename ST2 >
1826 struct TDVecTSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
1827 {
1828  public:
1829  //**********************************************************************************************
1830  using Type = If_< And< IsDenseVector<VT>, IsRowVector<VT>
1831  , IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1832  , IsNumeric<ST1>, IsNumeric<ST2> >
1833  , TDVecScalarMultExprTrait_< TDVecTSMatMultExprTrait_<VT,MT>, MultTrait_<ST1,ST2> >
1834  , INVALID_TYPE >;
1835  //**********************************************************************************************
1836 };
1838 //*************************************************************************************************
1839 
1840 
1841 
1842 
1843 //=================================================================================================
1844 //
1845 // SMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1846 //
1847 //=================================================================================================
1848 
1849 //*************************************************************************************************
1851 template< typename MT, typename ST, typename VT >
1852 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1853 {
1854  public:
1855  //**********************************************************************************************
1856  using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1857  , IsSparseVector<VT>, IsColumnVector<VT>
1858  , IsNumeric<ST> >
1859  , SVecScalarMultExprTrait_< SMatSVecMultExprTrait_<MT,VT>, ST >
1860  , INVALID_TYPE >;
1861  //**********************************************************************************************
1862 };
1864 //*************************************************************************************************
1865 
1866 
1867 //*************************************************************************************************
1869 template< typename MT, typename ST1, typename VT, typename ST2 >
1870 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, SVecScalarMultExpr<VT,ST2,false> >
1871 {
1872  public:
1873  //**********************************************************************************************
1874  using Type = If_< And< IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1875  , IsSparseVector<VT>, IsColumnVector<VT>
1876  , IsNumeric<ST1>, IsNumeric<ST2> >
1877  , SVecScalarMultExprTrait_< SMatSVecMultExprTrait_<MT,VT>, MultTrait_<ST1,ST2> >
1878  , INVALID_TYPE >;
1879  //**********************************************************************************************
1880 };
1882 //*************************************************************************************************
1883 
1884 
1885 
1886 
1887 //=================================================================================================
1888 //
1889 // TSMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1890 //
1891 //=================================================================================================
1892 
1893 //*************************************************************************************************
1895 template< typename MT, typename ST, typename VT >
1896 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1897 {
1898  public:
1899  //**********************************************************************************************
1900  using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1901  , IsSparseVector<VT>, IsColumnVector<VT>
1902  , IsNumeric<ST> >
1903  , SVecScalarMultExprTrait_< TSMatSVecMultExprTrait_<MT,VT>, ST >
1904  , INVALID_TYPE >;
1905  //**********************************************************************************************
1906 };
1908 //*************************************************************************************************
1909 
1910 
1911 //*************************************************************************************************
1913 template< typename MT, typename ST1, typename VT, typename ST2 >
1914 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, SVecScalarMultExpr<VT,ST2,false> >
1915 {
1916  public:
1917  //**********************************************************************************************
1918  using Type = If_< And< IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1919  , IsSparseVector<VT>, IsColumnVector<VT>
1920  , IsNumeric<ST1>, IsNumeric<ST2> >
1921  , SVecScalarMultExprTrait_< TSMatSVecMultExprTrait_<MT,VT>, MultTrait_<ST1,ST2> >
1922  , INVALID_TYPE >;
1923  //**********************************************************************************************
1924 };
1926 //*************************************************************************************************
1927 
1928 
1929 
1930 
1931 //=================================================================================================
1932 //
1933 // TSVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1934 //
1935 //=================================================================================================
1936 
1937 //*************************************************************************************************
1939 template< typename VT, typename MT, typename ST >
1940 struct TSVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1941 {
1942  public:
1943  //**********************************************************************************************
1944  using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT>
1945  , IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1946  , IsNumeric<ST> >
1947  , TSVecScalarMultExprTrait_< TSVecSMatMultExprTrait_<VT,MT>, ST >
1948  , INVALID_TYPE >;
1949  //**********************************************************************************************
1950 };
1952 //*************************************************************************************************
1953 
1954 
1955 //*************************************************************************************************
1957 template< typename VT, typename ST1, typename MT, typename ST2 >
1958 struct TSVecSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1959 {
1960  public:
1961  //**********************************************************************************************
1962  using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT>
1963  , IsSparseMatrix<MT>, IsRowMajorMatrix<MT>
1964  , IsNumeric<ST1>, IsNumeric<ST2> >
1965  , TSVecScalarMultExprTrait_< TSVecSMatMultExprTrait_<VT,MT>, MultTrait_<ST1,ST2> >
1966  , INVALID_TYPE >;
1967  //**********************************************************************************************
1968 };
1970 //*************************************************************************************************
1971 
1972 
1973 
1974 
1975 //=================================================================================================
1976 //
1977 // TSVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1978 //
1979 //=================================================================================================
1980 
1981 //*************************************************************************************************
1983 template< typename VT, typename MT, typename ST >
1984 struct TSVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1985 {
1986  public:
1987  //**********************************************************************************************
1988  using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT>
1989  , IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
1990  , IsNumeric<ST> >
1991  , TSVecScalarMultExprTrait_< TSVecTSMatMultExprTrait_<VT,MT>, ST >
1992  , INVALID_TYPE >;
1993  //**********************************************************************************************
1994 };
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2001 template< typename VT, typename ST1, typename MT, typename ST2 >
2002 struct TSVecTSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
2003 {
2004  public:
2005  //**********************************************************************************************
2006  using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT>
2007  , IsSparseMatrix<MT>, IsColumnMajorMatrix<MT>
2008  , IsNumeric<ST1>, IsNumeric<ST2> >
2009  , TSVecScalarMultExprTrait_< TSVecTSMatMultExprTrait_<VT,MT>, MultTrait_<ST1,ST2> >
2010  , INVALID_TYPE >;
2011  //**********************************************************************************************
2012 };
2014 //*************************************************************************************************
2015 
2016 
2017 
2018 
2019 //=================================================================================================
2020 //
2021 // DMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2022 //
2023 //=================================================================================================
2024 
2025 //*************************************************************************************************
2027 template< typename MT1, typename MT2, typename ST >
2028 struct DMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
2029 {
2030  public:
2031  //**********************************************************************************************
2032  using Type = If_< And< IsDenseMatrix<MT1>, IsRowMajorMatrix<MT1>
2033  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2034  , IsNumeric<ST> >
2035  , DMatScalarMultExprTrait_< DMatSMatMultExprTrait_<MT1,MT2>, ST >
2036  , INVALID_TYPE >;
2037  //**********************************************************************************************
2038 };
2040 //*************************************************************************************************
2041 
2042 
2043 
2044 
2045 //=================================================================================================
2046 //
2047 // DMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
2048 //
2049 //=================================================================================================
2050 
2051 //*************************************************************************************************
2053 template< typename MT1, typename MT2, typename ST >
2054 struct DMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2055 {
2056  public:
2057  //**********************************************************************************************
2058  using Type = If_< And< IsDenseMatrix<MT1>, IsRowMajorMatrix<MT1>
2059  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2060  , IsNumeric<ST> >
2061  , DMatScalarMultExprTrait_< DMatTSMatMultExprTrait_<MT1,MT2>, ST >
2062  , INVALID_TYPE >;
2063  //**********************************************************************************************
2064 };
2066 //*************************************************************************************************
2067 
2068 
2069 
2070 
2071 //=================================================================================================
2072 //
2073 // TDMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2074 //
2075 //=================================================================================================
2076 
2077 //*************************************************************************************************
2079 template< typename MT1, typename MT2, typename ST >
2080 struct TDMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
2081 {
2082  public:
2083  //**********************************************************************************************
2084  using Type = If_< And< IsDenseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2085  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2086  , IsNumeric<ST> >
2087  , TDMatScalarMultExprTrait_< TDMatSMatMultExprTrait_<MT1,MT2>, ST >
2088  , INVALID_TYPE >;
2089  //**********************************************************************************************
2090 };
2092 //*************************************************************************************************
2093 
2094 
2095 
2096 
2097 //=================================================================================================
2098 //
2099 // TDMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
2100 //
2101 //=================================================================================================
2102 
2103 //*************************************************************************************************
2105 template< typename MT1, typename MT2, typename ST >
2106 struct TDMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2107 {
2108  public:
2109  //**********************************************************************************************
2110  using Type = If_< And< IsDenseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2111  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2112  , IsNumeric<ST> >
2113  , TDMatScalarMultExprTrait_< TDMatTSMatMultExprTrait_<MT1,MT2>, ST >
2114  , INVALID_TYPE >;
2115  //**********************************************************************************************
2116 };
2118 //*************************************************************************************************
2119 
2120 
2121 
2122 
2123 //=================================================================================================
2124 //
2125 // SMATDMATMULTEXPRTRAIT SPECIALIZATIONS
2126 //
2127 //=================================================================================================
2128 
2129 //*************************************************************************************************
2131 template< typename MT1, typename ST, typename MT2 >
2132 struct SMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
2133 {
2134  public:
2135  //**********************************************************************************************
2136  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2137  , IsDenseMatrix<MT2>, IsRowMajorMatrix<MT2>
2138  , IsNumeric<ST> >
2139  , DMatScalarMultExprTrait_< SMatDMatMultExprTrait_<MT1,MT2>, ST >
2140  , INVALID_TYPE >;
2141  //**********************************************************************************************
2142 };
2144 //*************************************************************************************************
2145 
2146 
2147 
2148 
2149 //=================================================================================================
2150 //
2151 // SMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
2152 //
2153 //=================================================================================================
2154 
2155 //*************************************************************************************************
2157 template< typename MT1, typename ST, typename MT2 >
2158 struct SMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
2159 {
2160  public:
2161  //**********************************************************************************************
2162  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2163  , IsDenseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2164  , IsNumeric<ST> >
2165  , DMatScalarMultExprTrait_< SMatTDMatMultExprTrait_<MT1,MT2>, ST >
2166  , INVALID_TYPE >;
2167  //**********************************************************************************************
2168 };
2170 //*************************************************************************************************
2171 
2172 
2173 
2174 
2175 //=================================================================================================
2176 //
2177 // TSMATDMATMULTEXPRTRAIT SPECIALIZATIONS
2178 //
2179 //=================================================================================================
2180 
2181 //*************************************************************************************************
2183 template< typename MT1, typename ST, typename MT2 >
2184 struct TSMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2185 {
2186  public:
2187  //**********************************************************************************************
2188  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2189  , IsDenseMatrix<MT2>, IsRowMajorMatrix<MT2>
2190  , IsNumeric<ST> >
2191  , TDMatScalarMultExprTrait_< TSMatDMatMultExprTrait_<MT1,MT2>, ST >
2192  , INVALID_TYPE >;
2193  //**********************************************************************************************
2194 };
2196 //*************************************************************************************************
2197 
2198 
2199 
2200 
2201 //=================================================================================================
2202 //
2203 // TSMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
2204 //
2205 //=================================================================================================
2206 
2207 //*************************************************************************************************
2209 template< typename MT1, typename ST, typename MT2 >
2210 struct TSMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2211 {
2212  public:
2213  //**********************************************************************************************
2214  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2215  , IsDenseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2216  , IsNumeric<ST> >
2217  , TDMatScalarMultExprTrait_< TSMatTDMatMultExprTrait_<MT1,MT2>, ST >
2218  , INVALID_TYPE >;
2219  //**********************************************************************************************
2220 };
2222 //*************************************************************************************************
2223 
2224 
2225 
2226 
2227 //=================================================================================================
2228 //
2229 // SMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2230 //
2231 //=================================================================================================
2232 
2233 //*************************************************************************************************
2235 template< typename MT1, typename ST, typename MT2 >
2236 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
2237 {
2238  public:
2239  //**********************************************************************************************
2240  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2241  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2242  , IsNumeric<ST> >
2243  , SMatScalarMultExprTrait_< SMatSMatMultExprTrait_<MT1,MT2>, ST >
2244  , INVALID_TYPE >;
2245  //**********************************************************************************************
2246 };
2248 //*************************************************************************************************
2249 
2250 
2251 //*************************************************************************************************
2253 template< typename MT1, typename MT2, typename ST >
2254 struct SMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
2255 {
2256  public:
2257  //**********************************************************************************************
2258  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2259  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2260  , IsNumeric<ST> >
2261  , SMatScalarMultExprTrait_< SMatSMatMultExprTrait_<MT1,MT2>, ST >
2262  , INVALID_TYPE >;
2263  //**********************************************************************************************
2264 };
2266 //*************************************************************************************************
2267 
2268 
2269 //*************************************************************************************************
2271 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2272 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,false> >
2273 {
2274  public:
2275  //**********************************************************************************************
2276  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2277  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2278  , IsNumeric<ST1>, IsNumeric<ST2> >
2279  , SMatScalarMultExprTrait_< SMatSMatMultExprTrait_<MT1,MT2>, MultTrait_<ST1,ST2> >
2280  , INVALID_TYPE >;
2281  //**********************************************************************************************
2282 };
2284 //*************************************************************************************************
2285 
2286 
2287 
2288 
2289 //=================================================================================================
2290 //
2291 // SMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
2292 //
2293 //=================================================================================================
2294 
2295 //*************************************************************************************************
2297 template< typename MT1, typename ST, typename MT2 >
2298 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
2299 {
2300  public:
2301  //**********************************************************************************************
2302  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2303  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2304  , IsNumeric<ST> >
2305  , SMatScalarMultExprTrait_< SMatTSMatMultExprTrait_<MT1,MT2>, ST >
2306  , INVALID_TYPE >;
2307  //**********************************************************************************************
2308 };
2310 //*************************************************************************************************
2311 
2312 
2313 //*************************************************************************************************
2315 template< typename MT1, typename MT2, typename ST >
2316 struct SMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2317 {
2318  public:
2319  //**********************************************************************************************
2320  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2321  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2322  , IsNumeric<ST> >
2323  , SMatScalarMultExprTrait_< SMatTSMatMultExprTrait_<MT1,MT2>, ST >
2324  , INVALID_TYPE >;
2325  //**********************************************************************************************
2326 };
2328 //*************************************************************************************************
2329 
2330 
2331 //*************************************************************************************************
2333 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2334 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,true> >
2335 {
2336  public:
2337  //**********************************************************************************************
2338  using Type = If_< And< IsSparseMatrix<MT1>, IsRowMajorMatrix<MT1>
2339  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2340  , IsNumeric<ST1>, IsNumeric<ST2> >
2341  , SMatScalarMultExprTrait_< SMatTSMatMultExprTrait_<MT1,MT2>, MultTrait_<ST1,ST2> >
2342  , INVALID_TYPE >;
2343  //**********************************************************************************************
2344 };
2346 //*************************************************************************************************
2347 
2348 
2349 
2350 
2351 //=================================================================================================
2352 //
2353 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2354 //
2355 //=================================================================================================
2356 
2357 //*************************************************************************************************
2359 template< typename MT1, typename ST, typename MT2 >
2360 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2361 {
2362  public:
2363  //**********************************************************************************************
2364  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2365  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2366  , IsNumeric<ST> >
2367  , TSMatScalarMultExprTrait_< TSMatSMatMultExprTrait_<MT1,MT2>, ST >
2368  , INVALID_TYPE >;
2369  //**********************************************************************************************
2370 };
2372 //*************************************************************************************************
2373 
2374 
2375 //*************************************************************************************************
2377 template< typename MT1, typename MT2, typename ST >
2378 struct TSMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
2379 {
2380  public:
2381  //**********************************************************************************************
2382  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2383  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2384  , IsNumeric<ST> >
2385  , TSMatScalarMultExprTrait_< TSMatSMatMultExprTrait_<MT1,MT2>, ST >
2386  , INVALID_TYPE >;
2387  //**********************************************************************************************
2388 };
2390 //*************************************************************************************************
2391 
2392 
2393 //*************************************************************************************************
2395 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2396 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,false> >
2397 {
2398  public:
2399  //**********************************************************************************************
2400  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2401  , IsSparseMatrix<MT2>, IsRowMajorMatrix<MT2>
2402  , IsNumeric<ST1>, IsNumeric<ST2> >
2403  , TSMatScalarMultExprTrait_< TSMatSMatMultExprTrait_<MT1,MT2>, MultTrait_<ST1,ST2> >
2404  , INVALID_TYPE >;
2405  //**********************************************************************************************
2406 };
2408 //*************************************************************************************************
2409 
2410 
2411 
2412 
2413 //=================================================================================================
2414 //
2415 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2416 //
2417 //=================================================================================================
2418 
2419 //*************************************************************************************************
2421 template< typename MT1, typename ST, typename MT2 >
2422 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2423 {
2424  public:
2425  //**********************************************************************************************
2426  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2427  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2428  , IsNumeric<ST> >
2429  , TSMatScalarMultExprTrait_< TSMatTSMatMultExprTrait_<MT1,MT2>, ST >
2430  , INVALID_TYPE >;
2431  //**********************************************************************************************
2432 };
2434 //*************************************************************************************************
2435 
2436 
2437 //*************************************************************************************************
2439 template< typename MT1, typename MT2, typename ST >
2440 struct TSMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2441 {
2442  public:
2443  //**********************************************************************************************
2444  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2445  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2446  , IsNumeric<ST> >
2447  , TSMatScalarMultExprTrait_< TSMatTSMatMultExprTrait_<MT1,MT2>, ST >
2448  , INVALID_TYPE >;
2449  //**********************************************************************************************
2450 };
2452 //*************************************************************************************************
2453 
2454 
2455 //*************************************************************************************************
2457 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2458 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,true> >
2459 {
2460  public:
2461  //**********************************************************************************************
2462  using Type = If_< And< IsSparseMatrix<MT1>, IsColumnMajorMatrix<MT1>
2463  , IsSparseMatrix<MT2>, IsColumnMajorMatrix<MT2>
2464  , IsNumeric<ST1>, IsNumeric<ST2> >
2465  , TSMatScalarMultExprTrait_< TSMatTSMatMultExprTrait_<MT1,MT2>, MultTrait_<ST1,ST2> >
2466  , INVALID_TYPE >;
2467  //**********************************************************************************************
2468 };
2470 //*************************************************************************************************
2471 
2472 
2473 
2474 
2475 //=================================================================================================
2476 //
2477 // SUBMATRIXEXPRTRAIT SPECIALIZATIONS
2478 //
2479 //=================================================================================================
2480 
2481 //*************************************************************************************************
2483 template< typename MT, typename ST, bool SO, bool AF >
2484 struct SubmatrixExprTrait< SMatScalarMultExpr<MT,ST,SO>, AF >
2485 {
2486  public:
2487  //**********************************************************************************************
2488  using Type = MultExprTrait_< SubmatrixExprTrait_<const MT,AF>, ST >;
2489  //**********************************************************************************************
2490 };
2492 //*************************************************************************************************
2493 
2494 
2495 
2496 
2497 //=================================================================================================
2498 //
2499 // ROWEXPRTRAIT SPECIALIZATIONS
2500 //
2501 //=================================================================================================
2502 
2503 //*************************************************************************************************
2505 template< typename MT, typename ST, bool SO >
2506 struct RowExprTrait< SMatScalarMultExpr<MT,ST,SO> >
2507 {
2508  public:
2509  //**********************************************************************************************
2510  using Type = MultExprTrait_< RowExprTrait_<const MT>, ST >;
2511  //**********************************************************************************************
2512 };
2514 //*************************************************************************************************
2515 
2516 
2517 
2518 
2519 //=================================================================================================
2520 //
2521 // COLUMNEXPRTRAIT SPECIALIZATIONS
2522 //
2523 //=================================================================================================
2524 
2525 //*************************************************************************************************
2527 template< typename MT, typename ST, bool SO >
2528 struct ColumnExprTrait< SMatScalarMultExpr<MT,ST,SO> >
2529 {
2530  public:
2531  //**********************************************************************************************
2532  using Type = MultExprTrait_< ColumnExprTrait_<const MT>, ST >;
2533  //**********************************************************************************************
2534 };
2536 //*************************************************************************************************
2537 
2538 } // namespace blaze
2539 
2540 #endif
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Data type constraint.
Constraint on the data type.
ReturnType_< MT > RN
Return type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:125
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
Header file for the Rows type trait.
MultExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarMultExpr.h:139
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
Header file for basic type definitions.
PointerType pointer
Pointer return type.
Definition: SMatScalarMultExpr.h:219
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: SMatScalarMultExpr.h:524
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatScalarMultExpr.h:392
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:208
Header file for the IsSparseMatrix type trait.
Header file for the serial shim.
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: SMatScalarMultExpr.h:320
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatScalarMultExpr.h:445
Header file for the ColumnExprTrait class template.
ValueType & ReferenceType
Reference return type.
Definition: SMatScalarMultExpr.h:213
Header file for the IsColumnMajorMatrix type trait.
MultTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SMatScalarMultExpr.h:179
Header file for the IsRowVector type trait.
Header file for the And class template.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarMultExpr.h:181
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarMultExpr.h:279
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Header file for the Computation base class.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
Header file for the RequiresEvaluation type trait.
LeftOperand matrix_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatScalarMultExpr.h:523
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarMultExpr.h:422
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarMultExpr.h:471
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarMultExpr.h:210
typename UnderlyingBuiltin< T >::Type UnderlyingBuiltin_
Auxiliary alias declaration for the UnderlyingBuiltin type trait.The UnderlyingBuiltin_ alias declara...
Definition: UnderlyingBuiltin.h:133
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
Header file for the SparseMatrix base class.
Header file for the DivExprTrait class template.
Constraint on the data type.
typename MultExprTrait< T1, T2 >::Type MultExprTrait_
Auxiliary alias declaration for the MultExprTrait class template.The MultExprTrait_ alias declaration...
Definition: MultExprTrait.h:344
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ResultType_< MT > RT
Result type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:124
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatScalarMultExpr.h:381
const EnableIf_< IsNumeric< T2 >, DivExprTrait_< T1, T2 > > operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:966
Header file for the ValueIndexPair class.
SMatScalarMultExpr(const MT &matrix, ST scalar) noexcept
Constructor for the SMatScalarMultExpr class.
Definition: SMatScalarMultExpr.h:336
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:205
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
ReferenceType reference
Reference return type.
Definition: SMatScalarMultExpr.h:220
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatScalarMultExpr.h:458
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarMultExpr.h:238
Header file for the UnderlyingBuiltin type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarMultExpr.h:312
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
Header file for the Columns type trait.
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SMatScalarMultExpr.h:185
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatScalarMultExpr.h:412
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarMultExpr.h:217
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:71
Header file for the IsLower type trait.
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarMultExpr.h:194
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SMatScalarMultExpr.h:182
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarMultExpr.h:349
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarMultExpr.h:301
Constraints on the storage order of matrix types.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarMultExpr.h:482
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for the RowExprTrait class template.
Expression object for sparse matrix-scalar multiplications.The SMatScalarMult class represents the co...
Definition: Forward.h:96
Header file for all forward declarations for expression class templates.
Header file for the IsDenseMatrix type trait.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatScalarMultExpr.h:214
ValueType * PointerType
Pointer return type.
Definition: SMatScalarMultExpr.h:212
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarMultExpr.h:516
Header file for the IsNumeric type trait.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatScalarMultExpr.h:364
Header file for the IsSparseVector type trait.
Header file for the SubmatrixExprTrait class template.
Header file for the MatScalarMultExpr base class.
Header file for run time assertion macros.
Utility type for generic codes.
ConstIterator(IteratorType matrix, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SMatScalarMultExpr.h:227
Header file for the division trait.
SMatScalarMultExpr< MT, ST, SO > This
Type of this SMatScalarMultExpr instance.
Definition: SMatScalarMultExpr.h:178
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarMultExpr.h:290
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatScalarMultExpr.h:402
IfTrue_< useAssign, const ResultType, const SMatScalarMultExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatScalarMultExpr.h:188
#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
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
Iterator over the elements of the sparse matrix/scalar multiplication expression. ...
Definition: SMatScalarMultExpr.h:200
DifferenceType difference_type
Difference between two iterators.
Definition: SMatScalarMultExpr.h:221
Header file for the RemoveReference type trait.
Header file for the IsInvertible type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarMultExpr.h:249
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
Element ValueType
Type of the underlying pointers.
Definition: SMatScalarMultExpr.h:211
Header file for the IsDenseVector type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatScalarMultExpr.h:504
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarMultExpr.h:492
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarMultExpr.h:269
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarMultExpr.h:319
If_< IsExpression< MT >, const MT, const MT & > LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:191
CompositeType_< MT > CT
Composite type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:126
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
Header file for the IsRowMajorMatrix type trait.
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarMultExpr.h:180
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
Header file for the IntegralConstant class template.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarMultExpr.h:433
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsUpper type trait.
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarMultExpr.h:259
Header file for the IsColumnVector type trait.
Header file for the IsHermitian type trait.
ValueType value_type
Type of the underlying pointers.
Definition: SMatScalarMultExpr.h:218
#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 FunctionTrace class.