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>
56 #include <blaze/util/Assert.h>
60 #include <blaze/util/EnableIf.h>
61 #include <blaze/util/InvalidType.h>
62 #include <blaze/util/SelectType.h>
63 #include <blaze/util/Types.h>
66 
67 
68 namespace blaze {
69 
70 //=================================================================================================
71 //
72 // CLASS SMATSCALARMULTEXPR
73 //
74 //=================================================================================================
75 
76 //*************************************************************************************************
83 template< typename MT // Type of the left-hand side sparse matrix
84  , typename ST // Type of the right-hand side scalar value
85  , bool SO > // Storage order
86 class SMatScalarMultExpr : public SparseMatrix< SMatScalarMultExpr<MT,ST,SO>, SO >
87  , private Expression
88  , private Computation
89 {
90  private:
91  //**Type definitions****************************************************************************
92  typedef typename MT::ResultType RT;
93  typedef typename MT::ReturnType RN;
94  typedef typename MT::CompositeType CT;
95  //**********************************************************************************************
96 
97  //**Return type evaluation**********************************************************************
99 
104  enum { returnExpr = !IsTemporary<RN>::value };
105 
108  //**********************************************************************************************
109 
110  //**Evaluation strategy*************************************************************************
112 
118  enum { useAssign = RequiresEvaluation<MT>::value };
119 
121 
122  template< typename MT2 >
123  struct UseAssign {
124  enum { value = useAssign };
125  };
127  //**********************************************************************************************
128 
129  public:
130  //**Type definitions****************************************************************************
133  typedef typename ResultType::OppositeType OppositeType;
134  typedef typename ResultType::TransposeType TransposeType;
135  typedef typename ResultType::ElementType ElementType;
136 
139 
142 
144  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
145 
148  //**********************************************************************************************
149 
150  //**Compilation flags***************************************************************************
153  //**********************************************************************************************
154 
155  //**ConstIterator class definition**************************************************************
159  {
160  public:
161  //**Type definitions*************************************************************************
164 
166  typedef typename boost::remove_reference<LeftOperand>::type::ConstIterator IteratorType;
167 
168  typedef std::forward_iterator_tag IteratorCategory;
169  typedef Element ValueType;
173 
174  // STL iterator requirements
180  //*******************************************************************************************
181 
182  //**Constructor******************************************************************************
185  inline ConstIterator( IteratorType matrix, RightOperand scalar )
186  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
187  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
188  {}
189  //*******************************************************************************************
190 
191  //**Prefix increment operator****************************************************************
197  ++matrix_;
198  return *this;
199  }
200  //*******************************************************************************************
201 
202  //**Element access operator******************************************************************
207  inline const Element operator*() const {
208  return Element( matrix_->value() * scalar_, matrix_->index() );
209  }
210  //*******************************************************************************************
211 
212  //**Element access operator******************************************************************
217  inline const ConstIterator* operator->() const {
218  return this;
219  }
220  //*******************************************************************************************
221 
222  //**Value function***************************************************************************
227  inline ReturnType value() const {
228  return matrix_->value() * scalar_;
229  }
230  //*******************************************************************************************
231 
232  //**Index function***************************************************************************
237  inline size_t index() const {
238  return matrix_->index();
239  }
240  //*******************************************************************************************
241 
242  //**Equality operator************************************************************************
248  inline bool operator==( const ConstIterator& rhs ) const {
249  return matrix_ == rhs.matrix_;
250  }
251  //*******************************************************************************************
252 
253  //**Inequality operator**********************************************************************
259  inline bool operator!=( const ConstIterator& rhs ) const {
260  return matrix_ != rhs.matrix_;
261  }
262  //*******************************************************************************************
263 
264  //**Subtraction operator*********************************************************************
270  inline DifferenceType operator-( const ConstIterator& rhs ) const {
271  return matrix_ - rhs.matrix_;
272  }
273  //*******************************************************************************************
274 
275  private:
276  //**Member variables*************************************************************************
279  //*******************************************************************************************
280  };
281  //**********************************************************************************************
282 
283  //**Constructor*********************************************************************************
289  explicit inline SMatScalarMultExpr( const MT& matrix, ST scalar )
290  : matrix_( matrix ) // Left-hand side sparse matrix of the multiplication expression
291  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
292  {}
293  //**********************************************************************************************
294 
295  //**Access operator*****************************************************************************
302  inline ReturnType operator()( size_t i, size_t j ) const {
303  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
304  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
305  return matrix_(i,j) * scalar_;
306  }
307  //**********************************************************************************************
308 
309  //**Begin function******************************************************************************
315  inline ConstIterator begin( size_t i ) const {
316  return ConstIterator( matrix_.begin(i), scalar_ );
317  }
318  //**********************************************************************************************
319 
320  //**End function********************************************************************************
326  inline ConstIterator end( size_t i ) const {
327  return ConstIterator( matrix_.end(i), scalar_ );
328  }
329  //**********************************************************************************************
330 
331  //**Rows function*******************************************************************************
336  inline size_t rows() const {
337  return matrix_.rows();
338  }
339  //**********************************************************************************************
340 
341  //**Columns function****************************************************************************
346  inline size_t columns() const {
347  return matrix_.columns();
348  }
349  //**********************************************************************************************
350 
351  //**NonZeros function***************************************************************************
356  inline size_t nonZeros() const {
357  return matrix_.nonZeros();
358  }
359  //**********************************************************************************************
360 
361  //**NonZeros function***************************************************************************
367  inline size_t nonZeros( size_t i ) const {
368  return matrix_.nonZeros(i);
369  }
370  //**********************************************************************************************
371 
372  //**Left operand access*************************************************************************
377  inline LeftOperand leftOperand() const {
378  return matrix_;
379  }
380  //**********************************************************************************************
381 
382  //**Right operand access************************************************************************
387  inline RightOperand rightOperand() const {
388  return scalar_;
389  }
390  //**********************************************************************************************
391 
392  //**********************************************************************************************
398  template< typename T >
399  inline bool isAliased( const T* alias ) const {
401  !RequiresEvaluation<MT>::value && matrix_.isAliased( alias );
402  }
403  //**********************************************************************************************
404 
405  private:
406  //**Member variables****************************************************************************
409  //**********************************************************************************************
410 
411  //**Assignment to dense matrices****************************************************************
425  template< typename MT2 // Type of the target dense matrix
426  , bool SO2 > // Storage order of the target dense matrix
427  friend inline typename EnableIf< UseAssign<MT2> >::Type
429  {
430  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
431  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
432 
433  assign( ~lhs, rhs.matrix_ );
434  (~lhs) *= rhs.scalar_;
435  }
437  //**********************************************************************************************
438 
439  //**Assignment to sparse matrices***************************************************************
453  template< typename MT2 // Type of the target sparse matrix
454  , bool SO2 > // Storage order of the target sparse matrix
455  friend inline typename EnableIf< UseAssign<MT2> >::Type
457  {
458  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
459  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
460 
461  assign( ~lhs, rhs.matrix_ );
462  (~lhs) *= rhs.scalar_;
463  }
465  //**********************************************************************************************
466 
467  //**Addition assignment to dense matrices*******************************************************
481  template< typename MT2 // Type of the target dense matrix
482  , bool SO2 > // Storage order of the target dense matrix
483  friend inline typename EnableIf< UseAssign<MT2> >::Type
484  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
485  {
487  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename ResultType::CompositeType );
488 
489  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
490  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
491 
492  const ResultType tmp( rhs );
493  addAssign( ~lhs, tmp );
494  }
496  //**********************************************************************************************
497 
498  //**Addition assignment to sparse matrices******************************************************
499  // No special implementation for the addition assignment to sparse matrices.
500  //**********************************************************************************************
501 
502  //**Subtraction assignment to dense matrices****************************************************
516  template< typename MT2 // Type of the target dense matrix
517  , bool SO2 > // Storage order of the target dense matrix
518  friend inline typename EnableIf< UseAssign<MT2> >::Type
519  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
520  {
522  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename ResultType::CompositeType );
523 
524  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
525  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
526 
527  const ResultType tmp( rhs );
528  subAssign( ~lhs, tmp );
529  }
531  //**********************************************************************************************
532 
533  //**Subtraction assignment to sparse matrices***************************************************
534  // No special implementation for the subtraction assignment to sparse matrices.
535  //**********************************************************************************************
536 
537  //**Multiplication assignment to dense matrices*************************************************
538  // No special implementation for the multiplication assignment to dense matrices.
539  //**********************************************************************************************
540 
541  //**Multiplication assignment to sparse matrices************************************************
542  // No special implementation for the multiplication assignment to sparse matrices.
543  //**********************************************************************************************
544 
545  //**Compile time checks*************************************************************************
552  //**********************************************************************************************
553 };
554 //*************************************************************************************************
555 
556 
557 
558 
559 //=================================================================================================
560 //
561 // GLOBAL UNARY ARITHMETIC OPERATORS
562 //
563 //=================================================================================================
564 
565 //*************************************************************************************************
582 template< typename MT // Data type of the sparse matrix
583  , bool SO > // Storage order
586 {
587  typedef typename BaseElementType<MT>::Type ElementType;
589 }
590 //*************************************************************************************************
591 
592 
593 
594 
595 //=================================================================================================
596 //
597 // GLOBAL BINARY ARITHMETIC OPERATORS
598 //
599 //=================================================================================================
600 
601 //*************************************************************************************************
622 template< typename T1 // Type of the left-hand side sparse matrix
623  , bool SO // Storage order of the left-hand side sparse matrix
624  , typename T2 > // Type of the right-hand side scalar
625 inline const typename EnableIf< IsNumeric<T2>, typename MultExprTrait<T1,T2>::Type >::Type
626  operator*( const SparseMatrix<T1,SO>& mat, T2 scalar )
627 {
628  typedef typename MultExprTrait<T1,T2>::Type Type;
629  return Type( ~mat, scalar );
630 }
631 //*************************************************************************************************
632 
633 
634 //*************************************************************************************************
655 template< typename T1 // Type of the left-hand side scalar
656  , typename T2 // Type of the right-hand side sparse matrix
657  , bool SO > // Storage order of the right-hand side sparse matrix
658 inline const typename EnableIf< IsNumeric<T1>, typename MultExprTrait<T1,T2>::Type >::Type
659  operator*( T1 scalar, const SparseMatrix<T2,SO>& mat )
660 {
661  typedef typename MultExprTrait<T1,T2>::Type Type;
662  return Type( ~mat, scalar );
663 }
664 //*************************************************************************************************
665 
666 
667 
668 
669 //=================================================================================================
670 //
671 // GLOBAL RESTRUCTURING UNARY ARITHMETIC OPERATORS
672 //
673 //=================================================================================================
674 
675 //*************************************************************************************************
687 template< typename VT // Type of the sparse matrix
688  , typename ST // Type of the scalar
689  , bool TF > // Transpose flag
690 inline const SMatScalarMultExpr<VT,ST,TF>
692 {
693  return SMatScalarMultExpr<VT,ST,TF>( sm.leftOperand(), -sm.rightOperand() );
694 }
696 //*************************************************************************************************
697 
698 
699 
700 
701 //=================================================================================================
702 //
703 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
704 //
705 //=================================================================================================
706 
707 //*************************************************************************************************
720 template< typename MT // Type of the sparse matrix
721  , typename ST1 // Type of the first scalar
722  , bool SO // Storage order of the sparse matrix
723  , typename ST2 > // Type of the second scalar
724 inline const typename EnableIf< IsNumeric<ST2>
725  , typename MultExprTrait< SMatScalarMultExpr<MT,ST1,SO>, ST2 >::Type >::Type
726  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, ST2 scalar )
727 {
728  return mat.leftOperand() * ( mat.rightOperand() * scalar );
729 }
731 //*************************************************************************************************
732 
733 
734 //*************************************************************************************************
747 template< typename ST1 // Type of the first scalar
748  , typename MT // Type of the sparse matrix
749  , typename ST2 // Type of the second scalar
750  , bool SO > // Storage order of the sparse matrix
751 inline const typename EnableIf< IsNumeric<ST1>
752  , typename MultExprTrait< ST1, SMatScalarMultExpr<MT,ST2,SO> >::Type >::Type
753  operator*( ST1 scalar, const SMatScalarMultExpr<MT,ST2,SO>& mat )
754 {
755  return mat.leftOperand() * ( scalar * mat.rightOperand() );
756 }
758 //*************************************************************************************************
759 
760 
761 //*************************************************************************************************
774 template< typename MT // Type of the sparse matrix
775  , typename ST1 // Type of the first scalar
776  , bool SO // Storage order of the sparse matrix
777  , typename ST2 > // Type of the second scalar
778 inline const typename EnableIf< IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>
779  , typename DivExprTrait< SMatScalarMultExpr<MT,ST1,SO>, ST2 >::Type >::Type
780  operator/( const SMatScalarMultExpr<MT,ST1,SO>& mat, ST2 scalar )
781 {
782  return mat.leftOperand() * ( mat.rightOperand() / scalar );
783 }
785 //*************************************************************************************************
786 
787 
788 //*************************************************************************************************
802 template< typename MT // Type of the sparse matrix of the left-hand side expression
803  , typename ST // Type of the scalar of the left-hand side expression
804  , bool SO // Storage order of the left-hand side expression
805  , typename VT > // Type of the right-hand side dense vector
806 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST,SO>, VT >::Type
807  operator*( const SMatScalarMultExpr<MT,ST,SO>& mat, const DenseVector<VT,false>& vec )
808 {
809  return ( mat.leftOperand() * (~vec) ) * mat.rightOperand();
810 }
812 //*************************************************************************************************
813 
814 
815 //*************************************************************************************************
829 template< typename VT // Type of the left-hand side dense vector
830  , typename MT // Type of the sparse matrix of the right-hand side expression
831  , typename ST // Type of the scalar of the right-hand side expression
832  , bool SO > // Storage order of the right-hand side expression
833 inline const typename MultExprTrait< VT, SMatScalarMultExpr<MT,ST,SO> >::Type
834  operator*( const DenseVector<VT,true>& vec, const SMatScalarMultExpr<MT,ST,SO>& mat )
835 {
836  return ( (~vec) * mat.leftOperand() ) * mat.rightOperand();
837 }
839 //*************************************************************************************************
840 
841 
842 //*************************************************************************************************
858 template< typename MT // Type of the sparse matrix of the left-hand side expression
859  , typename ST1 // Type of the scalar of the left-hand side expression
860  , bool SO // Storage order of the left-hand side expression
861  , typename VT // Type of the dense vector of the right-hand side expression
862  , typename ST2 > // Type of the scalar of the right-hand side expression
863 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST1,SO>, DVecScalarMultExpr<VT,ST2,false> >::Type
864  operator*( const SMatScalarMultExpr<MT,ST1,SO>& mat, const DVecScalarMultExpr<VT,ST2,false>& vec )
865 {
866  return ( mat.leftOperand() * vec.leftOperand() ) * ( mat.rightOperand() * vec.rightOperand() );
867 }
869 //*************************************************************************************************
870 
871 
872 //*************************************************************************************************
888 template< typename VT // Type of the dense vector of the left-hand side expression
889  , typename ST1 // Type of the scalar of the left-hand side expression
890  , typename MT // Type of the sparse matrix of the right-hand side expression
891  , typename ST2 // Type of the scalar of the right-hand side expression
892  , bool SO > // Storage order of the right-hand side expression
893 inline const typename MultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,SO> >::Type
894  operator*( const DVecScalarMultExpr<VT,ST1,true>& vec, const SMatScalarMultExpr<MT,ST2,SO>& mat )
895 {
896  return ( vec.leftOperand() * mat.leftOperand() ) * ( vec.rightOperand() * mat.rightOperand() );
897 }
899 //*************************************************************************************************
900 
901 
902 //*************************************************************************************************
916 template< typename MT // Type of the sparse matrix of the left-hand side expression
917  , typename ST // Type of the scalar of the left-hand side expression
918  , bool SO // Storage order of the left-hand side expression
919  , typename VT > // Type of the right-hand side sparse vector
920 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST,SO>, VT >::Type
922 {
923  return ( mat.leftOperand() * (~vec) ) * mat.rightOperand();
924 }
926 //*************************************************************************************************
927 
928 
929 //*************************************************************************************************
943 template< typename VT // Type of the left-hand side sparse vector
944  , typename MT // Type of the sparse matrix of the right-hand side expression
945  , typename ST // Type of the scalar of the right-hand side expression
946  , bool SO > // Storage order of the right-hand side expression
947 inline const typename MultExprTrait< VT, SMatScalarMultExpr<MT,ST,SO> >::Type
949 {
950  return ( (~vec) * mat.leftOperand() ) * mat.rightOperand();
951 }
953 //*************************************************************************************************
954 
955 
956 //*************************************************************************************************
972 template< typename MT // Type of the sparse matrix of the left-hand side expression
973  , typename ST1 // Type of the scalar of the left-hand side expression
974  , bool SO // Storage order of the left-hand side expression
975  , typename VT // Type of the sparse vector of the right-hand side expression
976  , typename ST2 > // Type of the scalar of the right-hand side expression
977 inline const typename MultExprTrait< SMatScalarMultExpr<MT,ST1,SO>, SVecScalarMultExpr<VT,ST2,false> >::Type
979 {
980  return ( mat.leftOperand() * vec.leftOperand() ) * ( mat.rightOperand() * vec.rightOperand() );
981 }
983 //*************************************************************************************************
984 
985 
986 //*************************************************************************************************
1002 template< typename VT // Type of the sparse vector of the left-hand side expression
1003  , typename ST1 // Type of the scalar of the left-hand side expression
1004  , typename MT // Type of the sparse matrix of the right-hand side expression
1005  , typename ST2 // Type of the scalar of the right-hand side expression
1006  , bool SO > // Storage order of the right-hand side expression
1007 inline const typename MultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,SO> >::Type
1009 {
1010  return ( vec.leftOperand() * mat.leftOperand() ) * ( vec.rightOperand() * mat.rightOperand() );
1011 }
1013 //*************************************************************************************************
1014 
1015 
1016 //*************************************************************************************************
1030 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1031  , typename ST // Type of the scalar of the left-hand side expression
1032  , bool SO1 // Storage order of the left-hand side expression
1033  , typename MT2 // Type of the right-hand side dense matrix
1034  , bool SO2 > // Storage order of the right-hand side dense matrix
1035 inline const typename MultExprTrait< SMatScalarMultExpr<MT1,ST,SO1>, MT2 >::Type
1036  operator*( const SMatScalarMultExpr<MT1,ST,SO1>& lhs, const DenseMatrix<MT2,SO2>& rhs )
1037 {
1038  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1039 }
1041 //*************************************************************************************************
1042 
1043 
1044 //*************************************************************************************************
1058 template< typename MT1 // Type of the left-hand side dense matrix
1059  , bool SO1 // Storage order of the left-hand side dense matrix
1060  , typename MT2 // Type of the sparse matrix of the right-hand side expression
1061  , typename ST // Type of the scalar of the right-hand side expression
1062  , bool SO2 > // Storage order of the right-hand side expression
1063 inline const typename MultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,SO2> >::Type
1064  operator*( const DenseMatrix<MT1,SO1>& lhs, const SMatScalarMultExpr<MT2,ST,SO2>& rhs )
1065 {
1066  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1067 }
1069 //*************************************************************************************************
1070 
1071 
1072 //*************************************************************************************************
1086 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1087  , typename ST // Type of the scalar of the left-hand side expression
1088  , bool SO1 // Storage order of the left-hand side expression
1089  , typename MT2 // Type of the right-hand side sparse matrix
1090  , bool SO2 > // Storage order of the right-hand side sparse matrix
1091 inline const typename MultExprTrait< SMatScalarMultExpr<MT1,ST,SO1>, MT2 >::Type
1093 {
1094  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1095 }
1097 //*************************************************************************************************
1098 
1099 
1100 //*************************************************************************************************
1114 template< typename MT1 // Type of the left-hand side sparse matrix
1115  , bool SO1 // Storage order of the left-hand side sparse matrix
1116  , typename MT2 // Type of the sparse matrix of the right-hand side expression
1117  , typename ST // Type of the scalar of the right-hand side expression
1118  , bool SO2 > // Storage order of the right-hand side expression
1119 inline const typename MultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,SO2> >::Type
1121 {
1122  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1123 }
1125 //*************************************************************************************************
1126 
1127 
1128 //*************************************************************************************************
1142 template< typename MT1 // Type of the sparse matrix of the left-hand side expression
1143  , typename ST1 // Type of the scalar of the left-hand side expression
1144  , bool SO1 // Storage order of the left-hand side expression
1145  , typename MT2 // Type of the right-hand side sparse matrix
1146  , typename ST2 // Type of the scalar of the right-hand side expression
1147  , bool SO2 > // Storage order of the right-hand side expression
1148 inline const typename MultExprTrait< SMatScalarMultExpr<MT1,ST1,SO1>, SMatScalarMultExpr<MT2,ST2,SO2> >::Type
1150 {
1151  return ( lhs.leftOperand() * rhs.leftOperand() ) * ( lhs.rightOperand() * rhs.rightOperand() );
1152 }
1154 //*************************************************************************************************
1155 
1156 
1157 
1158 
1159 //=================================================================================================
1160 //
1161 // SMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1162 //
1163 //=================================================================================================
1164 
1165 //*************************************************************************************************
1167 template< typename MT, typename ST1, typename ST2 >
1168 struct SMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1169 {
1170  public:
1171  //**********************************************************************************************
1172  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1173  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1174  , typename SMatScalarMultExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type
1175  , INVALID_TYPE >::Type Type;
1176  //**********************************************************************************************
1177 };
1179 //*************************************************************************************************
1180 
1181 
1182 
1183 
1184 //=================================================================================================
1185 //
1186 // TSMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1187 //
1188 //=================================================================================================
1189 
1190 //*************************************************************************************************
1192 template< typename MT, typename ST1, typename ST2 >
1193 struct TSMatScalarMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1194 {
1195  public:
1196  //**********************************************************************************************
1197  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1198  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1199  , typename TSMatScalarMultExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type
1200  , INVALID_TYPE >::Type Type;
1201  //**********************************************************************************************
1202 };
1204 //*************************************************************************************************
1205 
1206 
1207 
1208 
1209 //=================================================================================================
1210 //
1211 // SMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1212 //
1213 //=================================================================================================
1214 
1215 //*************************************************************************************************
1217 template< typename MT, typename ST1, typename ST2 >
1218 struct SMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,false>, ST2 >
1219 {
1220  private:
1221  //**********************************************************************************************
1222  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1223  //**********************************************************************************************
1224 
1225  //**********************************************************************************************
1226  typedef typename SMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1227  typedef typename SMatScalarDivExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1228  //**********************************************************************************************
1229 
1230  public:
1231  //**********************************************************************************************
1232  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1233  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1234  , typename SelectType<condition,T1,T2>::Type
1235  , INVALID_TYPE >::Type Type;
1236  //**********************************************************************************************
1237 };
1239 //*************************************************************************************************
1240 
1241 
1242 
1243 
1244 //=================================================================================================
1245 //
1246 // TSMATSCALARDIVEXPRTRAIT SPECIALIZATIONS
1247 //
1248 //=================================================================================================
1249 
1250 //*************************************************************************************************
1252 template< typename MT, typename ST1, typename ST2 >
1253 struct TSMatScalarDivExprTrait< SMatScalarMultExpr<MT,ST1,true>, ST2 >
1254 {
1255  private:
1256  //**********************************************************************************************
1257  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1258  //**********************************************************************************************
1259 
1260  //**********************************************************************************************
1261  typedef typename TSMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1262  typedef typename TSMatScalarDivExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1263  //**********************************************************************************************
1264 
1265  public:
1266  //**********************************************************************************************
1267  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1268  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1269  , typename SelectType<condition,T1,T2>::Type
1270  , INVALID_TYPE >::Type Type;
1271  //**********************************************************************************************
1272 };
1274 //*************************************************************************************************
1275 
1276 
1277 
1278 
1279 //=================================================================================================
1280 //
1281 // SMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1282 //
1283 //=================================================================================================
1284 
1285 //*************************************************************************************************
1287 template< typename MT, typename ST, typename VT >
1288 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1289 {
1290  public:
1291  //**********************************************************************************************
1292  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1293  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1294  IsNumeric<ST>::value
1295  , typename DVecScalarMultExprTrait<typename SMatDVecMultExprTrait<MT,VT>::Type,ST>::Type
1296  , INVALID_TYPE >::Type Type;
1297  //**********************************************************************************************
1298 };
1300 //*************************************************************************************************
1301 
1302 
1303 //*************************************************************************************************
1305 template< typename MT, typename ST1, typename VT, typename ST2 >
1306 struct SMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, DVecScalarMultExpr<VT,ST2,false> >
1307 {
1308  public:
1309  //**********************************************************************************************
1310  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1311  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1312  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1313  , typename DVecScalarMultExprTrait<typename SMatDVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1314  , INVALID_TYPE >::Type Type;
1315  //**********************************************************************************************
1316 };
1318 //*************************************************************************************************
1319 
1320 
1321 
1322 
1323 //=================================================================================================
1324 //
1325 // TSMATDVECMULTEXPRTRAIT SPECIALIZATIONS
1326 //
1327 //=================================================================================================
1328 
1329 //*************************************************************************************************
1331 template< typename MT, typename ST, typename VT >
1332 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1333 {
1334  public:
1335  //**********************************************************************************************
1336  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1337  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1338  IsNumeric<ST>::value
1339  , typename DVecScalarMultExprTrait<typename TSMatDVecMultExprTrait<MT,VT>::Type,ST>::Type
1340  , INVALID_TYPE >::Type Type;
1341  //**********************************************************************************************
1342 };
1344 //*************************************************************************************************
1345 
1346 
1347 //*************************************************************************************************
1349 template< typename MT, typename ST1, typename VT, typename ST2 >
1350 struct TSMatDVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, DVecScalarMultExpr<VT,ST2,false> >
1351 {
1352  public:
1353  //**********************************************************************************************
1354  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1355  IsDenseVector<VT>::value && !IsTransposeVector<VT>::value &&
1356  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1357  , typename DVecScalarMultExprTrait<typename TSMatDVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1358  , INVALID_TYPE >::Type Type;
1359  //**********************************************************************************************
1360 };
1362 //*************************************************************************************************
1363 
1364 
1365 
1366 
1367 //=================================================================================================
1368 //
1369 // TDVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1370 //
1371 //=================================================================================================
1372 
1373 //*************************************************************************************************
1375 template< typename VT, typename MT, typename ST >
1376 struct TDVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1377 {
1378  public:
1379  //**********************************************************************************************
1380  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1381  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1382  IsNumeric<ST>::value
1383  , typename TDVecScalarMultExprTrait<typename TDVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1384  , INVALID_TYPE >::Type Type;
1385  //**********************************************************************************************
1386 };
1388 //*************************************************************************************************
1389 
1390 
1391 //*************************************************************************************************
1393 template< typename VT, typename ST1, typename MT, typename ST2 >
1394 struct TDVecSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1395 {
1396  public:
1397  //**********************************************************************************************
1398  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1399  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1400  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1401  , typename TDVecScalarMultExprTrait<typename TDVecSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1402  , INVALID_TYPE >::Type Type;
1403  //**********************************************************************************************
1404 };
1406 //*************************************************************************************************
1407 
1408 
1409 
1410 
1411 //=================================================================================================
1412 //
1413 // TDVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1414 //
1415 //=================================================================================================
1416 
1417 //*************************************************************************************************
1419 template< typename VT, typename MT, typename ST >
1420 struct TDVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1421 {
1422  public:
1423  //**********************************************************************************************
1424  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1425  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1426  IsNumeric<ST>::value
1427  , typename TDVecScalarMultExprTrait<typename TDVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1428  , INVALID_TYPE >::Type Type;
1429  //**********************************************************************************************
1430 };
1432 //*************************************************************************************************
1433 
1434 
1435 //*************************************************************************************************
1437 template< typename VT, typename ST1, typename MT, typename ST2 >
1438 struct TDVecTSMatMultExprTrait< DVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
1439 {
1440  public:
1441  //**********************************************************************************************
1442  typedef typename SelectType< IsDenseVector<VT>::value && IsTransposeVector<VT>::value &&
1443  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1444  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1445  , typename TDVecScalarMultExprTrait<typename TDVecTSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1446  , INVALID_TYPE >::Type Type;
1447  //**********************************************************************************************
1448 };
1450 //*************************************************************************************************
1451 
1452 
1453 
1454 
1455 //=================================================================================================
1456 //
1457 // SMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1458 //
1459 //=================================================================================================
1460 
1461 //*************************************************************************************************
1463 template< typename MT, typename ST, typename VT >
1464 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,false>, VT >
1465 {
1466  public:
1467  //**********************************************************************************************
1468  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1469  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1470  IsNumeric<ST>::value
1471  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1472  , INVALID_TYPE >::Type Type;
1473  //**********************************************************************************************
1474 };
1476 //*************************************************************************************************
1477 
1478 
1479 //*************************************************************************************************
1481 template< typename MT, typename ST1, typename VT, typename ST2 >
1482 struct SMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,false>, SVecScalarMultExpr<VT,ST2,false> >
1483 {
1484  public:
1485  //**********************************************************************************************
1486  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1487  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1488  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1489  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1490  , INVALID_TYPE >::Type Type;
1491  //**********************************************************************************************
1492 };
1494 //*************************************************************************************************
1495 
1496 
1497 
1498 
1499 //=================================================================================================
1500 //
1501 // TSMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1502 //
1503 //=================================================================================================
1504 
1505 //*************************************************************************************************
1507 template< typename MT, typename ST, typename VT >
1508 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST,true>, VT >
1509 {
1510  public:
1511  //**********************************************************************************************
1512  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1513  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1514  IsNumeric<ST>::value
1515  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1516  , INVALID_TYPE >::Type Type;
1517  //**********************************************************************************************
1518 };
1520 //*************************************************************************************************
1521 
1522 
1523 //*************************************************************************************************
1525 template< typename MT, typename ST1, typename VT, typename ST2 >
1526 struct TSMatSVecMultExprTrait< SMatScalarMultExpr<MT,ST1,true>, SVecScalarMultExpr<VT,ST2,false> >
1527 {
1528  public:
1529  //**********************************************************************************************
1530  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1531  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1532  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1533  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1534  , INVALID_TYPE >::Type Type;
1535  //**********************************************************************************************
1536 };
1538 //*************************************************************************************************
1539 
1540 
1541 
1542 
1543 //=================================================================================================
1544 //
1545 // TSVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1546 //
1547 //=================================================================================================
1548 
1549 //*************************************************************************************************
1551 template< typename VT, typename MT, typename ST >
1552 struct TSVecSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,false> >
1553 {
1554  public:
1555  //**********************************************************************************************
1556  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1557  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1558  IsNumeric<ST>::value
1559  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1560  , INVALID_TYPE >::Type Type;
1561  //**********************************************************************************************
1562 };
1564 //*************************************************************************************************
1565 
1566 
1567 //*************************************************************************************************
1569 template< typename VT, typename ST1, typename MT, typename ST2 >
1570 struct TSVecSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,false> >
1571 {
1572  public:
1573  //**********************************************************************************************
1574  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1575  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1576  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1577  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1578  , INVALID_TYPE >::Type Type;
1579  //**********************************************************************************************
1580 };
1582 //*************************************************************************************************
1583 
1584 
1585 
1586 
1587 //=================================================================================================
1588 //
1589 // TSVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1590 //
1591 //=================================================================================================
1592 
1593 //*************************************************************************************************
1595 template< typename VT, typename MT, typename ST >
1596 struct TSVecTSMatMultExprTrait< VT, SMatScalarMultExpr<MT,ST,true> >
1597 {
1598  public:
1599  //**********************************************************************************************
1600  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1601  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1602  IsNumeric<ST>::value
1603  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1604  , INVALID_TYPE >::Type Type;
1605  //**********************************************************************************************
1606 };
1608 //*************************************************************************************************
1609 
1610 
1611 //*************************************************************************************************
1613 template< typename VT, typename ST1, typename MT, typename ST2 >
1614 struct TSVecTSMatMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, SMatScalarMultExpr<MT,ST2,true> >
1615 {
1616  public:
1617  //**********************************************************************************************
1618  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1619  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1620  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1621  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1622  , INVALID_TYPE >::Type Type;
1623  //**********************************************************************************************
1624 };
1626 //*************************************************************************************************
1627 
1628 
1629 
1630 
1631 //=================================================================================================
1632 //
1633 // DMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1634 //
1635 //=================================================================================================
1636 
1637 //*************************************************************************************************
1639 template< typename MT1, typename MT2, typename ST >
1640 struct DMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1641 {
1642  public:
1643  //**********************************************************************************************
1644  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1645  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1646  IsNumeric<ST>::value
1647  , typename DMatScalarMultExprTrait<typename DMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1648  , INVALID_TYPE >::Type Type;
1649  //**********************************************************************************************
1650 };
1652 //*************************************************************************************************
1653 
1654 
1655 
1656 
1657 //=================================================================================================
1658 //
1659 // DMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1660 //
1661 //=================================================================================================
1662 
1663 //*************************************************************************************************
1665 template< typename MT1, typename MT2, typename ST >
1666 struct DMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1667 {
1668  public:
1669  //**********************************************************************************************
1670  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1671  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1672  IsNumeric<ST>::value
1673  , typename DMatScalarMultExprTrait<typename DMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1674  , INVALID_TYPE >::Type Type;
1675  //**********************************************************************************************
1676 };
1678 //*************************************************************************************************
1679 
1680 
1681 
1682 
1683 //=================================================================================================
1684 //
1685 // TDMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1686 //
1687 //=================================================================================================
1688 
1689 //*************************************************************************************************
1691 template< typename MT1, typename MT2, typename ST >
1692 struct TDMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1693 {
1694  public:
1695  //**********************************************************************************************
1696  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1697  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1698  IsNumeric<ST>::value
1699  , typename TDMatScalarMultExprTrait<typename TDMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1700  , INVALID_TYPE >::Type Type;
1701  //**********************************************************************************************
1702 };
1704 //*************************************************************************************************
1705 
1706 
1707 
1708 
1709 //=================================================================================================
1710 //
1711 // TDMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1712 //
1713 //=================================================================================================
1714 
1715 //*************************************************************************************************
1717 template< typename MT1, typename MT2, typename ST >
1718 struct TDMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1719 {
1720  public:
1721  //**********************************************************************************************
1722  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1723  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1724  IsNumeric<ST>::value
1725  , typename TDMatScalarMultExprTrait<typename TDMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1726  , INVALID_TYPE >::Type Type;
1727  //**********************************************************************************************
1728 };
1730 //*************************************************************************************************
1731 
1732 
1733 
1734 
1735 //=================================================================================================
1736 //
1737 // SMATDMATMULTEXPRTRAIT SPECIALIZATIONS
1738 //
1739 //=================================================================================================
1740 
1741 //*************************************************************************************************
1743 template< typename MT1, typename ST, typename MT2 >
1744 struct SMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1745 {
1746  public:
1747  //**********************************************************************************************
1748  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1749  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1750  IsNumeric<ST>::value
1751  , typename DMatScalarMultExprTrait<typename SMatDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1752  , INVALID_TYPE >::Type Type;
1753  //**********************************************************************************************
1754 };
1756 //*************************************************************************************************
1757 
1758 
1759 
1760 
1761 //=================================================================================================
1762 //
1763 // SMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
1764 //
1765 //=================================================================================================
1766 
1767 //*************************************************************************************************
1769 template< typename MT1, typename ST, typename MT2 >
1770 struct SMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1771 {
1772  public:
1773  //**********************************************************************************************
1774  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1775  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1776  IsNumeric<ST>::value
1777  , typename DMatScalarMultExprTrait<typename SMatTDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1778  , INVALID_TYPE >::Type Type;
1779  //**********************************************************************************************
1780 };
1782 //*************************************************************************************************
1783 
1784 
1785 
1786 
1787 //=================================================================================================
1788 //
1789 // TSMATDMATMULTEXPRTRAIT SPECIALIZATIONS
1790 //
1791 //=================================================================================================
1792 
1793 //*************************************************************************************************
1795 template< typename MT1, typename ST, typename MT2 >
1796 struct TSMatDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
1797 {
1798  public:
1799  //**********************************************************************************************
1800  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1801  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1802  IsNumeric<ST>::value
1803  , typename TDMatScalarMultExprTrait<typename TSMatDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1804  , INVALID_TYPE >::Type Type;
1805  //**********************************************************************************************
1806 };
1808 //*************************************************************************************************
1809 
1810 
1811 
1812 
1813 //=================================================================================================
1814 //
1815 // TSMATTDMATMULTEXPRTRAIT SPECIALIZATIONS
1816 //
1817 //=================================================================================================
1818 
1819 //*************************************************************************************************
1821 template< typename MT1, typename ST, typename MT2 >
1822 struct TSMatTDMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
1823 {
1824  public:
1825  //**********************************************************************************************
1826  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1827  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1828  IsNumeric<ST>::value
1829  , typename TDMatScalarMultExprTrait<typename TSMatTDMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1830  , INVALID_TYPE >::Type Type;
1831  //**********************************************************************************************
1832 };
1834 //*************************************************************************************************
1835 
1836 
1837 
1838 
1839 //=================================================================================================
1840 //
1841 // SMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1842 //
1843 //=================================================================================================
1844 
1845 //*************************************************************************************************
1847 template< typename MT1, typename ST, typename MT2 >
1848 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1849 {
1850  public:
1851  //**********************************************************************************************
1852  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1853  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1854  IsNumeric<ST>::value
1855  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1856  , INVALID_TYPE >::Type Type;
1857  //**********************************************************************************************
1858 };
1860 //*************************************************************************************************
1861 
1862 
1863 //*************************************************************************************************
1865 template< typename MT1, typename MT2, typename ST >
1866 struct SMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1867 {
1868  public:
1869  //**********************************************************************************************
1870  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1871  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1872  IsNumeric<ST>::value
1873  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1874  , INVALID_TYPE >::Type Type;
1875  //**********************************************************************************************
1876 };
1878 //*************************************************************************************************
1879 
1880 
1881 //*************************************************************************************************
1883 template< typename MT1, typename ST1, typename MT2, typename ST2 >
1884 struct SMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,false> >
1885 {
1886  public:
1887  //**********************************************************************************************
1888  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1889  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1890  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1891  , typename SMatScalarMultExprTrait<typename SMatSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1892  , INVALID_TYPE >::Type Type;
1893  //**********************************************************************************************
1894 };
1896 //*************************************************************************************************
1897 
1898 
1899 
1900 
1901 //=================================================================================================
1902 //
1903 // SMATTSMATMULTEXPRTRAIT SPECIALIZATIONS
1904 //
1905 //=================================================================================================
1906 
1907 //*************************************************************************************************
1909 template< typename MT1, typename ST, typename MT2 >
1910 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,false>, MT2 >
1911 {
1912  public:
1913  //**********************************************************************************************
1914  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1915  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1916  IsNumeric<ST>::value
1917  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1918  , INVALID_TYPE >::Type Type;
1919  //**********************************************************************************************
1920 };
1922 //*************************************************************************************************
1923 
1924 
1925 //*************************************************************************************************
1927 template< typename MT1, typename MT2, typename ST >
1928 struct SMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
1929 {
1930  public:
1931  //**********************************************************************************************
1932  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1933  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1934  IsNumeric<ST>::value
1935  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1936  , INVALID_TYPE >::Type Type;
1937  //**********************************************************************************************
1938 };
1940 //*************************************************************************************************
1941 
1942 
1943 //*************************************************************************************************
1945 template< typename MT1, typename ST1, typename MT2, typename ST2 >
1946 struct SMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,false>, SMatScalarMultExpr<MT2,ST2,true> >
1947 {
1948  public:
1949  //**********************************************************************************************
1950  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
1951  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
1952  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1953  , typename SMatScalarMultExprTrait<typename SMatTSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1954  , INVALID_TYPE >::Type Type;
1955  //**********************************************************************************************
1956 };
1958 //*************************************************************************************************
1959 
1960 
1961 
1962 
1963 //=================================================================================================
1964 //
1965 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
1966 //
1967 //=================================================================================================
1968 
1969 //*************************************************************************************************
1971 template< typename MT1, typename ST, typename MT2 >
1972 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
1973 {
1974  public:
1975  //**********************************************************************************************
1976  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1977  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1978  IsNumeric<ST>::value
1979  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1980  , INVALID_TYPE >::Type Type;
1981  //**********************************************************************************************
1982 };
1984 //*************************************************************************************************
1985 
1986 
1987 //*************************************************************************************************
1989 template< typename MT1, typename MT2, typename ST >
1990 struct TSMatSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,false> >
1991 {
1992  public:
1993  //**********************************************************************************************
1994  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
1995  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
1996  IsNumeric<ST>::value
1997  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
1998  , INVALID_TYPE >::Type Type;
1999  //**********************************************************************************************
2000 };
2002 //*************************************************************************************************
2003 
2004 
2005 //*************************************************************************************************
2007 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2008 struct TSMatSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,false> >
2009 {
2010  public:
2011  //**********************************************************************************************
2012  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2013  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
2014  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2015  , typename TSMatScalarMultExprTrait<typename TSMatSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2016  , INVALID_TYPE >::Type Type;
2017  //**********************************************************************************************
2018 };
2020 //*************************************************************************************************
2021 
2022 
2023 
2024 
2025 //=================================================================================================
2026 //
2027 // TSMATSMATMULTEXPRTRAIT SPECIALIZATIONS
2028 //
2029 //=================================================================================================
2030 
2031 //*************************************************************************************************
2033 template< typename MT1, typename ST, typename MT2 >
2034 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST,true>, MT2 >
2035 {
2036  public:
2037  //**********************************************************************************************
2038  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2039  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2040  IsNumeric<ST>::value
2041  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2042  , INVALID_TYPE >::Type Type;
2043  //**********************************************************************************************
2044 };
2046 //*************************************************************************************************
2047 
2048 
2049 //*************************************************************************************************
2051 template< typename MT1, typename MT2, typename ST >
2052 struct TSMatTSMatMultExprTrait< MT1, SMatScalarMultExpr<MT2,ST,true> >
2053 {
2054  public:
2055  //**********************************************************************************************
2056  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2057  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2058  IsNumeric<ST>::value
2059  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,ST>::Type
2060  , INVALID_TYPE >::Type Type;
2061  //**********************************************************************************************
2062 };
2064 //*************************************************************************************************
2065 
2066 
2067 //*************************************************************************************************
2069 template< typename MT1, typename ST1, typename MT2, typename ST2 >
2070 struct TSMatTSMatMultExprTrait< SMatScalarMultExpr<MT1,ST1,true>, SMatScalarMultExpr<MT2,ST2,true> >
2071 {
2072  public:
2073  //**********************************************************************************************
2074  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
2075  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
2076  IsNumeric<ST1>::value && IsNumeric<ST2>::value
2077  , typename TSMatScalarMultExprTrait<typename TSMatTSMatMultExprTrait<MT1,MT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
2078  , INVALID_TYPE >::Type Type;
2079  //**********************************************************************************************
2080 };
2082 //*************************************************************************************************
2083 
2084 } // namespace blaze
2085 
2086 #endif