All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SMatScalarMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSCALARMULTEXPR_H_
23 #define _BLAZE_MATH_EXPRESSIONS_SMATSCALARMULTEXPR_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <iterator>
56 #include <blaze/util/Assert.h>
60 #include <blaze/util/EnableIf.h>
61 #include <blaze/util/InvalidType.h>
63 #include <blaze/util/SelectType.h>
64 #include <blaze/util/Types.h>
68 
69 
70 namespace blaze {
71 
72 //=================================================================================================
73 //
74 // CLASS SMATSCALARMULTEXPR
75 //
76 //=================================================================================================
77 
78 //*************************************************************************************************
85 template< typename MT // Type of the left-hand side sparse matrix
86  , typename ST // Type of the right-hand side scalar value
87  , bool SO > // Storage order
88 class SMatScalarMultExpr : public SparseMatrix< SMatScalarMultExpr<MT,ST,SO>, SO >
89  , private MatScalarMultExpr
90  , private Computation
91 {
92  private:
93  //**Type definitions****************************************************************************
94  typedef typename MT::ResultType RT;
95  typedef typename MT::ReturnType RN;
96  typedef typename MT::CompositeType CT;
97  //**********************************************************************************************
98 
99  //**Return type evaluation**********************************************************************
101 
106  enum { returnExpr = !IsTemporary<RN>::value };
107 
110  //**********************************************************************************************
111 
112  //**Evaluation strategy*************************************************************************
114 
120  enum { useAssign = RequiresEvaluation<MT>::value };
121 
123 
124  template< typename MT2 >
125  struct UseAssign {
126  enum { value = useAssign };
127  };
129  //**********************************************************************************************
130 
131  public:
132  //**Type definitions****************************************************************************
135  typedef typename ResultType::OppositeType OppositeType;
136  typedef typename ResultType::TransposeType TransposeType;
137  typedef typename ResultType::ElementType ElementType;
138 
141 
144 
146  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
147 
149  typedef ST RightOperand;
150  //**********************************************************************************************
151 
152  //**ConstIterator class definition**************************************************************
156  {
157  public:
158  //**Type definitions*************************************************************************
161 
164 
165  typedef std::forward_iterator_tag IteratorCategory;
166  typedef Element ValueType;
170 
171  // STL iterator requirements
177  //*******************************************************************************************
178 
179  //**Constructor******************************************************************************
182  inline ConstIterator( IteratorType matrix, RightOperand scalar )
183  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
184  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
185  {}
186  //*******************************************************************************************
187 
188  //**Prefix increment operator****************************************************************
194  ++matrix_;
195  return *this;
196  }
197  //*******************************************************************************************
198 
199  //**Element access operator******************************************************************
204  inline const Element operator*() const {
205  return Element( matrix_->value() * scalar_, matrix_->index() );
206  }
207  //*******************************************************************************************
208 
209  //**Element access operator******************************************************************
214  inline const ConstIterator* operator->() const {
215  return this;
216  }
217  //*******************************************************************************************
218 
219  //**Value function***************************************************************************
224  inline ReturnType value() const {
225  return matrix_->value() * scalar_;
226  }
227  //*******************************************************************************************
228 
229  //**Index function***************************************************************************
234  inline size_t index() const {
235  return matrix_->index();
236  }
237  //*******************************************************************************************
238 
239  //**Equality operator************************************************************************
245  inline bool operator==( const ConstIterator& rhs ) const {
246  return matrix_ == rhs.matrix_;
247  }
248  //*******************************************************************************************
249 
250  //**Inequality operator**********************************************************************
256  inline bool operator!=( const ConstIterator& rhs ) const {
257  return matrix_ != rhs.matrix_;
258  }
259  //*******************************************************************************************
260 
261  //**Subtraction operator*********************************************************************
267  inline DifferenceType operator-( const ConstIterator& rhs ) const {
268  return matrix_ - rhs.matrix_;
269  }
270  //*******************************************************************************************
271 
272  private:
273  //**Member variables*************************************************************************
276  //*******************************************************************************************
277  };
278  //**********************************************************************************************
279 
280  //**Constructor*********************************************************************************
286  explicit inline SMatScalarMultExpr( const MT& matrix, ST scalar )
287  : matrix_( matrix ) // Left-hand side sparse matrix of the multiplication expression
288  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
289  {}
290  //**********************************************************************************************
291 
292  //**Access operator*****************************************************************************
299  inline ReturnType operator()( size_t i, size_t j ) const {
300  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
301  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
302  return matrix_(i,j) * scalar_;
303  }
304  //**********************************************************************************************
305 
306  //**Begin function******************************************************************************
312  inline ConstIterator begin( size_t i ) const {
313  return ConstIterator( matrix_.begin(i), scalar_ );
314  }
315  //**********************************************************************************************
316 
317  //**End function********************************************************************************
323  inline ConstIterator end( size_t i ) const {
324  return ConstIterator( matrix_.end(i), scalar_ );
325  }
326  //**********************************************************************************************
327 
328  //**Rows function*******************************************************************************
333  inline size_t rows() const {
334  return matrix_.rows();
335  }
336  //**********************************************************************************************
337 
338  //**Columns function****************************************************************************
343  inline size_t columns() const {
344  return matrix_.columns();
345  }
346  //**********************************************************************************************
347 
348  //**NonZeros function***************************************************************************
353  inline size_t nonZeros() const {
354  return matrix_.nonZeros();
355  }
356  //**********************************************************************************************
357 
358  //**NonZeros function***************************************************************************
364  inline size_t nonZeros( size_t i ) const {
365  return matrix_.nonZeros(i);
366  }
367  //**********************************************************************************************
368 
369  //**Left operand access*************************************************************************
374  inline LeftOperand leftOperand() const {
375  return matrix_;
376  }
377  //**********************************************************************************************
378 
379  //**Right operand access************************************************************************
384  inline RightOperand rightOperand() const {
385  return scalar_;
386  }
387  //**********************************************************************************************
388 
389  //**********************************************************************************************
395  template< typename T >
396  inline bool canAlias( const T* alias ) const {
397  return matrix_.canAlias( alias );
398  }
399  //**********************************************************************************************
400 
401  //**********************************************************************************************
407  template< typename T >
408  inline bool isAliased( const T* alias ) const {
409  return matrix_.isAliased( alias );
410  }
411  //**********************************************************************************************
412 
413  private:
414  //**Member variables****************************************************************************
417  //**********************************************************************************************
418 
419  //**Assignment to dense matrices****************************************************************
433  template< typename MT2 // Type of the target dense matrix
434  , bool SO2 > // Storage order of the target dense matrix
435  friend inline typename EnableIf< UseAssign<MT2> >::Type
437  {
439 
440  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
441  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
442 
443  assign( ~lhs, rhs.matrix_ );
444  (~lhs) *= rhs.scalar_;
445  }
447  //**********************************************************************************************
448 
449  //**Assignment to sparse matrices***************************************************************
463  template< typename MT2 // Type of the target sparse matrix
464  , bool SO2 > // Storage order of the target sparse matrix
465  friend inline typename EnableIf< UseAssign<MT2> >::Type
467  {
469 
470  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
471  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
472 
473  assign( ~lhs, rhs.matrix_ );
474  (~lhs) *= rhs.scalar_;
475  }
477  //**********************************************************************************************
478 
479  //**Addition assignment to dense matrices*******************************************************
493  template< typename MT2 // Type of the target dense matrix
494  , bool SO2 > // Storage order of the target dense matrix
495  friend inline typename EnableIf< UseAssign<MT2> >::Type
496  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
497  {
499 
501  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename ResultType::CompositeType );
502 
503  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
504  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
505 
506  const ResultType tmp( rhs );
507  addAssign( ~lhs, tmp );
508  }
510  //**********************************************************************************************
511 
512  //**Addition assignment to sparse matrices******************************************************
513  // No special implementation for the addition assignment to sparse matrices.
514  //**********************************************************************************************
515 
516  //**Subtraction assignment to dense matrices****************************************************
530  template< typename MT2 // Type of the target dense matrix
531  , bool SO2 > // Storage order of the target dense matrix
532  friend inline typename EnableIf< UseAssign<MT2> >::Type
533  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
534  {
536 
538  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename ResultType::CompositeType );
539 
540  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
541  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
542 
543  const ResultType tmp( rhs );
544  subAssign( ~lhs, tmp );
545  }
547  //**********************************************************************************************
548 
549  //**Subtraction assignment to sparse matrices***************************************************
550  // No special implementation for the subtraction assignment to sparse matrices.
551  //**********************************************************************************************
552 
553  //**Multiplication assignment to dense matrices*************************************************
554  // No special implementation for the multiplication assignment to dense matrices.
555  //**********************************************************************************************
556 
557  //**Multiplication assignment to sparse matrices************************************************
558  // No special implementation for the multiplication assignment to sparse matrices.
559  //**********************************************************************************************
560 
561  //**Compile time checks*************************************************************************
568  //**********************************************************************************************
569 };
570 //*************************************************************************************************
571 
572 
573 
574 
575 //=================================================================================================
576 //
577 // GLOBAL UNARY ARITHMETIC OPERATORS
578 //
579 //=================================================================================================
580 
581 //*************************************************************************************************
598 template< typename MT // Data type of the sparse matrix
599  , bool SO > // Storage order
600 inline const SMatScalarMultExpr<MT,typename BaseElementType<MT>::Type,SO>
602 {
604 
605  typedef typename BaseElementType<MT>::Type ElementType;
606  return SMatScalarMultExpr<MT,ElementType,SO>( ~sm, ElementType(-1) );
607 }
608 //*************************************************************************************************
609 
610 
611 
612 
613 //=================================================================================================
614 //
615 // GLOBAL BINARY ARITHMETIC OPERATORS
616 //
617 //=================================================================================================
618 
619 //*************************************************************************************************
640 template< typename T1 // Type of the left-hand side sparse matrix
641  , bool SO // Storage order of the left-hand side sparse matrix
642  , typename T2 > // Type of the right-hand side scalar
643 inline const typename EnableIf< IsNumeric<T2>, typename MultExprTrait<T1,T2>::Type >::Type
644  operator*( const SparseMatrix<T1,SO>& mat, T2 scalar )
645 {
647 
648  typedef typename MultExprTrait<T1,T2>::Type Type;
649  return Type( ~mat, scalar );
650 }
651 //*************************************************************************************************
652 
653 
654 //*************************************************************************************************
675 template< typename T1 // Type of the left-hand side scalar
676  , typename T2 // Type of the right-hand side sparse matrix
677  , bool SO > // Storage order of the right-hand side sparse matrix
678 inline const typename EnableIf< IsNumeric<T1>, typename MultExprTrait<T1,T2>::Type >::Type
679  operator*( T1 scalar, const SparseMatrix<T2,SO>& mat )
680 {
682 
683  typedef typename MultExprTrait<T1,T2>::Type Type;
684  return Type( ~mat, scalar );
685 }
686 //*************************************************************************************************
687 
688 
689 
690 
691 //=================================================================================================
692 //
693 // GLOBAL RESTRUCTURING UNARY ARITHMETIC OPERATORS
694 //
695 //=================================================================================================
696 
697 //*************************************************************************************************
709 template< typename VT // Type of the sparse matrix
710  , typename ST // Type of the scalar
711  , bool TF > // Transpose flag
712 inline const SMatScalarMultExpr<VT,ST,TF>
713  operator-( const SMatScalarMultExpr<VT,ST,TF>& sm )
714 {
716 
717  return SMatScalarMultExpr<VT,ST,TF>( sm.leftOperand(), -sm.rightOperand() );
718 }
720 //*************************************************************************************************
721 
722 
723 
724 
725 //=================================================================================================
726 //
727 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
728 //
729 //=================================================================================================
730 
731 //*************************************************************************************************
744 template< typename MT // Type of the sparse matrix
745  , typename ST1 // Type of the first scalar
746  , bool SO // Storage order of the sparse matrix
747  , typename ST2 > // Type of the second scalar
748 inline const typename EnableIf< IsNumeric<ST2>
749  , typename MultExprTrait< SMatScalarMultExpr<MT,ST1,SO>, ST2 >::Type >::Type
750  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, ST2 scalar )
751 {
753 
754  return mat.leftOperand() * ( mat.rightOperand() * scalar );
755 }
757 //*************************************************************************************************
758 
759 
760 //*************************************************************************************************
773 template< typename ST1 // Type of the first scalar
774  , typename MT // Type of the sparse matrix
775  , typename ST2 // Type of the second scalar
776  , bool SO > // Storage order of the sparse matrix
777 inline const typename EnableIf< IsNumeric<ST1>
778  , typename MultExprTrait< ST1, SMatScalarMultExpr<MT,ST2,SO> >::Type >::Type
779  operator*( ST1 scalar, const SMatScalarMultExpr<MT,ST2,SO>& mat )
780 {
782 
783  return mat.leftOperand() * ( scalar * mat.rightOperand() );
784 }
786 //*************************************************************************************************
787 
788 
789 //*************************************************************************************************
802 template< typename MT // Type of the sparse matrix
803  , typename ST1 // Type of the first scalar
804  , bool SO // Storage order of the sparse matrix
805  , typename ST2 > // Type of the second scalar
806 inline const typename EnableIf< IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>
807  , typename DivExprTrait< SMatScalarMultExpr<MT,ST1,SO>, ST2 >::Type >::Type
808  operator/( const SMatScalarMultExpr<MT,ST1,SO>& mat, ST2 scalar )
809 {
811 
812  return mat.leftOperand() * ( mat.rightOperand() / scalar );
813 }
815 //*************************************************************************************************
816 
817 
818 //*************************************************************************************************
832 template< typename MT // Type of the sparse matrix of the left-hand side expression
833  , typename ST // Type of the scalar of the left-hand side expression
834  , bool SO // Storage order of the left-hand side expression
835  , typename VT > // Type of the right-hand side dense vector
836 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST,SO>, VT >::Type
837  operator*( const SMatScalarMultExpr<MT,ST,SO>& mat, const DenseVector<VT,false>& vec )
838 {
840 
841  return ( mat.leftOperand() * (~vec) ) * mat.rightOperand();
842 }
844 //*************************************************************************************************
845 
846 
847 //*************************************************************************************************
861 template< typename VT // Type of the left-hand side dense vector
862  , typename MT // Type of the sparse matrix of the right-hand side expression
863  , typename ST // Type of the scalar of the right-hand side expression
864  , bool SO > // Storage order of the right-hand side expression
865 inline const typename MultExprTrait< VT, SMatScalarMultExpr<MT,ST,SO> >::Type
866  operator*( const DenseVector<VT,true>& vec, const SMatScalarMultExpr<MT,ST,SO>& mat )
867 {
869 
870  return ( (~vec) * mat.leftOperand() ) * mat.rightOperand();
871 }
873 //*************************************************************************************************
874 
875 
876 //*************************************************************************************************
892 template< typename MT // Type of the sparse matrix of the left-hand side expression
893  , typename ST1 // Type of the scalar of the left-hand side expression
894  , bool SO // Storage order of the left-hand side expression
895  , typename VT // Type of the dense vector of the right-hand side expression
896  , typename ST2 > // Type of the scalar of the right-hand side expression
897 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST1,SO>, DVecScalarMultExpr<VT,ST2,false> >::Type
898  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, const DVecScalarMultExpr<VT,ST2,false>& vec )
899 {
901 
902  return ( mat.leftOperand() * vec.leftOperand() ) * ( mat.rightOperand() * vec.rightOperand() );
903 }
905 //*************************************************************************************************
906 
907 
908 //*************************************************************************************************
924 template< typename VT // Type of the dense vector of the left-hand side expression
925  , typename ST1 // Type of the scalar of the left-hand side expression
926  , typename MT // Type of the sparse matrix of the right-hand side expression
927  , typename ST2 // Type of the scalar of the right-hand side expression
928  , bool SO > // Storage order of the right-hand side expression
929 inline const typename MultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,SO> >::Type
930  operator*( const DVecScalarMultExpr<VT,ST1,true>& vec, const SMatScalarMultExpr<MT,ST2,SO>& mat )
931 {
933 
934  return ( vec.leftOperand() * mat.leftOperand() ) * ( vec.rightOperand() * mat.rightOperand() );
935 }
937 //*************************************************************************************************
938 
939 
940 //*************************************************************************************************
954 template< typename MT // Type of the sparse matrix of the left-hand side expression
955  , typename ST // Type of the scalar of the left-hand side expression
956  , bool SO // Storage order of the left-hand side expression
957  , typename VT > // Type of the right-hand side sparse vector
958 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST,SO>, VT >::Type
959  operator*( const SMatScalarMultExpr<MT,ST,SO>& mat, const SparseVector<VT,false>& vec )
960 {
962 
963  return ( mat.leftOperand() * (~vec) ) * mat.rightOperand();
964 }
966 //*************************************************************************************************
967 
968 
969 //*************************************************************************************************
983 template< typename VT // Type of the left-hand side sparse vector
984  , typename MT // Type of the sparse matrix of the right-hand side expression
985  , typename ST // Type of the scalar of the right-hand side expression
986  , bool SO > // Storage order of the right-hand side expression
987 inline const typename MultExprTrait< VT, SMatScalarMultExpr<MT,ST,SO> >::Type
988  operator*( const SparseVector<VT,true>& vec, const SMatScalarMultExpr<MT,ST,SO>& mat )
989 {
991 
992  return ( (~vec) * mat.leftOperand() ) * mat.rightOperand();
993 }
995 //*************************************************************************************************
996 
997 
998 //*************************************************************************************************
1014 template< typename MT // Type of the sparse matrix of the left-hand side expression
1015  , typename ST1 // Type of the scalar of the left-hand side expression
1016  , bool SO // Storage order of the left-hand side expression
1017  , typename VT // Type of the sparse vector of the right-hand side expression
1018  , typename ST2 > // Type of the scalar of the right-hand side expression
1019 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST1,SO>, SVecScalarMultExpr<VT,ST2,false> >::Type
1020  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, const SVecScalarMultExpr<VT,ST2,false>& vec )
1021 {
1023 
1024  return ( mat.leftOperand() * vec.leftOperand() ) * ( mat.rightOperand() * vec.rightOperand() );
1025 }
1027 //*************************************************************************************************
1028 
1029 
1030 //*************************************************************************************************
1046 template< typename VT // Type of the sparse vector of the left-hand side expression
1047  , typename ST1 // Type of the scalar of the left-hand side expression
1048  , typename MT // Type of the sparse matrix of the right-hand side expression
1049  , typename ST2 // Type of the scalar of the right-hand side expression
1050  , bool SO > // Storage order of the right-hand side expression
1051 inline const typename MultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,SO> >::Type
1052  operator*( const SVecScalarMultExpr<VT,ST1,true>& vec, const SMatScalarMultExpr<MT,ST2,SO>& mat )
1053 {
1055 
1056  return ( vec.leftOperand() * mat.leftOperand() ) * ( vec.rightOperand() * mat.rightOperand() );
1057 }
1059 //*************************************************************************************************
1060 
1061 
1062 //*************************************************************************************************
1076 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1077  , typename ST // Type of the scalar of the left-hand side expression
1078  , bool SO1 // Storage order of the left-hand side expression
1079  , typename MT2 // Type of the right-hand side dense matrix
1080  , bool SO2 > // Storage order of the right-hand side dense matrix
1081 inline const typename MultExprTrait< SMatScalarMultExpr<MT1,ST,SO1>, MT2 >::Type
1082  operator*( const SMatScalarMultExpr<MT1,ST,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1083 {
1085 
1086  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1087 }
1089 //*************************************************************************************************
1090 
1091 
1092 //*************************************************************************************************
1106 template< typename MT1 // Type of the left-hand side dense matrix
1107  , bool SO1 // Storage order of the left-hand side dense matrix
1108  , typename MT2 // Type of the sparse matrix of the right-hand side expression
1109  , typename ST // Type of the scalar of the right-hand side expression
1110  , bool SO2 > // Storage order of the right-hand side expression
1111 inline const typename MultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,SO2> >::Type
1112  operator*( const DenseMatrix<MT1,SO1>& lhs, const SMatScalarMultExpr<MT2,ST,SO2>& rhs )
1113 {
1115 
1116  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1117 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1136 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1137  , typename ST // Type of the scalar of the left-hand side expression
1138  , bool SO1 // Storage order of the left-hand side expression
1139  , typename MT2 // Type of the right-hand side sparse matrix
1140  , bool SO2 > // Storage order of the right-hand side sparse matrix
1141 inline const typename MultExprTrait< SMatScalarMultExpr<MT1,ST,SO1>, MT2 >::Type
1142  operator*( const SMatScalarMultExpr<MT1,ST,SO1>& lhs, const SparseMatrix<MT2,SO2>& rhs )
1143 {
1145 
1146  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1147 }
1149 //*************************************************************************************************
1150 
1151 
1152 //*************************************************************************************************
1166 template< typename MT1 // Type of the left-hand side sparse matrix
1167  , bool SO1 // Storage order of the left-hand side sparse matrix
1168  , typename MT2 // Type of the sparse matrix of the right-hand side expression
1169  , typename ST // Type of the scalar of the right-hand side expression
1170  , bool SO2 > // Storage order of the right-hand side expression
1171 inline const typename MultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,SO2> >::Type
1172  operator*( const SparseMatrix<MT1,SO1>& lhs, const SMatScalarMultExpr<MT2,ST,SO2>& rhs )
1173 {
1175 
1176  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1177 }
1179 //*************************************************************************************************
1180 
1181 
1182 //*************************************************************************************************
1196 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1197  , typename ST1 // Type of the scalar of the left-hand side expression
1198  , bool SO1 // Storage order of the left-hand side expression
1199  , typename MT2 // Type of the right-hand side sparse matrix
1200  , typename ST2 // Type of the scalar of the right-hand side expression
1201  , bool SO2 > // Storage order of the right-hand side expression
1202 inline const typename MultExprTrait< SMatScalarMultExpr<MT1,ST1,SO1>, SMatScalarMultExpr<MT2,ST2,SO2> >::Type
1203  operator*( const SMatScalarMultExpr<MT1,ST1,SO1>& lhs, const SMatScalarMultExpr<MT2,ST2,SO2>& rhs )
1204 {
1206 
1207  return ( lhs.leftOperand() * rhs.leftOperand() ) * ( lhs.rightOperand() * rhs.rightOperand() );
1208 }
1210 //*************************************************************************************************
1211 
1212 
1213 
1214 
1215 //=================================================================================================
1216 //
1217 // SMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1218 //
1219 //=================================================================================================
1220 
1221 //*************************************************************************************************
1223 template< typename MT, typename ST1, typename ST2 >
1224 struct SMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1225 {
1226  public:
1227  //**********************************************************************************************
1228  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1229  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1230  , typename SMatScalarMultExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type
1231  , INVALID_TYPE >::Type Type;
1232  //**********************************************************************************************
1233 };
1235 //*************************************************************************************************
1236 
1237 
1238 
1239 
1240 //=================================================================================================
1241 //
1242 // TSMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1243 //
1244 //=================================================================================================
1245 
1246 //*************************************************************************************************
1248 template< typename MT, typename ST1, typename ST2 >
1249 struct TSMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1250 {
1251  public:
1252  //**********************************************************************************************
1253  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1254  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1255  , typename TSMatScalarMultExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type
1256  , INVALID_TYPE >::Type Type;
1257  //**********************************************************************************************
1258 };
1260 //*************************************************************************************************
1261 
1262 
1263 
1264 
1265 //=================================================================================================
1266 //
1267 // SMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1268 //
1269 //=================================================================================================
1270 
1271 //*************************************************************************************************
1273 template< typename MT, typename ST1, typename ST2 >
1274 struct SMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1275 {
1276  private:
1277  //**********************************************************************************************
1278  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1279  //**********************************************************************************************
1280 
1281  //**********************************************************************************************
1282  typedef typename SMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1283  typedef typename SMatScalarDivExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1284  //**********************************************************************************************
1285 
1286  public:
1287  //**********************************************************************************************
1288  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1289  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1290  , typename SelectType<condition,T1,T2>::Type
1291  , INVALID_TYPE >::Type Type;
1292  //**********************************************************************************************
1293 };
1295 //*************************************************************************************************
1296 
1297 
1298 
1299 
1300 //=================================================================================================
1301 //
1302 // TSMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1303 //
1304 //=================================================================================================
1305 
1306 //*************************************************************************************************
1308 template< typename MT, typename ST1, typename ST2 >
1309 struct TSMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1310 {
1311  private:
1312  //**********************************************************************************************
1313  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1314  //**********************************************************************************************
1315 
1316  //**********************************************************************************************
1317  typedef typename TSMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1318  typedef typename TSMatScalarDivExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1319  //**********************************************************************************************
1320 
1321  public:
1322  //**********************************************************************************************
1323  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1324  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1325  , typename SelectType<condition,T1,T2>::Type
1326  , INVALID_TYPE >::Type Type;
1327  //**********************************************************************************************
1328 };
1330 //*************************************************************************************************
1331 
1332 
1333 
1334 
1335 //=================================================================================================
1336 //
1337 // SMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1338 //
1339 //=================================================================================================
1340 
1341 //*************************************************************************************************
1343 template< typename MT, typename ST, typename VT >
1344 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1345 {
1346  public:
1347  //**********************************************************************************************
1348  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1349  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1350  IsNumeric<ST>::value
1351  , typename DVecScalarMultExprTrait<typename SMatDVecMultExprTrait<MT,VT>::Type,ST>::Type
1352  , INVALID_TYPE >::Type Type;
1353  //**********************************************************************************************
1354 };
1356 //*************************************************************************************************
1357 
1358 
1359 //*************************************************************************************************
1361 template< typename MT, typename ST1, typename VT, typename ST2 >
1362 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, DVecScalarMultExpr<VT,ST2,false> >
1363 {
1364  public:
1365  //**********************************************************************************************
1366  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1367  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1368  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1369  , typename DVecScalarMultExprTrait<typename SMatDVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1370  , INVALID_TYPE >::Type Type;
1371  //**********************************************************************************************
1372 };
1374 //*************************************************************************************************
1375 
1376 
1377 
1378 
1379 //=================================================================================================
1380 //
1381 // TSMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1382 //
1383 //=================================================================================================
1384 
1385 //*************************************************************************************************
1387 template< typename MT, typename ST, typename VT >
1388 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1389 {
1390  public:
1391  //**********************************************************************************************
1392  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1393  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1394  IsNumeric<ST>::value
1395  , typename DVecScalarMultExprTrait<typename TSMatDVecMultExprTrait<MT,VT>::Type,ST>::Type
1396  , INVALID_TYPE >::Type Type;
1397  //**********************************************************************************************
1398 };
1400 //*************************************************************************************************
1401 
1402 
1403 //*************************************************************************************************
1405 template< typename MT, typename ST1, typename VT, typename ST2 >
1406 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, DVecScalarMultExpr<VT,ST2,false> >
1407 {
1408  public:
1409  //**********************************************************************************************
1410  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1411  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1412  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1413  , typename DVecScalarMultExprTrait<typename TSMatDVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1414  , INVALID_TYPE >::Type Type;
1415  //**********************************************************************************************
1416 };
1418 //*************************************************************************************************
1419 
1420 
1421 
1422 
1423 //=================================================================================================
1424 //
1425 // TDVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1426 //
1427 //=================================================================================================
1428 
1429 //*************************************************************************************************
1431 template< typename VT, typename MT, typename ST >
1432 struct TDVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1433 {
1434  public:
1435  //**********************************************************************************************
1436  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1437  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1438  IsNumeric<ST>::value
1439  , typename TDVecScalarMultExprTrait<typename TDVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1440  , INVALID_TYPE >::Type Type;
1441  //**********************************************************************************************
1442 };
1444 //*************************************************************************************************
1445 
1446 
1447 //*************************************************************************************************
1449 template< typename VT, typename ST1, typename MT, typename ST2 >
1450 struct TDVecSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1451 {
1452  public:
1453  //**********************************************************************************************
1454  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1455  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1456  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1457  , typename TDVecScalarMultExprTrait<typename TDVecSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1458  , INVALID_TYPE >::Type Type;
1459  //**********************************************************************************************
1460 };
1462 //*************************************************************************************************
1463 
1464 
1465 
1466 
1467 //=================================================================================================
1468 //
1469 // TDVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1470 //
1471 //=================================================================================================
1472 
1473 //*************************************************************************************************
1475 template< typename VT, typename MT, typename ST >
1476 struct TDVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1477 {
1478  public:
1479  //**********************************************************************************************
1480  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1481  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1482  IsNumeric<ST>::value
1483  , typename TDVecScalarMultExprTrait<typename TDVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1484  , INVALID_TYPE >::Type Type;
1485  //**********************************************************************************************
1486 };
1488 //*************************************************************************************************
1489 
1490 
1491 //*************************************************************************************************
1493 template< typename VT, typename ST1, typename MT, typename ST2 >
1494 struct TDVecTSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
1495 {
1496  public:
1497  //**********************************************************************************************
1498  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1499  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1500  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1501  , typename TDVecScalarMultExprTrait<typename TDVecTSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1502  , INVALID_TYPE >::Type Type;
1503  //**********************************************************************************************
1504 };
1506 //*************************************************************************************************
1507 
1508 
1509 
1510 
1511 //=================================================================================================
1512 //
1513 // SMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1514 //
1515 //=================================================================================================
1516 
1517 //*************************************************************************************************
1519 template< typename MT, typename ST, typename VT >
1520 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1521 {
1522  public:
1523  //**********************************************************************************************
1524  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1525  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1526  IsNumeric<ST>::value
1527  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1528  , INVALID_TYPE >::Type Type;
1529  //**********************************************************************************************
1530 };
1532 //*************************************************************************************************
1533 
1534 
1535 //*************************************************************************************************
1537 template< typename MT, typename ST1, typename VT, typename ST2 >
1538 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, SVecScalarMultExpr<VT,ST2,false> >
1539 {
1540  public:
1541  //**********************************************************************************************
1542  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1543  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1544  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1545  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1546  , INVALID_TYPE >::Type Type;
1547  //**********************************************************************************************
1548 };
1550 //*************************************************************************************************
1551 
1552 
1553 
1554 
1555 //=================================================================================================
1556 //
1557 // TSMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1558 //
1559 //=================================================================================================
1560 
1561 //*************************************************************************************************
1563 template< typename MT, typename ST, typename VT >
1564 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1565 {
1566  public:
1567  //**********************************************************************************************
1568  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1569  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1570  IsNumeric<ST>::value
1571  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1572  , INVALID_TYPE >::Type Type;
1573  //**********************************************************************************************
1574 };
1576 //*************************************************************************************************
1577 
1578 
1579 //*************************************************************************************************
1581 template< typename MT, typename ST1, typename VT, typename ST2 >
1582 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, SVecScalarMultExpr<VT,ST2,false> >
1583 {
1584  public:
1585  //**********************************************************************************************
1586  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1587  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1588  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1589  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1590  , INVALID_TYPE >::Type Type;
1591  //**********************************************************************************************
1592 };
1594 //*************************************************************************************************
1595 
1596 
1597 
1598 
1599 //=================================================================================================
1600 //
1601 // TSVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1602 //
1603 //=================================================================================================
1604 
1605 //*************************************************************************************************
1607 template< typename VT, typename MT, typename ST >
1608 struct TSVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1609 {
1610  public:
1611  //**********************************************************************************************
1612  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1613  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1614  IsNumeric<ST>::value
1615  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1616  , INVALID_TYPE >::Type Type;
1617  //**********************************************************************************************
1618 };
1620 //*************************************************************************************************
1621 
1622 
1623 //*************************************************************************************************
1625 template< typename VT, typename ST1, typename MT, typename ST2 >
1626 struct TSVecSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1627 {
1628  public:
1629  //**********************************************************************************************
1630  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1631  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1632  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1633  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1634  , INVALID_TYPE >::Type Type;
1635  //**********************************************************************************************
1636 };
1638 //*************************************************************************************************
1639 
1640 
1641 
1642 
1643 //=================================================================================================
1644 //
1645 // TSVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1646 //
1647 //=================================================================================================
1648 
1649 //*************************************************************************************************
1651 template< typename VT, typename MT, typename ST >
1652 struct TSVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1653 {
1654  public:
1655  //**********************************************************************************************
1656  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1657  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1658  IsNumeric<ST>::value
1659  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1660  , INVALID_TYPE >::Type Type;
1661  //**********************************************************************************************
1662 };
1664 //*************************************************************************************************
1665 
1666 
1667 //*************************************************************************************************
1669 template< typename VT, typename ST1, typename MT, typename ST2 >
1670 struct TSVecTSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
1671 {
1672  public:
1673  //**********************************************************************************************
1674  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1675  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1676  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1677  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1678  , INVALID_TYPE >::Type Type;
1679  //**********************************************************************************************
1680 };
1682 //*************************************************************************************************
1683 
1684 
1685 
1686 
1687 //=================================================================================================
1688 //
1689 // DMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1690 //
1691 //=================================================================================================
1692 
1693 //*************************************************************************************************
1695 template< typename MT1, typename MT2, typename ST >
1696 struct DMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1697 {
1698  public:
1699  //**********************************************************************************************
1700  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1701  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1702  IsNumeric<ST>::value
1703  , typename DMatScalarMultExprTrait<typename DMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1704  , INVALID_TYPE >::Type Type;
1705  //**********************************************************************************************
1706 };
1708 //*************************************************************************************************
1709 
1710 
1711 
1712 
1713 //=================================================================================================
1714 //
1715 // DMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1716 //
1717 //=================================================================================================
1718 
1719 //*************************************************************************************************
1721 template< typename MT1, typename MT2, typename ST >
1722 struct DMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1723 {
1724  public:
1725  //**********************************************************************************************
1726  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1727  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1728  IsNumeric<ST>::value
1729  , typename DMatScalarMultExprTrait<typename DMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1730  , INVALID_TYPE >::Type Type;
1731  //**********************************************************************************************
1732 };
1734 //*************************************************************************************************
1735 
1736 
1737 
1738 
1739 //=================================================================================================
1740 //
1741 // TDMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1742 //
1743 //=================================================================================================
1744 
1745 //*************************************************************************************************
1747 template< typename MT1, typename MT2, typename ST >
1748 struct TDMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1749 {
1750  public:
1751  //**********************************************************************************************
1752  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1753  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1754  IsNumeric<ST>::value
1755  , typename TDMatScalarMultExprTrait<typename TDMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1756  , INVALID_TYPE >::Type Type;
1757  //**********************************************************************************************
1758 };
1760 //*************************************************************************************************
1761 
1762 
1763 
1764 
1765 //=================================================================================================
1766 //
1767 // TDMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1768 //
1769 //=================================================================================================
1770 
1771 //*************************************************************************************************
1773 template< typename MT1, typename MT2, typename ST >
1774 struct TDMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1775 {
1776  public:
1777  //**********************************************************************************************
1778  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1779  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1780  IsNumeric<ST>::value
1781  , typename TDMatScalarMultExprTrait<typename TDMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1782  , INVALID_TYPE >::Type Type;
1783  //**********************************************************************************************
1784 };
1786 //*************************************************************************************************
1787 
1788 
1789 
1790 
1791 //=================================================================================================
1792 //
1793 // SMATDMATMULTEXPRTRAIT SPECIALIZATIONS
1794 //
1795 //=================================================================================================
1796 
1797 //*************************************************************************************************
1799 template< typename MT1, typename ST, typename MT2 >
1800 struct SMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1801 {
1802  public:
1803  //**********************************************************************************************
1804  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1805  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1806  IsNumeric<ST>::value
1807  , typename DMatScalarMultExprTrait<typename SMatDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1808  , INVALID_TYPE >::Type Type;
1809  //**********************************************************************************************
1810 };
1812 //*************************************************************************************************
1813 
1814 
1815 
1816 
1817 //=================================================================================================
1818 //
1819 // SMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
1820 //
1821 //=================================================================================================
1822 
1823 //*************************************************************************************************
1825 template< typename MT1, typename ST, typename MT2 >
1826 struct SMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1827 {
1828  public:
1829  //**********************************************************************************************
1830  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1831  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1832  IsNumeric<ST>::value
1833  , typename DMatScalarMultExprTrait<typename SMatTDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1834  , INVALID_TYPE >::Type Type;
1835  //**********************************************************************************************
1836 };
1838 //*************************************************************************************************
1839 
1840 
1841 
1842 
1843 //=================================================================================================
1844 //
1845 // TSMATDMATMULTEXPRTRAIT SPECIALIZATIONS
1846 //
1847 //=================================================================================================
1848 
1849 //*************************************************************************************************
1851 template< typename MT1, typename ST, typename MT2 >
1852 struct TSMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
1853 {
1854  public:
1855  //**********************************************************************************************
1856  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1857  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1858  IsNumeric<ST>::value
1859  , typename TDMatScalarMultExprTrait<typename TSMatDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1860  , INVALID_TYPE >::Type Type;
1861  //**********************************************************************************************
1862 };
1864 //*************************************************************************************************
1865 
1866 
1867 
1868 
1869 //=================================================================================================
1870 //
1871 // TSMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
1872 //
1873 //=================================================================================================
1874 
1875 //*************************************************************************************************
1877 template< typename MT1, typename ST, typename MT2 >
1878 struct TSMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
1879 {
1880  public:
1881  //**********************************************************************************************
1882  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1883  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1884  IsNumeric<ST>::value
1885  , typename TDMatScalarMultExprTrait<typename TSMatTDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1886  , INVALID_TYPE >::Type Type;
1887  //**********************************************************************************************
1888 };
1890 //*************************************************************************************************
1891 
1892 
1893 
1894 
1895 //=================================================================================================
1896 //
1897 // SMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1898 //
1899 //=================================================================================================
1900 
1901 //*************************************************************************************************
1903 template< typename MT1, typename ST, typename MT2 >
1904 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1905 {
1906  public:
1907  //**********************************************************************************************
1908  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1909  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1910  IsNumeric<ST>::value
1911  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1912  , INVALID_TYPE >::Type Type;
1913  //**********************************************************************************************
1914 };
1916 //*************************************************************************************************
1917 
1918 
1919 //*************************************************************************************************
1921 template< typename MT1, typename MT2, typename ST >
1922 struct SMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1923 {
1924  public:
1925  //**********************************************************************************************
1926  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1927  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1928  IsNumeric<ST>::value
1929  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1930  , INVALID_TYPE >::Type Type;
1931  //**********************************************************************************************
1932 };
1934 //*************************************************************************************************
1935 
1936 
1937 //*************************************************************************************************
1939 template< typename MT1, typename ST1, typename MT2, typename ST2 >
1940 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,false> >
1941 {
1942  public:
1943  //**********************************************************************************************
1944  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1945  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1946  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1947  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1948  , INVALID_TYPE >::Type Type;
1949  //**********************************************************************************************
1950 };
1952 //*************************************************************************************************
1953 
1954 
1955 
1956 
1957 //=================================================================================================
1958 //
1959 // SMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1960 //
1961 //=================================================================================================
1962 
1963 //*************************************************************************************************
1965 template< typename MT1, typename ST, typename MT2 >
1966 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1967 {
1968  public:
1969  //**********************************************************************************************
1970  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1971  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1972  IsNumeric<ST>::value
1973  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1974  , INVALID_TYPE >::Type Type;
1975  //**********************************************************************************************
1976 };
1978 //*************************************************************************************************
1979 
1980 
1981 //*************************************************************************************************
1983 template< typename MT1, typename MT2, typename ST >
1984 struct SMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1985 {
1986  public:
1987  //**********************************************************************************************
1988  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1989  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1990  IsNumeric<ST>::value
1991  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1992  , INVALID_TYPE >::Type Type;
1993  //**********************************************************************************************
1994 };
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2001 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2002 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,true> >
2003 {
2004  public:
2005  //**********************************************************************************************
2006  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
2007  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2008  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2009  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2010  , INVALID_TYPE >::Type Type;
2011  //**********************************************************************************************
2012 };
2014 //*************************************************************************************************
2015 
2016 
2017 
2018 
2019 //=================================================================================================
2020 //
2021 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2022 //
2023 //=================================================================================================
2024 
2025 //*************************************************************************************************
2027 template< typename MT1, typename ST, typename MT2 >
2028 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2029 {
2030  public:
2031  //**********************************************************************************************
2032  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2033  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2034  IsNumeric<ST>::value
2035  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2036  , INVALID_TYPE >::Type Type;
2037  //**********************************************************************************************
2038 };
2040 //*************************************************************************************************
2041 
2042 
2043 //*************************************************************************************************
2045 template< typename MT1, typename MT2, typename ST >
2046 struct TSMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
2047 {
2048  public:
2049  //**********************************************************************************************
2050  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2051  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2052  IsNumeric<ST>::value
2053  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2054  , INVALID_TYPE >::Type Type;
2055  //**********************************************************************************************
2056 };
2058 //*************************************************************************************************
2059 
2060 
2061 //*************************************************************************************************
2063 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2064 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,false> >
2065 {
2066  public:
2067  //**********************************************************************************************
2068  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2069  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2070  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2071  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2072  , INVALID_TYPE >::Type Type;
2073  //**********************************************************************************************
2074 };
2076 //*************************************************************************************************
2077 
2078 
2079 
2080 
2081 //=================================================================================================
2082 //
2083 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2084 //
2085 //=================================================================================================
2086 
2087 //*************************************************************************************************
2089 template< typename MT1, typename ST, typename MT2 >
2090 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2091 {
2092  public:
2093  //**********************************************************************************************
2094  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2095  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2096  IsNumeric<ST>::value
2097  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2098  , INVALID_TYPE >::Type Type;
2099  //**********************************************************************************************
2100 };
2102 //*************************************************************************************************
2103 
2104 
2105 //*************************************************************************************************
2107 template< typename MT1, typename MT2, typename ST >
2108 struct TSMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2109 {
2110  public:
2111  //**********************************************************************************************
2112  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2113  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2114  IsNumeric<ST>::value
2115  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2116  , INVALID_TYPE >::Type Type;
2117  //**********************************************************************************************
2118 };
2120 //*************************************************************************************************
2121 
2122 
2123 //*************************************************************************************************
2125 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2126 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,true> >
2127 {
2128  public:
2129  //**********************************************************************************************
2130  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2131  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2132  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2133  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2134  , INVALID_TYPE >::Type Type;
2135  //**********************************************************************************************
2136 };
2138 //*************************************************************************************************
2139 
2140 
2141 
2142 
2143 //=================================================================================================
2144 //
2145 // ROWEXPRTRAIT SPECIALIZATIONS
2146 //
2147 //=================================================================================================
2148 
2149 //*************************************************************************************************
2151 template< typename MT, typename ST, bool SO >
2152 struct RowExprTrait< SMatScalarMultExpr<MT,ST,SO> >
2153 {
2154  public:
2155  //**********************************************************************************************
2156  typedef typename MultExprTrait< typename RowExprTrait<const MT>::Type, ST >::Type Type;
2157  //**********************************************************************************************
2158 };
2160 //*************************************************************************************************
2161 
2162 
2163 
2164 
2165 //=================================================================================================
2166 //
2167 // COLUMNEXPRTRAIT SPECIALIZATIONS
2168 //
2169 //=================================================================================================
2170 
2171 //*************************************************************************************************
2173 template< typename MT, typename ST, bool SO >
2174 struct ColumnExprTrait< SMatScalarMultExpr<MT,ST,SO> >
2175 {
2176  public:
2177  //**********************************************************************************************
2178  typedef typename MultExprTrait< typename ColumnExprTrait<const MT>::Type, ST >::Type Type;
2179  //**********************************************************************************************
2180 };
2182 //*************************************************************************************************
2183 
2184 } // namespace blaze
2185 
2186 #endif