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>
31 #include <boost/type_traits/remove_reference.hpp>
57 #include <blaze/util/Assert.h>
61 #include <blaze/util/EnableIf.h>
62 #include <blaze/util/InvalidType.h>
64 #include <blaze/util/SelectType.h>
65 #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 Expression
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 
150  //**********************************************************************************************
151 
152  //**ConstIterator class definition**************************************************************
156  {
157  public:
158  //**Type definitions*************************************************************************
161 
163  typedef typename boost::remove_reference<LeftOperand>::type::ConstIterator IteratorType;
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 // GLOBAL OPERATORS
1218 //
1219 //=================================================================================================
1220 
1221 //*************************************************************************************************
1233 template< typename MT // Type of the left-hand side sparse matrix
1234  , typename ST // Type of the right-hand side scalar value
1235  , bool SO > // Storage order
1236 inline typename RowExprTrait< SMatScalarMultExpr<MT,ST,SO> >::Type
1237  row( const SMatScalarMultExpr<MT,ST,SO>& sm, size_t index )
1238 {
1240 
1241  return row( sm.leftOperand(), index ) * sm.rightOperand();
1242 }
1244 //*************************************************************************************************
1245 
1246 
1247 //*************************************************************************************************
1259 template< typename MT // Type of the left-hand side sparse matrix
1260  , typename ST // Type of the right-hand side scalar value
1261  , bool SO > // Storage order
1262 inline typename ColumnExprTrait< SMatScalarMultExpr<MT,ST,SO> >::Type
1263  column( const SMatScalarMultExpr<MT,ST,SO>& sm, size_t index )
1264 {
1266 
1267  return column( sm.leftOperand(), index ) * sm.rightOperand();
1268 }
1270 //*************************************************************************************************
1271 
1272 
1273 
1274 
1275 //=================================================================================================
1276 //
1277 // SMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1278 //
1279 //=================================================================================================
1280 
1281 //*************************************************************************************************
1283 template< typename MT, typename ST1, typename ST2 >
1284 struct SMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1285 {
1286  public:
1287  //**********************************************************************************************
1288  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1289  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1290  , typename SMatScalarMultExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type
1291  , INVALID_TYPE >::Type Type;
1292  //**********************************************************************************************
1293 };
1295 //*************************************************************************************************
1296 
1297 
1298 
1299 
1300 //=================================================================================================
1301 //
1302 // TSMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1303 //
1304 //=================================================================================================
1305 
1306 //*************************************************************************************************
1308 template< typename MT, typename ST1, typename ST2 >
1309 struct TSMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1310 {
1311  public:
1312  //**********************************************************************************************
1313  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1314  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1315  , typename TSMatScalarMultExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type
1316  , INVALID_TYPE >::Type Type;
1317  //**********************************************************************************************
1318 };
1320 //*************************************************************************************************
1321 
1322 
1323 
1324 
1325 //=================================================================================================
1326 //
1327 // SMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1328 //
1329 //=================================================================================================
1330 
1331 //*************************************************************************************************
1333 template< typename MT, typename ST1, typename ST2 >
1334 struct SMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1335 {
1336  private:
1337  //**********************************************************************************************
1338  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1339  //**********************************************************************************************
1340 
1341  //**********************************************************************************************
1342  typedef typename SMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1343  typedef typename SMatScalarDivExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1344  //**********************************************************************************************
1345 
1346  public:
1347  //**********************************************************************************************
1348  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1349  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1350  , typename SelectType<condition,T1,T2>::Type
1351  , INVALID_TYPE >::Type Type;
1352  //**********************************************************************************************
1353 };
1355 //*************************************************************************************************
1356 
1357 
1358 
1359 
1360 //=================================================================================================
1361 //
1362 // TSMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1363 //
1364 //=================================================================================================
1365 
1366 //*************************************************************************************************
1368 template< typename MT, typename ST1, typename ST2 >
1369 struct TSMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1370 {
1371  private:
1372  //**********************************************************************************************
1373  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1374  //**********************************************************************************************
1375 
1376  //**********************************************************************************************
1377  typedef typename TSMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1378  typedef typename TSMatScalarDivExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1379  //**********************************************************************************************
1380 
1381  public:
1382  //**********************************************************************************************
1383  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1384  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1385  , typename SelectType<condition,T1,T2>::Type
1386  , INVALID_TYPE >::Type Type;
1387  //**********************************************************************************************
1388 };
1390 //*************************************************************************************************
1391 
1392 
1393 
1394 
1395 //=================================================================================================
1396 //
1397 // SMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1398 //
1399 //=================================================================================================
1400 
1401 //*************************************************************************************************
1403 template< typename MT, typename ST, typename VT >
1404 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1405 {
1406  public:
1407  //**********************************************************************************************
1408  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1409  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1410  IsNumeric<ST>::value
1411  , typename DVecScalarMultExprTrait<typename SMatDVecMultExprTrait<MT,VT>::Type,ST>::Type
1412  , INVALID_TYPE >::Type Type;
1413  //**********************************************************************************************
1414 };
1416 //*************************************************************************************************
1417 
1418 
1419 //*************************************************************************************************
1421 template< typename MT, typename ST1, typename VT, typename ST2 >
1422 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, DVecScalarMultExpr<VT,ST2,false> >
1423 {
1424  public:
1425  //**********************************************************************************************
1426  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1427  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1428  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1429  , typename DVecScalarMultExprTrait<typename SMatDVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1430  , INVALID_TYPE >::Type Type;
1431  //**********************************************************************************************
1432 };
1434 //*************************************************************************************************
1435 
1436 
1437 
1438 
1439 //=================================================================================================
1440 //
1441 // TSMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1442 //
1443 //=================================================================================================
1444 
1445 //*************************************************************************************************
1447 template< typename MT, typename ST, typename VT >
1448 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1449 {
1450  public:
1451  //**********************************************************************************************
1452  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1453  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1454  IsNumeric<ST>::value
1455  , typename DVecScalarMultExprTrait<typename TSMatDVecMultExprTrait<MT,VT>::Type,ST>::Type
1456  , INVALID_TYPE >::Type Type;
1457  //**********************************************************************************************
1458 };
1460 //*************************************************************************************************
1461 
1462 
1463 //*************************************************************************************************
1465 template< typename MT, typename ST1, typename VT, typename ST2 >
1466 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, DVecScalarMultExpr<VT,ST2,false> >
1467 {
1468  public:
1469  //**********************************************************************************************
1470  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1471  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1472  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1473  , typename DVecScalarMultExprTrait<typename TSMatDVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1474  , INVALID_TYPE >::Type Type;
1475  //**********************************************************************************************
1476 };
1478 //*************************************************************************************************
1479 
1480 
1481 
1482 
1483 //=================================================================================================
1484 //
1485 // TDVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1486 //
1487 //=================================================================================================
1488 
1489 //*************************************************************************************************
1491 template< typename VT, typename MT, typename ST >
1492 struct TDVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1493 {
1494  public:
1495  //**********************************************************************************************
1496  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1497  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1498  IsNumeric<ST>::value
1499  , typename TDVecScalarMultExprTrait<typename TDVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1500  , INVALID_TYPE >::Type Type;
1501  //**********************************************************************************************
1502 };
1504 //*************************************************************************************************
1505 
1506 
1507 //*************************************************************************************************
1509 template< typename VT, typename ST1, typename MT, typename ST2 >
1510 struct TDVecSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1511 {
1512  public:
1513  //**********************************************************************************************
1514  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1515  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1516  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1517  , typename TDVecScalarMultExprTrait<typename TDVecSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1518  , INVALID_TYPE >::Type Type;
1519  //**********************************************************************************************
1520 };
1522 //*************************************************************************************************
1523 
1524 
1525 
1526 
1527 //=================================================================================================
1528 //
1529 // TDVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1530 //
1531 //=================================================================================================
1532 
1533 //*************************************************************************************************
1535 template< typename VT, typename MT, typename ST >
1536 struct TDVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1537 {
1538  public:
1539  //**********************************************************************************************
1540  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1541  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1542  IsNumeric<ST>::value
1543  , typename TDVecScalarMultExprTrait<typename TDVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1544  , INVALID_TYPE >::Type Type;
1545  //**********************************************************************************************
1546 };
1548 //*************************************************************************************************
1549 
1550 
1551 //*************************************************************************************************
1553 template< typename VT, typename ST1, typename MT, typename ST2 >
1554 struct TDVecTSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
1555 {
1556  public:
1557  //**********************************************************************************************
1558  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1559  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1560  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1561  , typename TDVecScalarMultExprTrait<typename TDVecTSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1562  , INVALID_TYPE >::Type Type;
1563  //**********************************************************************************************
1564 };
1566 //*************************************************************************************************
1567 
1568 
1569 
1570 
1571 //=================================================================================================
1572 //
1573 // SMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1574 //
1575 //=================================================================================================
1576 
1577 //*************************************************************************************************
1579 template< typename MT, typename ST, typename VT >
1580 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1581 {
1582  public:
1583  //**********************************************************************************************
1584  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1585  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1586  IsNumeric<ST>::value
1587  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1588  , INVALID_TYPE >::Type Type;
1589  //**********************************************************************************************
1590 };
1592 //*************************************************************************************************
1593 
1594 
1595 //*************************************************************************************************
1597 template< typename MT, typename ST1, typename VT, typename ST2 >
1598 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, SVecScalarMultExpr<VT,ST2,false> >
1599 {
1600  public:
1601  //**********************************************************************************************
1602  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1603  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1604  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1605  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1606  , INVALID_TYPE >::Type Type;
1607  //**********************************************************************************************
1608 };
1610 //*************************************************************************************************
1611 
1612 
1613 
1614 
1615 //=================================================================================================
1616 //
1617 // TSMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1618 //
1619 //=================================================================================================
1620 
1621 //*************************************************************************************************
1623 template< typename MT, typename ST, typename VT >
1624 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1625 {
1626  public:
1627  //**********************************************************************************************
1628  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1629  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1630  IsNumeric<ST>::value
1631  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1632  , INVALID_TYPE >::Type Type;
1633  //**********************************************************************************************
1634 };
1636 //*************************************************************************************************
1637 
1638 
1639 //*************************************************************************************************
1641 template< typename MT, typename ST1, typename VT, typename ST2 >
1642 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, SVecScalarMultExpr<VT,ST2,false> >
1643 {
1644  public:
1645  //**********************************************************************************************
1646  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1647  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1648  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1649  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1650  , INVALID_TYPE >::Type Type;
1651  //**********************************************************************************************
1652 };
1654 //*************************************************************************************************
1655 
1656 
1657 
1658 
1659 //=================================================================================================
1660 //
1661 // TSVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1662 //
1663 //=================================================================================================
1664 
1665 //*************************************************************************************************
1667 template< typename VT, typename MT, typename ST >
1668 struct TSVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1669 {
1670  public:
1671  //**********************************************************************************************
1672  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1673  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1674  IsNumeric<ST>::value
1675  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1676  , INVALID_TYPE >::Type Type;
1677  //**********************************************************************************************
1678 };
1680 //*************************************************************************************************
1681 
1682 
1683 //*************************************************************************************************
1685 template< typename VT, typename ST1, typename MT, typename ST2 >
1686 struct TSVecSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1687 {
1688  public:
1689  //**********************************************************************************************
1690  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1691  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1692  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1693  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1694  , INVALID_TYPE >::Type Type;
1695  //**********************************************************************************************
1696 };
1698 //*************************************************************************************************
1699 
1700 
1701 
1702 
1703 //=================================================================================================
1704 //
1705 // TSVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1706 //
1707 //=================================================================================================
1708 
1709 //*************************************************************************************************
1711 template< typename VT, typename MT, typename ST >
1712 struct TSVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1713 {
1714  public:
1715  //**********************************************************************************************
1716  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1717  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1718  IsNumeric<ST>::value
1719  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1720  , INVALID_TYPE >::Type Type;
1721  //**********************************************************************************************
1722 };
1724 //*************************************************************************************************
1725 
1726 
1727 //*************************************************************************************************
1729 template< typename VT, typename ST1, typename MT, typename ST2 >
1730 struct TSVecTSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
1731 {
1732  public:
1733  //**********************************************************************************************
1734  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1735  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1736  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1737  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1738  , INVALID_TYPE >::Type Type;
1739  //**********************************************************************************************
1740 };
1742 //*************************************************************************************************
1743 
1744 
1745 
1746 
1747 //=================================================================================================
1748 //
1749 // DMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1750 //
1751 //=================================================================================================
1752 
1753 //*************************************************************************************************
1755 template< typename MT1, typename MT2, typename ST >
1756 struct DMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1757 {
1758  public:
1759  //**********************************************************************************************
1760  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1761  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1762  IsNumeric<ST>::value
1763  , typename DMatScalarMultExprTrait<typename DMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1764  , INVALID_TYPE >::Type Type;
1765  //**********************************************************************************************
1766 };
1768 //*************************************************************************************************
1769 
1770 
1771 
1772 
1773 //=================================================================================================
1774 //
1775 // DMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1776 //
1777 //=================================================================================================
1778 
1779 //*************************************************************************************************
1781 template< typename MT1, typename MT2, typename ST >
1782 struct DMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1783 {
1784  public:
1785  //**********************************************************************************************
1786  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1787  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1788  IsNumeric<ST>::value
1789  , typename DMatScalarMultExprTrait<typename DMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1790  , INVALID_TYPE >::Type Type;
1791  //**********************************************************************************************
1792 };
1794 //*************************************************************************************************
1795 
1796 
1797 
1798 
1799 //=================================================================================================
1800 //
1801 // TDMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1802 //
1803 //=================================================================================================
1804 
1805 //*************************************************************************************************
1807 template< typename MT1, typename MT2, typename ST >
1808 struct TDMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1809 {
1810  public:
1811  //**********************************************************************************************
1812  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1813  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1814  IsNumeric<ST>::value
1815  , typename TDMatScalarMultExprTrait<typename TDMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1816  , INVALID_TYPE >::Type Type;
1817  //**********************************************************************************************
1818 };
1820 //*************************************************************************************************
1821 
1822 
1823 
1824 
1825 //=================================================================================================
1826 //
1827 // TDMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1828 //
1829 //=================================================================================================
1830 
1831 //*************************************************************************************************
1833 template< typename MT1, typename MT2, typename ST >
1834 struct TDMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1835 {
1836  public:
1837  //**********************************************************************************************
1838  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1839  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1840  IsNumeric<ST>::value
1841  , typename TDMatScalarMultExprTrait<typename TDMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1842  , INVALID_TYPE >::Type Type;
1843  //**********************************************************************************************
1844 };
1846 //*************************************************************************************************
1847 
1848 
1849 
1850 
1851 //=================================================================================================
1852 //
1853 // SMATDMATMULTEXPRTRAIT SPECIALIZATIONS
1854 //
1855 //=================================================================================================
1856 
1857 //*************************************************************************************************
1859 template< typename MT1, typename ST, typename MT2 >
1860 struct SMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1861 {
1862  public:
1863  //**********************************************************************************************
1864  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1865  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1866  IsNumeric<ST>::value
1867  , typename DMatScalarMultExprTrait<typename SMatDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1868  , INVALID_TYPE >::Type Type;
1869  //**********************************************************************************************
1870 };
1872 //*************************************************************************************************
1873 
1874 
1875 
1876 
1877 //=================================================================================================
1878 //
1879 // SMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
1880 //
1881 //=================================================================================================
1882 
1883 //*************************************************************************************************
1885 template< typename MT1, typename ST, typename MT2 >
1886 struct SMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1887 {
1888  public:
1889  //**********************************************************************************************
1890  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1891  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1892  IsNumeric<ST>::value
1893  , typename DMatScalarMultExprTrait<typename SMatTDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1894  , INVALID_TYPE >::Type Type;
1895  //**********************************************************************************************
1896 };
1898 //*************************************************************************************************
1899 
1900 
1901 
1902 
1903 //=================================================================================================
1904 //
1905 // TSMATDMATMULTEXPRTRAIT SPECIALIZATIONS
1906 //
1907 //=================================================================================================
1908 
1909 //*************************************************************************************************
1911 template< typename MT1, typename ST, typename MT2 >
1912 struct TSMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
1913 {
1914  public:
1915  //**********************************************************************************************
1916  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1917  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1918  IsNumeric<ST>::value
1919  , typename TDMatScalarMultExprTrait<typename TSMatDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1920  , INVALID_TYPE >::Type Type;
1921  //**********************************************************************************************
1922 };
1924 //*************************************************************************************************
1925 
1926 
1927 
1928 
1929 //=================================================================================================
1930 //
1931 // TSMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
1932 //
1933 //=================================================================================================
1934 
1935 //*************************************************************************************************
1937 template< typename MT1, typename ST, typename MT2 >
1938 struct TSMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
1939 {
1940  public:
1941  //**********************************************************************************************
1942  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1943  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1944  IsNumeric<ST>::value
1945  , typename TDMatScalarMultExprTrait<typename TSMatTDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1946  , INVALID_TYPE >::Type Type;
1947  //**********************************************************************************************
1948 };
1950 //*************************************************************************************************
1951 
1952 
1953 
1954 
1955 //=================================================================================================
1956 //
1957 // SMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1958 //
1959 //=================================================================================================
1960 
1961 //*************************************************************************************************
1963 template< typename MT1, typename ST, typename MT2 >
1964 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1965 {
1966  public:
1967  //**********************************************************************************************
1968  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1969  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1970  IsNumeric<ST>::value
1971  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1972  , INVALID_TYPE >::Type Type;
1973  //**********************************************************************************************
1974 };
1976 //*************************************************************************************************
1977 
1978 
1979 //*************************************************************************************************
1981 template< typename MT1, typename MT2, typename ST >
1982 struct SMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1983 {
1984  public:
1985  //**********************************************************************************************
1986  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1987  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1988  IsNumeric<ST>::value
1989  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1990  , INVALID_TYPE >::Type Type;
1991  //**********************************************************************************************
1992 };
1994 //*************************************************************************************************
1995 
1996 
1997 //*************************************************************************************************
1999 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2000 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,false> >
2001 {
2002  public:
2003  //**********************************************************************************************
2004  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
2005  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2006  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2007  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2008  , INVALID_TYPE >::Type Type;
2009  //**********************************************************************************************
2010 };
2012 //*************************************************************************************************
2013 
2014 
2015 
2016 
2017 //=================================================================================================
2018 //
2019 // SMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
2020 //
2021 //=================================================================================================
2022 
2023 //*************************************************************************************************
2025 template< typename MT1, typename ST, typename MT2 >
2026 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
2027 {
2028  public:
2029  //**********************************************************************************************
2030  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
2031  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2032  IsNumeric<ST>::value
2033  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2034  , INVALID_TYPE >::Type Type;
2035  //**********************************************************************************************
2036 };
2038 //*************************************************************************************************
2039 
2040 
2041 //*************************************************************************************************
2043 template< typename MT1, typename MT2, typename ST >
2044 struct SMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2045 {
2046  public:
2047  //**********************************************************************************************
2048  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
2049  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2050  IsNumeric<ST>::value
2051  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2052  , INVALID_TYPE >::Type Type;
2053  //**********************************************************************************************
2054 };
2056 //*************************************************************************************************
2057 
2058 
2059 //*************************************************************************************************
2061 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2062 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,true> >
2063 {
2064  public:
2065  //**********************************************************************************************
2066  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
2067  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2068  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2069  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2070  , INVALID_TYPE >::Type Type;
2071  //**********************************************************************************************
2072 };
2074 //*************************************************************************************************
2075 
2076 
2077 
2078 
2079 //=================================================================================================
2080 //
2081 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2082 //
2083 //=================================================================================================
2084 
2085 //*************************************************************************************************
2087 template< typename MT1, typename ST, typename MT2 >
2088 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2089 {
2090  public:
2091  //**********************************************************************************************
2092  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2093  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2094  IsNumeric<ST>::value
2095  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2096  , INVALID_TYPE >::Type Type;
2097  //**********************************************************************************************
2098 };
2100 //*************************************************************************************************
2101 
2102 
2103 //*************************************************************************************************
2105 template< typename MT1, typename MT2, typename ST >
2106 struct TSMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
2107 {
2108  public:
2109  //**********************************************************************************************
2110  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2111  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2112  IsNumeric<ST>::value
2113  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2114  , INVALID_TYPE >::Type Type;
2115  //**********************************************************************************************
2116 };
2118 //*************************************************************************************************
2119 
2120 
2121 //*************************************************************************************************
2123 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2124 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,false> >
2125 {
2126  public:
2127  //**********************************************************************************************
2128  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2129  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2130  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2131  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2132  , INVALID_TYPE >::Type Type;
2133  //**********************************************************************************************
2134 };
2136 //*************************************************************************************************
2137 
2138 
2139 
2140 
2141 //=================================================================================================
2142 //
2143 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2144 //
2145 //=================================================================================================
2146 
2147 //*************************************************************************************************
2149 template< typename MT1, typename ST, typename MT2 >
2150 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2151 {
2152  public:
2153  //**********************************************************************************************
2154  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2155  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2156  IsNumeric<ST>::value
2157  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2158  , INVALID_TYPE >::Type Type;
2159  //**********************************************************************************************
2160 };
2162 //*************************************************************************************************
2163 
2164 
2165 //*************************************************************************************************
2167 template< typename MT1, typename MT2, typename ST >
2168 struct TSMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2169 {
2170  public:
2171  //**********************************************************************************************
2172  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2173  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2174  IsNumeric<ST>::value
2175  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2176  , INVALID_TYPE >::Type Type;
2177  //**********************************************************************************************
2178 };
2180 //*************************************************************************************************
2181 
2182 
2183 //*************************************************************************************************
2185 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2186 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,true> >
2187 {
2188  public:
2189  //**********************************************************************************************
2190  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2191  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2192  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2193  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2194  , INVALID_TYPE >::Type Type;
2195  //**********************************************************************************************
2196 };
2198 //*************************************************************************************************
2199 
2200 
2201 
2202 
2203 //=================================================================================================
2204 //
2205 // ROWEXPRTRAIT SPECIALIZATIONS
2206 //
2207 //=================================================================================================
2208 
2209 //*************************************************************************************************
2211 template< typename MT, typename ST, bool SO >
2212 struct RowExprTrait< SMatScalarMultExpr<MT,ST,SO> >
2213 {
2214  public:
2215  //**********************************************************************************************
2216  typedef typename MultExprTrait< typename RowExprTrait<const MT>::Type, ST >::Type Type;
2217  //**********************************************************************************************
2218 };
2220 //*************************************************************************************************
2221 
2222 
2223 
2224 
2225 //=================================================================================================
2226 //
2227 // COLUMNEXPRTRAIT SPECIALIZATIONS
2228 //
2229 //=================================================================================================
2230 
2231 //*************************************************************************************************
2233 template< typename MT, typename ST, bool SO >
2234 struct ColumnExprTrait< SMatScalarMultExpr<MT,ST,SO> >
2235 {
2236  public:
2237  //**********************************************************************************************
2238  typedef typename MultExprTrait< typename ColumnExprTrait<const MT>::Type, ST >::Type Type;
2239  //**********************************************************************************************
2240 };
2242 //*************************************************************************************************
2243 
2244 } // namespace blaze
2245 
2246 #endif