All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SVecScalarMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECSCALARMULTEXPR_H_
23 #define _BLAZE_MATH_EXPRESSIONS_SVECSCALARMULTEXPR_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <iterator>
54 #include <blaze/util/Assert.h>
59 #include <blaze/util/EnableIf.h>
60 #include <blaze/util/InvalidType.h>
62 #include <blaze/util/SelectType.h>
63 #include <blaze/util/Types.h>
67 
68 
69 namespace blaze {
70 
71 //=================================================================================================
72 //
73 // CLASS SVECSCALARMULTEXPR
74 //
75 //=================================================================================================
76 
77 //*************************************************************************************************
84 template< typename VT // Type of the left-hand side sparse vector
85  , typename ST // Type of the right-hand side scalar value
86  , bool TF > // Transpose flag
87 class SVecScalarMultExpr : public SparseVector< SVecScalarMultExpr<VT,ST,TF>, TF >
88  , private VecScalarMultExpr
89  , private Computation
90 {
91  private:
92  //**Type definitions****************************************************************************
93  typedef typename VT::ResultType RT;
94  typedef typename VT::ReturnType RN;
95  typedef typename VT::CompositeType CT;
96  //**********************************************************************************************
97 
98  //**Return type evaluation**********************************************************************
100 
105  enum { returnExpr = !IsTemporary<RN>::value };
106 
109  //**********************************************************************************************
110 
111  //**Evaluation strategy*************************************************************************
113 
119  enum { useAssign = RequiresEvaluation<VT>::value };
120 
122 
123  template< typename VT2 >
124  struct UseAssign {
125  enum { value = useAssign };
126  };
128  //**********************************************************************************************
129 
130  public:
131  //**Type definitions****************************************************************************
134  typedef typename ResultType::TransposeType TransposeType;
135  typedef typename ResultType::ElementType ElementType;
136 
139 
142 
144  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
145 
147  typedef ST RightOperand;
148  //**********************************************************************************************
149 
150  //**ConstIterator class definition**************************************************************
154  {
155  public:
156  //**Type definitions*************************************************************************
159 
162 
163  typedef std::forward_iterator_tag IteratorCategory;
164  typedef Element ValueType;
168 
169  // STL iterator requirements
175  //*******************************************************************************************
176 
177  //**Constructor******************************************************************************
180  inline ConstIterator( IteratorType vector, RightOperand scalar )
181  : vector_( vector ) // Iterator over the elements of the left-hand side sparse vector expression
182  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
183  {}
184  //*******************************************************************************************
185 
186  //**Prefix increment operator****************************************************************
192  ++vector_;
193  return *this;
194  }
195  //*******************************************************************************************
196 
197  //**Element access operator******************************************************************
202  inline const Element operator*() const {
203  return Element( vector_->value() * scalar_, vector_->index() );
204  }
205  //*******************************************************************************************
206 
207  //**Element access operator******************************************************************
212  inline const ConstIterator* operator->() const {
213  return this;
214  }
215  //*******************************************************************************************
216 
217  //**Value function***************************************************************************
222  inline ReturnType value() const {
223  return vector_->value() * scalar_;
224  }
225  //*******************************************************************************************
226 
227  //**Index function***************************************************************************
232  inline size_t index() const {
233  return vector_->index();
234  }
235  //*******************************************************************************************
236 
237  //**Equality operator************************************************************************
243  inline bool operator==( const ConstIterator& rhs ) const {
244  return vector_ == rhs.vector_;
245  }
246  //*******************************************************************************************
247 
248  //**Inequality operator**********************************************************************
254  inline bool operator!=( const ConstIterator& rhs ) const {
255  return vector_ != rhs.vector_;
256  }
257  //*******************************************************************************************
258 
259  //**Subtraction operator*********************************************************************
265  inline DifferenceType operator-( const ConstIterator& rhs ) const {
266  return vector_ - rhs.vector_;
267  }
268  //*******************************************************************************************
269 
270  private:
271  //**Member variables*************************************************************************
274  //*******************************************************************************************
275  };
276  //**********************************************************************************************
277 
278  //**Constructor*********************************************************************************
284  explicit inline SVecScalarMultExpr( const VT& vector, ST scalar )
285  : vector_( vector ) // Left-hand side sparse vector of the multiplication expression
286  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
287  {}
288  //**********************************************************************************************
289 
290  //**Subscript operator**************************************************************************
296  inline ReturnType operator[]( size_t index ) const {
297  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
298  return vector_[index] * scalar_;
299  }
300  //**********************************************************************************************
301 
302  //**Begin function******************************************************************************
307  inline ConstIterator begin() const {
308  return ConstIterator( vector_.begin(), scalar_ );
309  }
310  //**********************************************************************************************
311 
312  //**End function********************************************************************************
317  inline ConstIterator end() const {
318  return ConstIterator( vector_.end(), scalar_ );
319  }
320  //**********************************************************************************************
321 
322  //**Size function*******************************************************************************
327  inline size_t size() const {
328  return vector_.size();
329  }
330  //**********************************************************************************************
331 
332  //**NonZeros function***************************************************************************
337  inline size_t nonZeros() const {
338  return vector_.nonZeros();
339  }
340  //**********************************************************************************************
341 
342  //**Left operand access*************************************************************************
347  inline LeftOperand leftOperand() const {
348  return vector_;
349  }
350  //**********************************************************************************************
351 
352  //**Right operand access************************************************************************
357  inline RightOperand rightOperand() const {
358  return scalar_;
359  }
360  //**********************************************************************************************
361 
362  //**********************************************************************************************
368  template< typename T >
369  inline bool canAlias( const T* alias ) const {
370  return vector_.canAlias( alias );
371  }
372  //**********************************************************************************************
373 
374  //**********************************************************************************************
380  template< typename T >
381  inline bool isAliased( const T* alias ) const {
382  return vector_.isAliased( alias );
383  }
384  //**********************************************************************************************
385 
386  private:
387  //**Member variables****************************************************************************
390  //**********************************************************************************************
391 
392  //**Assignment to dense vectors*****************************************************************
406  template< typename VT2 > // Type of the target dense vector
407  friend inline typename EnableIf< UseAssign<VT2> >::Type
408  assign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
409  {
411 
412  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
413 
414  assign( ~lhs, rhs.vector_ );
415 
416  const size_t size( rhs.size() );
417  for( size_t i=0UL; i<size; ++i )
418  (~lhs)[i] *= rhs.scalar_;
419  }
421  //**********************************************************************************************
422 
423  //**Assignment to sparse vectors****************************************************************
437  template< typename VT2 > // Type of the target sparse vector
438  friend inline typename EnableIf< UseAssign<VT2> >::Type
440  {
442 
443  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
444 
445  assign( ~lhs, rhs.vector_ );
446 
447  typename VT2::Iterator begin( (~lhs).begin() );
448  const typename VT2::Iterator end( (~lhs).end() );
449 
450  for( ; begin!=end; ++begin )
451  begin->value() *= rhs.scalar_;
452  }
454  //**********************************************************************************************
455 
456  //**Addition assignment to dense vectors********************************************************
470  template< typename VT2 > // Type of the target dense vector
471  friend inline typename EnableIf< UseAssign<VT2> >::Type
472  addAssign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
473  {
475 
478  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename ResultType::CompositeType );
479 
480  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
481 
482  const ResultType tmp( rhs );
483  addAssign( ~lhs, tmp );
484  }
486  //**********************************************************************************************
487 
488  //**Addition assignment to sparse vectors*******************************************************
489  // No special implementation for the addition assignment to sparse vectors.
490  //**********************************************************************************************
491 
492  //**Subtraction assignment to dense vectors*****************************************************
506  template< typename VT2 > // Type of the target dense vector
507  friend inline typename EnableIf< UseAssign<VT2> >::Type
508  subAssign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
509  {
511 
514  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename ResultType::CompositeType );
515 
516  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
517 
518  const ResultType tmp( rhs );
519  subAssign( ~lhs, tmp );
520  }
522  //**********************************************************************************************
523 
524  //**Subtraction assignment to sparse vectors****************************************************
525  // No special implementation for the subtraction assignment to sparse vectors.
526  //**********************************************************************************************
527 
528  //**Multiplication assignment to dense vectors**************************************************
542  template< typename VT2 > // Type of the target dense vector
543  friend inline typename EnableIf< UseAssign<VT2> >::Type
544  multAssign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
545  {
547 
550  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename ResultType::CompositeType );
551 
552  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
553 
554  const ResultType tmp( rhs );
555  multAssign( ~lhs, tmp );
556  }
558  //**********************************************************************************************
559 
560  //**Multiplication assignment to sparse vectors*************************************************
561  // No special implementation for the multiplication assignment to sparse vectors.
562  //**********************************************************************************************
563 
564  //**Compile time checks*************************************************************************
571  //**********************************************************************************************
572 };
573 //*************************************************************************************************
574 
575 
576 
577 
578 //=================================================================================================
579 //
580 // GLOBAL UNARY ARITHMETIC OPERATORS
581 //
582 //=================================================================================================
583 
584 //*************************************************************************************************
601 template< typename VT // Type of the sparse vector
602  , bool TF > // Transpose flag
603 inline const SVecScalarMultExpr<VT,typename BaseElementType<VT>::Type,TF>
605 {
607 
608  typedef typename BaseElementType<VT>::Type ElementType;
609  return SVecScalarMultExpr<VT,ElementType,TF>( ~sv, ElementType(-1) );
610 }
611 //*************************************************************************************************
612 
613 
614 
615 
616 //=================================================================================================
617 //
618 // GLOBAL BINARY ARITHMETIC OPERATORS
619 //
620 //=================================================================================================
621 
622 //*************************************************************************************************
643 template< typename T1 // Type of the left-hand side sparse vector
644  , typename T2 // Type of the right-hand side scalar
645  , bool TF > // Transpose flag
646 inline const typename EnableIf< IsNumeric<T2>, typename MultExprTrait<T1,T2>::Type >::Type
647  operator*( const SparseVector<T1,TF>& vec, T2 scalar )
648 {
650 
651  typedef typename MultExprTrait<T1,T2>::Type Type;
652  return Type( ~vec, scalar );
653 }
654 //*************************************************************************************************
655 
656 
657 //*************************************************************************************************
678 template< typename T1 // Type of the left-hand side scalar
679  , typename T2 // Type of the right-hand side sparse vector
680  , bool TF > // Transpose flag
681 inline const typename EnableIf< IsNumeric<T1>, typename MultExprTrait<T1,T2>::Type >::Type
682  operator*( T1 scalar, const SparseVector<T2,TF>& vec )
683 {
685 
686  typedef typename MultExprTrait<T1,T2>::Type Type;
687  return Type( ~vec, scalar );
688 }
689 //*************************************************************************************************
690 
691 
692 
693 
694 //=================================================================================================
695 //
696 // GLOBAL FUNCTIONS
697 //
698 //=================================================================================================
699 
700 //*************************************************************************************************
718 template< typename VT // Type of the sparse vector
719  , bool TF > // Transpose flag
720 inline const SVecScalarMultExpr<VT,typename VT::ElementType,TF>
722 {
723  typedef typename VT::ElementType ElementType;
724 
726 
727  const ElementType len ( length( ~vec ) );
728  const ElementType ilen( ( len != ElementType(0) )?( ElementType(1) / len ):( 0 ) );
729 
730  return SVecScalarMultExpr<VT,ElementType,TF>( ~vec, ilen );
731 }
732 //*************************************************************************************************
733 
734 
735 
736 
737 //=================================================================================================
738 //
739 // GLOBAL RESTRUCTURING UNARY ARITHMETIC OPERATORS
740 //
741 //=================================================================================================
742 
743 //*************************************************************************************************
755 template< typename VT // Type of the sparse vector
756  , typename ST // Type of the scalar
757  , bool TF > // Transpose flag
758 inline const SVecScalarMultExpr<VT,ST,TF>
759  operator-( const SVecScalarMultExpr<VT,ST,TF>& sv )
760 {
762 
763  return SVecScalarMultExpr<VT,ST,TF>( sv.leftOperand(), -sv.rightOperand() );
764 }
766 //*************************************************************************************************
767 
768 
769 
770 
771 //=================================================================================================
772 //
773 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
774 //
775 //=================================================================================================
776 
777 //*************************************************************************************************
790 template< typename VT // Type of the sparse vector of the left-hand side expression
791  , typename ST1 // Type of the scalar of the left-hand side expression
792  , bool TF // Transpose flag of the sparse vector
793  , typename ST2 > // Type of the right-hand side scalar
794 inline const typename EnableIf< IsNumeric<ST2>
795  , typename MultExprTrait< SVecScalarMultExpr<VT,ST1,TF>, ST2 >::Type >::Type
796  operator*( const SVecScalarMultExpr<VT,ST1,TF>& vec, ST2 scalar )
797 {
799 
800  return vec.leftOperand() * ( vec.rightOperand() * scalar );
801 }
803 //*************************************************************************************************
804 
805 
806 //*************************************************************************************************
819 template< typename ST1 // Type of the left-hand side scalar
820  , typename VT // Type of the sparse vector of the right-hand side expression
821  , typename ST2 // Type of the scalar of the right-hand side expression
822  , bool TF > // Transpose flag of the sparse vector
823 inline const typename EnableIf< IsNumeric<ST1>
824  , typename MultExprTrait< ST1, SVecScalarMultExpr<VT,ST2,TF> >::Type >::Type
825  operator*( ST1 scalar, const SVecScalarMultExpr<VT,ST2,TF>& vec )
826 {
828 
829  return vec.leftOperand() * ( scalar * vec.rightOperand() );
830 }
832 //*************************************************************************************************
833 
834 
835 //*************************************************************************************************
848 template< typename VT // Type of the dense vector of the left-hand side expression
849  , typename ST1 // Type of the scalar of the left-hand side expression
850  , bool TF // Transpose flag of the dense vector
851  , typename ST2 > // Type of the right-hand side scalar
852 inline const typename EnableIf< IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>
853  , typename DivExprTrait< SVecScalarMultExpr<VT,ST1,TF>, ST2 >::Type >::Type
854  operator/( const SVecScalarMultExpr<VT,ST1,TF>& vec, ST2 scalar )
855 {
857 
858  return vec.leftOperand() * ( vec.rightOperand() / scalar );
859 }
861 //*************************************************************************************************
862 
863 
864 //*************************************************************************************************
878 template< typename VT1 // Type of the sparse vector of the left-hand side expression
879  , typename ST // Type of the scalar of the left-hand side expression
880  , bool TF // Transpose flag of the dense vectors
881  , typename VT2 > // Type of the right-hand side dense vector
882 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,TF>, VT2 >::Type
883  operator*( const SVecScalarMultExpr<VT1,ST,TF>& lhs, const DenseVector<VT2,TF>& rhs )
884 {
886 
887  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
888 }
890 //*************************************************************************************************
891 
892 
893 //*************************************************************************************************
907 template< typename VT1 // Type of the left-hand side dense vector
908  , bool TF // Transpose flag of the dense vectors
909  , typename VT2 // Type of the sparse vector of the right-hand side expression
910  , typename ST > // Type of the scalar of the right-hand side expression
911 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,TF> >::Type
912  operator*( const DenseVector<VT1,TF>& lhs, const SVecScalarMultExpr<VT2,ST,TF>& rhs )
913 {
915 
916  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
917 }
919 //*************************************************************************************************
920 
921 
922 //*************************************************************************************************
936 template< typename VT1 // Type of the sparse vector of the left-hand side expression
937  , typename ST // Type of the scalar of the left-hand side expression
938  , typename VT2 > // Type of the right-hand side dense vector
939 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >::Type
940  operator*( const SVecScalarMultExpr<VT1,ST,false>& lhs, const DenseVector<VT2,true>& rhs )
941 {
943 
944  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
945 }
947 //*************************************************************************************************
948 
949 
950 //*************************************************************************************************
964 template< typename VT1 // Type of the left-hand side dense vector
965  , typename VT2 // Type of the sparse vector of the right-hand side expression
966  , typename ST > // Type of the scalar of the right-hand side expression
967 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >::Type
968  operator*( const DenseVector<VT1,false>& lhs, const SVecScalarMultExpr<VT2,ST,true>& rhs )
969 {
971 
972  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
973 }
975 //*************************************************************************************************
976 
977 
978 //*************************************************************************************************
992 template< typename VT1 // Type of the sparse vector of the left-hand side expression
993  , typename ST // Type of the scalar of the left-hand side expression
994  , bool TF // Transpose flag of the vectors
995  , typename VT2 > // Type of the right-hand side sparse vector
996 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,TF>, VT2 >::Type
997  operator*( const SVecScalarMultExpr<VT1,ST,TF>& lhs, const SparseVector<VT2,TF>& rhs )
998 {
1000 
1001  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1002 }
1004 //*************************************************************************************************
1005 
1006 
1007 //*************************************************************************************************
1021 template< typename VT1 // Type of the left-hand side sparse vector
1022  , bool TF // Transpose flag of the vectors
1023  , typename VT2 // Type of the sparse vector of the right-hand side expression
1024  , typename ST > // Type of the scalar of the right-hand side expression
1025 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,TF> >::Type
1026  operator*( const SparseVector<VT1,TF>& lhs, const SVecScalarMultExpr<VT2,ST,TF>& rhs )
1027 {
1029 
1030  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1031 }
1033 //*************************************************************************************************
1034 
1035 
1036 //*************************************************************************************************
1050 template< typename VT1 // Type of the sparse vector of the left-hand side expression
1051  , typename ST1 // Type of the scalar of the left-hand side expression
1052  , bool TF // Transpose flag of the sparse vectors
1053  , typename VT2 // Type of the sparse vector of the right-hand side expression
1054  , typename ST2 > // Type of the scalar of the right-hand side expression
1055 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST1,TF>, SVecScalarMultExpr<VT2,ST2,TF> >::Type
1056  operator*( const SVecScalarMultExpr<VT1,ST1,TF>& lhs, const SVecScalarMultExpr<VT2,ST2,TF>& rhs )
1057 {
1059 
1060  return ( lhs.leftOperand() * rhs.leftOperand() ) * ( lhs.rightOperand() * rhs.rightOperand() );
1061 }
1063 //*************************************************************************************************
1064 
1065 
1066 //*************************************************************************************************
1080 template< typename VT1 // Type of the sparse vector of the left-hand side expression
1081  , typename ST // Type of the scalar of the left-hand side expression
1082  , typename VT2 > // Type of the right-hand side sparse vector
1083 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >::Type
1084  operator*( const SVecScalarMultExpr<VT1,ST,false>& lhs, const SparseVector<VT2,true>& rhs )
1085 {
1087 
1088  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1089 }
1091 //*************************************************************************************************
1092 
1093 
1094 //*************************************************************************************************
1108 template< typename VT1 // Type of the left-hand side sparse vector
1109  , typename VT2 // Type of the sparse vector of the right-hand side expression
1110  , typename ST > // Type of the scalar of the right-hand side expression
1111 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >::Type
1112  operator*( const SparseVector<VT1,false>& lhs, const SVecScalarMultExpr<VT2,ST,true>& rhs )
1113 {
1115 
1116  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1117 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1136 template< typename VT1 // Type of the sparse vector of the left-hand side expression
1137  , typename ST1 // Type of the scalar of the left-hand side expression
1138  , typename VT2 // Type of the sparse vector of the right-hand side expression
1139  , typename ST2 > // Type of the scalar of the right-hand side expression
1140 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST1,false>, SVecScalarMultExpr<VT2,ST2,true> >::Type
1141  operator*( const SVecScalarMultExpr<VT1,ST1,false>& lhs, const SVecScalarMultExpr<VT2,ST2,true>& rhs )
1142 {
1144 
1145  return ( lhs.leftOperand() * rhs.leftOperand() ) * ( lhs.rightOperand() * rhs.rightOperand() );
1146 }
1148 //*************************************************************************************************
1149 
1150 
1151 //*************************************************************************************************
1165 template< typename MT // Type of the left-hand side dense matrix
1166  , bool SO // Storage order of the left-hand side dense matrix
1167  , typename VT // Type of the sparse vector of the right-hand side expression
1168  , typename ST > // Type of the scalar of the right-hand side expression
1169 inline const typename MultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >::Type
1170  operator*( const DenseMatrix<MT,SO>& mat, const SVecScalarMultExpr<VT,ST,false>& vec )
1171 {
1173 
1174  return ( (~mat) * vec.leftOperand() ) * vec.rightOperand();
1175 }
1177 //*************************************************************************************************
1178 
1179 
1180 //*************************************************************************************************
1194 template< typename VT // Type of the sparse vector of the left-hand side expression
1195  , typename ST // Type of the scalar of the left-hand side expression
1196  , typename MT // Type of the right-hand side dense matrix
1197  , bool SO > // Storage order of the right-hand side dense matrix
1198 inline const typename MultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >::Type
1199  operator*( const SVecScalarMultExpr<VT,ST,true>& vec, const DenseMatrix<MT,SO>& mat )
1200 {
1202 
1203  return ( vec.leftOperand() * (~mat) ) * vec.rightOperand();
1204 }
1206 //*************************************************************************************************
1207 
1208 
1209 //*************************************************************************************************
1223 template< typename MT // Type of the left-hand side sparse matrix
1224  , bool SO // Storage order of the left-hand side sparse matrix
1225  , typename VT // Type of the sparse vector of the right-hand side expression
1226  , typename ST > // Type of the scalar of the right-hand side expression
1227 inline const typename MultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >::Type
1228  operator*( const SparseMatrix<MT,SO>& mat, const SVecScalarMultExpr<VT,ST,false>& vec )
1229 {
1231 
1232  return ( (~mat) * vec.leftOperand() ) * vec.rightOperand();
1233 }
1235 //*************************************************************************************************
1236 
1237 
1238 //*************************************************************************************************
1252 template< typename VT // Type of the sparse vector of the left-hand side expression
1253  , typename ST // Type of the scalar of the left-hand side expression
1254  , typename MT // Type of the right-hand side sparse matrix
1255  , bool SO > // Storage order of the right-hand side sparse matrix
1256 inline const typename MultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >::Type
1257  operator*( const SVecScalarMultExpr<VT,ST,true>& vec, const SparseMatrix<MT,SO>& mat )
1258 {
1260 
1261  return ( vec.leftOperand() * (~mat) ) * vec.rightOperand();
1262 }
1264 //*************************************************************************************************
1265 
1266 
1267 
1268 
1269 //=================================================================================================
1270 //
1271 // SVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1272 //
1273 //=================================================================================================
1274 
1275 //*************************************************************************************************
1277 template< typename VT, typename ST1, typename ST2 >
1278 struct SVecScalarMultExprTrait< SVecScalarMultExpr<VT,ST1,false>, ST2 >
1279 {
1280  public:
1281  //**********************************************************************************************
1282  typedef typename SelectType< IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1283  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1284  , typename SVecScalarMultExprTrait<VT,typename MultTrait<ST1,ST2>::Type>::Type
1285  , INVALID_TYPE >::Type Type;
1286  //**********************************************************************************************
1287 };
1289 //*************************************************************************************************
1290 
1291 
1292 
1293 
1294 //=================================================================================================
1295 //
1296 // TSVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1297 //
1298 //=================================================================================================
1299 
1300 //*************************************************************************************************
1302 template< typename VT, typename ST1, typename ST2 >
1303 struct TSVecScalarMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, ST2 >
1304 {
1305  public:
1306  //**********************************************************************************************
1307  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1308  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1309  , typename TSVecScalarMultExprTrait<VT,typename MultTrait<ST1,ST2>::Type>::Type
1310  , INVALID_TYPE >::Type Type;
1311  //**********************************************************************************************
1312 };
1314 //*************************************************************************************************
1315 
1316 
1317 
1318 
1319 //=================================================================================================
1320 //
1321 // SVECSCALARDIVEXPRTRAIT SPECIALIZATIONS
1322 //
1323 //=================================================================================================
1324 
1325 //*************************************************************************************************
1327 template< typename VT, typename ST1, typename ST2 >
1328 struct SVecScalarDivExprTrait< SVecScalarMultExpr<VT,ST1,false>, ST2 >
1329 {
1330  private:
1331  //**********************************************************************************************
1332  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1333  //**********************************************************************************************
1334 
1335  //**********************************************************************************************
1336  typedef typename SVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1337  typedef typename SVecScalarDivExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1338  //**********************************************************************************************
1339 
1340  public:
1341  //**********************************************************************************************
1342  typedef typename SelectType< IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1343  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1344  , typename SelectType<condition,T1,T2>::Type
1345  , INVALID_TYPE >::Type Type;
1346  //**********************************************************************************************
1347 };
1349 //*************************************************************************************************
1350 
1351 
1352 
1353 
1354 //=================================================================================================
1355 //
1356 // TSVECSCALARDIVEXPRTRAIT SPECIALIZATIONS
1357 //
1358 //=================================================================================================
1359 
1360 //*************************************************************************************************
1362 template< typename VT, typename ST1, typename ST2 >
1363 struct TSVecScalarDivExprTrait< SVecScalarMultExpr<VT,ST1,true>, ST2 >
1364 {
1365  private:
1366  //**********************************************************************************************
1367  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1368  //**********************************************************************************************
1369 
1370  //**********************************************************************************************
1371  typedef typename TSVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1372  typedef typename TSVecScalarDivExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1373  //**********************************************************************************************
1374 
1375  public:
1376  //**********************************************************************************************
1377  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1378  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1379  , typename SelectType<condition,T1,T2>::Type
1380  , INVALID_TYPE >::Type Type;
1381  //**********************************************************************************************
1382 };
1384 //*************************************************************************************************
1385 
1386 
1387 
1388 
1389 //=================================================================================================
1390 //
1391 // DVECSVECMULTEXPRTRAIT SPECIALIZATIONS
1392 //
1393 //=================================================================================================
1394 
1395 //*************************************************************************************************
1397 template< typename VT1, typename VT2, typename ST >
1398 struct DVecSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,false> >
1399 {
1400  public:
1401  //**********************************************************************************************
1402  typedef typename SelectType< IsDenseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1403  IsSparseVector<VT2>::value && !IsTransposeVector<VT2>::value &&
1404  IsNumeric<ST>::value
1405  , typename SVecScalarMultExprTrait<typename DVecSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1406  , INVALID_TYPE >::Type Type;
1407  //**********************************************************************************************
1408 };
1410 //*************************************************************************************************
1411 
1412 
1413 
1414 
1415 //=================================================================================================
1416 //
1417 // DVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1418 //
1419 //=================================================================================================
1420 
1421 //*************************************************************************************************
1423 template< typename VT1, typename VT2, typename ST >
1424 struct DVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1425 {
1426  public:
1427  //**********************************************************************************************
1428  typedef typename SelectType< IsDenseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1429  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1430  IsNumeric<ST>::value
1431  , typename SMatScalarMultExprTrait<typename DVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1432  , INVALID_TYPE >::Type Type;
1433  //**********************************************************************************************
1434 };
1436 //*************************************************************************************************
1437 
1438 
1439 
1440 
1441 //=================================================================================================
1442 //
1443 // TDVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1444 //
1445 //=================================================================================================
1446 
1447 //*************************************************************************************************
1449 template< typename VT1, typename VT2, typename ST >
1450 struct TDVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1451 {
1452  public:
1453  //**********************************************************************************************
1454  typedef typename SelectType< IsDenseVector<VT1>::value && IsTransposeVector<VT1>::value &&
1455  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1456  IsNumeric<ST>::value
1457  , typename TSVecScalarMultExprTrait<typename TDVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1458  , INVALID_TYPE >::Type Type;
1459  //**********************************************************************************************
1460 };
1462 //*************************************************************************************************
1463 
1464 
1465 
1466 
1467 //=================================================================================================
1468 //
1469 // SVECDVECMULTEXPRTRAIT SPECIALIZATIONS
1470 //
1471 //=================================================================================================
1472 
1473 //*************************************************************************************************
1475 template< typename VT1, typename ST, typename VT2 >
1476 struct SVecDVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1477 {
1478  public:
1479  //**********************************************************************************************
1480  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1481  IsDenseVector<VT2>::value && !IsTransposeVector<VT2>::value &&
1482  IsNumeric<ST>::value
1483  , typename SVecScalarMultExprTrait<typename SVecDVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1484  , INVALID_TYPE >::Type Type;
1485  //**********************************************************************************************
1486 };
1488 //*************************************************************************************************
1489 
1490 
1491 
1492 
1493 //=================================================================================================
1494 //
1495 // SVECTDVECMULTEXPRTRAIT SPECIALIZATIONS
1496 //
1497 //=================================================================================================
1498 
1499 //*************************************************************************************************
1501 template< typename VT1, typename ST, typename VT2 >
1502 struct SVecTDVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1503 {
1504  public:
1505  //**********************************************************************************************
1506  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1507  IsDenseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1508  IsNumeric<ST>::value
1509  , typename TSMatScalarMultExprTrait<typename SVecTDVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1510  , INVALID_TYPE >::Type Type;
1511  //**********************************************************************************************
1512 };
1514 //*************************************************************************************************
1515 
1516 
1517 
1518 
1519 //=================================================================================================
1520 //
1521 // TSVECTDVECMULTEXPRTRAIT SPECIALIZATIONS
1522 //
1523 //=================================================================================================
1524 
1525 //*************************************************************************************************
1527 template< typename VT1, typename ST, typename VT2 >
1528 struct TSVecTDVecMultExprTrait< SVecScalarMultExpr<VT1,ST,true>, VT2 >
1529 {
1530  public:
1531  //**********************************************************************************************
1532  typedef typename SelectType< IsSparseVector<VT1>::value && IsTransposeVector<VT1>::value &&
1533  IsDenseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1534  IsNumeric<ST>::value
1535  , typename TSVecScalarMultExprTrait<typename TSVecTDVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1536  , INVALID_TYPE >::Type Type;
1537  //**********************************************************************************************
1538 };
1540 //*************************************************************************************************
1541 
1542 
1543 
1544 
1545 //=================================================================================================
1546 //
1547 // SVECSVECMULTEXPRTRAIT SPECIALIZATIONS
1548 //
1549 //=================================================================================================
1550 
1551 //*************************************************************************************************
1553 template< typename VT1, typename ST, typename VT2 >
1554 struct SVecSVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1555 {
1556  public:
1557  //**********************************************************************************************
1558  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1559  IsSparseVector<VT2>::value && !IsTransposeVector<VT2>::value &&
1560  IsNumeric<ST>::value
1561  , typename SVecScalarMultExprTrait<typename SVecSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1562  , INVALID_TYPE >::Type Type;
1563  //**********************************************************************************************
1564 };
1566 //*************************************************************************************************
1567 
1568 
1569 //*************************************************************************************************
1571 template< typename VT1, typename VT2, typename ST >
1572 struct SVecSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,false> >
1573 {
1574  public:
1575  //**********************************************************************************************
1576  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1577  IsSparseVector<VT2>::value && !IsTransposeVector<VT2>::value &&
1578  IsNumeric<ST>::value
1579  , typename SVecScalarMultExprTrait<typename SVecSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1580  , INVALID_TYPE >::Type Type;
1581  //**********************************************************************************************
1582 };
1584 //*************************************************************************************************
1585 
1586 
1587 //*************************************************************************************************
1589 template< typename VT1, typename ST1, typename VT2, typename ST2 >
1590 struct SVecSVecMultExprTrait< SVecScalarMultExpr<VT1,ST1,false>, SVecScalarMultExpr<VT2,ST2,false> >
1591 {
1592  public:
1593  //**********************************************************************************************
1594  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1595  IsSparseVector<VT2>::value && !IsTransposeVector<VT2>::value &&
1596  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1597  , typename SVecScalarMultExprTrait<typename SVecSVecMultExprTrait<VT1,VT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1598  , INVALID_TYPE >::Type Type;
1599  //**********************************************************************************************
1600 };
1602 //*************************************************************************************************
1603 
1604 
1605 
1606 
1607 //=================================================================================================
1608 //
1609 // SVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1610 //
1611 //=================================================================================================
1612 
1613 //*************************************************************************************************
1615 template< typename VT1, typename ST, typename VT2 >
1616 struct SVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1617 {
1618  public:
1619  //**********************************************************************************************
1620  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1621  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1622  IsNumeric<ST>::value
1623  , typename SMatScalarMultExprTrait<typename SVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1624  , INVALID_TYPE >::Type Type;
1625  //**********************************************************************************************
1626 };
1628 //*************************************************************************************************
1629 
1630 
1631 //*************************************************************************************************
1633 template< typename VT1, typename VT2, typename ST >
1634 struct SVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1635 {
1636  public:
1637  //**********************************************************************************************
1638  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1639  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1640  IsNumeric<ST>::value
1641  , typename SMatScalarMultExprTrait<typename SVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1642  , INVALID_TYPE >::Type Type;
1643  //**********************************************************************************************
1644 };
1646 //*************************************************************************************************
1647 
1648 
1649 //*************************************************************************************************
1651 template< typename VT1, typename ST1, typename VT2, typename ST2 >
1652 struct SVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST1,false>, SVecScalarMultExpr<VT2,ST2,true> >
1653 {
1654  public:
1655  //**********************************************************************************************
1656  typedef typename SelectType< IsSparseVector<VT1>::value && !IsTransposeVector<VT1>::value &&
1657  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1658  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1659  , typename SMatScalarMultExprTrait<typename SVecTSVecMultExprTrait<VT1,VT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1660  , INVALID_TYPE >::Type Type;
1661  //**********************************************************************************************
1662 };
1664 //*************************************************************************************************
1665 
1666 
1667 
1668 
1669 //=================================================================================================
1670 //
1671 // TSVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1672 //
1673 //=================================================================================================
1674 
1675 //*************************************************************************************************
1677 template< typename VT1, typename ST, typename VT2 >
1678 struct TSVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST,true>, VT2 >
1679 {
1680  public:
1681  //**********************************************************************************************
1682  typedef typename SelectType< IsSparseVector<VT1>::value && IsTransposeVector<VT1>::value &&
1683  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1684  IsNumeric<ST>::value
1685  , typename TSVecScalarMultExprTrait<typename TSVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1686  , INVALID_TYPE >::Type Type;
1687  //**********************************************************************************************
1688 };
1690 //*************************************************************************************************
1691 
1692 
1693 //*************************************************************************************************
1695 template< typename VT1, typename VT2, typename ST >
1696 struct TSVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1697 {
1698  public:
1699  //**********************************************************************************************
1700  typedef typename SelectType< IsSparseVector<VT1>::value && IsTransposeVector<VT1>::value &&
1701  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1702  IsNumeric<ST>::value
1703  , typename TSVecScalarMultExprTrait<typename TSVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1704  , INVALID_TYPE >::Type Type;
1705  //**********************************************************************************************
1706 };
1708 //*************************************************************************************************
1709 
1710 
1711 //*************************************************************************************************
1713 template< typename VT1, typename ST1, typename VT2, typename ST2 >
1714 struct TSVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST1,true>, SVecScalarMultExpr<VT2,ST2,true> >
1715 {
1716  public:
1717  //**********************************************************************************************
1718  typedef typename SelectType< IsSparseVector<VT1>::value && IsTransposeVector<VT1>::value &&
1719  IsSparseVector<VT2>::value && IsTransposeVector<VT2>::value &&
1720  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1721  , typename TSVecScalarMultExprTrait<typename TSVecTSVecMultExprTrait<VT1,VT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1722  , INVALID_TYPE >::Type Type;
1723  //**********************************************************************************************
1724 };
1726 //*************************************************************************************************
1727 
1728 
1729 
1730 
1731 //=================================================================================================
1732 //
1733 // DMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1734 //
1735 //=================================================================================================
1736 
1737 //*************************************************************************************************
1739 template< typename MT, typename VT, typename ST >
1740 struct DMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1741 {
1742  public:
1743  //**********************************************************************************************
1744  typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1745  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1746  IsNumeric<ST>::value
1747  , typename DVecScalarMultExprTrait<typename DMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1748  , INVALID_TYPE >::Type Type;
1749  //**********************************************************************************************
1750 };
1752 //*************************************************************************************************
1753 
1754 
1755 
1756 
1757 //=================================================================================================
1758 //
1759 // TDMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1760 //
1761 //=================================================================================================
1762 
1763 //*************************************************************************************************
1765 template< typename MT, typename VT, typename ST >
1766 struct TDMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1767 {
1768  public:
1769  //**********************************************************************************************
1770  typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1771  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1772  IsNumeric<ST>::value
1773  , typename DVecScalarMultExprTrait<typename TDMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1774  , INVALID_TYPE >::Type Type;
1775  //**********************************************************************************************
1776 };
1778 //*************************************************************************************************
1779 
1780 
1781 
1782 
1783 //=================================================================================================
1784 //
1785 // TSVECDMATMULTEXPRTRAIT SPECIALIZATIONS
1786 //
1787 //=================================================================================================
1788 
1789 //*************************************************************************************************
1791 template< typename VT, typename ST, typename MT >
1792 struct TSVecDMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1793 {
1794  public:
1795  //**********************************************************************************************
1796  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1797  IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1798  IsNumeric<ST>::value
1799  , typename TDVecScalarMultExprTrait<typename TSVecDMatMultExprTrait<VT,MT>::Type,ST>::Type
1800  , INVALID_TYPE >::Type Type;
1801  //**********************************************************************************************
1802 };
1804 //*************************************************************************************************
1805 
1806 
1807 
1808 
1809 //=================================================================================================
1810 //
1811 // TSVECTDMATMULTEXPRTRAIT SPECIALIZATIONS
1812 //
1813 //=================================================================================================
1814 
1815 //*************************************************************************************************
1817 template< typename VT, typename ST, typename MT >
1818 struct TSVecTDMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1819 {
1820  public:
1821  //**********************************************************************************************
1822  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1823  IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1824  IsNumeric<ST>::value
1825  , typename TDVecScalarMultExprTrait<typename TSVecTDMatMultExprTrait<VT,MT>::Type,ST>::Type
1826  , INVALID_TYPE >::Type Type;
1827  //**********************************************************************************************
1828 };
1830 //*************************************************************************************************
1831 
1832 
1833 
1834 
1835 //=================================================================================================
1836 //
1837 // SMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1838 //
1839 //=================================================================================================
1840 
1841 //*************************************************************************************************
1843 template< typename MT, typename VT, typename ST >
1844 struct SMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1845 {
1846  public:
1847  //**********************************************************************************************
1848  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1849  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1850  IsNumeric<ST>::value
1851  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1852  , INVALID_TYPE >::Type Type;
1853  //**********************************************************************************************
1854 };
1856 //*************************************************************************************************
1857 
1858 
1859 
1860 
1861 //=================================================================================================
1862 //
1863 // TSMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1864 //
1865 //=================================================================================================
1866 
1867 //*************************************************************************************************
1869 template< typename MT, typename VT, typename ST >
1870 struct TSMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1871 {
1872  public:
1873  //**********************************************************************************************
1874  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1875  IsSparseVector<VT>::value && !IsTransposeVector<VT>::value &&
1876  IsNumeric<ST>::value
1877  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1878  , INVALID_TYPE >::Type Type;
1879  //**********************************************************************************************
1880 };
1882 //*************************************************************************************************
1883 
1884 
1885 
1886 
1887 //=================================================================================================
1888 //
1889 // TSVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1890 //
1891 //=================================================================================================
1892 
1893 //*************************************************************************************************
1895 template< typename VT, typename ST, typename MT >
1896 struct TSVecSMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1897 {
1898  public:
1899  //**********************************************************************************************
1900  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1901  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1902  IsNumeric<ST>::value
1903  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1904  , INVALID_TYPE >::Type Type;
1905  //**********************************************************************************************
1906 };
1908 //*************************************************************************************************
1909 
1910 
1911 
1912 
1913 //=================================================================================================
1914 //
1915 // TSVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1916 //
1917 //=================================================================================================
1918 
1919 //*************************************************************************************************
1921 template< typename VT, typename ST, typename MT >
1922 struct TSVecTSMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1923 {
1924  public:
1925  //**********************************************************************************************
1926  typedef typename SelectType< IsSparseVector<VT>::value && IsTransposeVector<VT>::value &&
1927  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1928  IsNumeric<ST>::value
1929  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1930  , INVALID_TYPE >::Type Type;
1931  //**********************************************************************************************
1932 };
1934 //*************************************************************************************************
1935 
1936 } // namespace blaze
1937 
1938 #endif