All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SVecScalarMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECSCALARMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECSCALARMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
69 #include <blaze/util/Assert.h>
74 #include <blaze/util/EnableIf.h>
75 #include <blaze/util/InvalidType.h>
77 #include <blaze/util/SelectType.h>
78 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS SVECSCALARMULTEXPR
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< typename VT // Type of the left-hand side sparse vector
100  , typename ST // Type of the right-hand side scalar value
101  , bool TF > // Transpose flag
102 class SVecScalarMultExpr : public SparseVector< SVecScalarMultExpr<VT,ST,TF>, TF >
103  , private VecScalarMultExpr
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
108  typedef typename VT::ResultType RT;
109  typedef typename VT::ReturnType RN;
110  typedef typename VT::CompositeType CT;
111  //**********************************************************************************************
112 
113  //**Return type evaluation**********************************************************************
115 
120  enum { returnExpr = !IsTemporary<RN>::value };
121 
124  //**********************************************************************************************
125 
126  //**Evaluation strategy*************************************************************************
128 
134  enum { useAssign = RequiresEvaluation<VT>::value };
135 
137  template< typename VT2 >
139  struct UseAssign {
140  enum { value = useAssign };
141  };
143  //**********************************************************************************************
144 
145  public:
146  //**Type definitions****************************************************************************
151 
154 
157 
159  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
160 
162  typedef ST RightOperand;
163  //**********************************************************************************************
164 
165  //**ConstIterator class definition**************************************************************
169  {
170  public:
171  //**Type definitions*************************************************************************
174 
177 
178  typedef std::forward_iterator_tag IteratorCategory;
179  typedef Element ValueType;
183 
184  // STL iterator requirements
190  //*******************************************************************************************
191 
192  //**Constructor******************************************************************************
195  inline ConstIterator( IteratorType vector, RightOperand scalar )
196  : vector_( vector ) // Iterator over the elements of the left-hand side sparse vector expression
197  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
198  {}
199  //*******************************************************************************************
200 
201  //**Prefix increment operator****************************************************************
207  ++vector_;
208  return *this;
209  }
210  //*******************************************************************************************
211 
212  //**Element access operator******************************************************************
217  inline const Element operator*() const {
218  return Element( vector_->value() * scalar_, vector_->index() );
219  }
220  //*******************************************************************************************
221 
222  //**Element access operator******************************************************************
227  inline const ConstIterator* operator->() const {
228  return this;
229  }
230  //*******************************************************************************************
231 
232  //**Value function***************************************************************************
237  inline ReturnType value() const {
238  return vector_->value() * scalar_;
239  }
240  //*******************************************************************************************
241 
242  //**Index function***************************************************************************
247  inline size_t index() const {
248  return vector_->index();
249  }
250  //*******************************************************************************************
251 
252  //**Equality operator************************************************************************
258  inline bool operator==( const ConstIterator& rhs ) const {
259  return vector_ == rhs.vector_;
260  }
261  //*******************************************************************************************
262 
263  //**Inequality operator**********************************************************************
269  inline bool operator!=( const ConstIterator& rhs ) const {
270  return vector_ != rhs.vector_;
271  }
272  //*******************************************************************************************
273 
274  //**Subtraction operator*********************************************************************
280  inline DifferenceType operator-( const ConstIterator& rhs ) const {
281  return vector_ - rhs.vector_;
282  }
283  //*******************************************************************************************
284 
285  private:
286  //**Member variables*************************************************************************
289  //*******************************************************************************************
290  };
291  //**********************************************************************************************
292 
293  //**Constructor*********************************************************************************
299  explicit inline SVecScalarMultExpr( const VT& vector, ST scalar )
300  : vector_( vector ) // Left-hand side sparse vector of the multiplication expression
301  , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
302  {}
303  //**********************************************************************************************
304 
305  //**Subscript operator**************************************************************************
311  inline ReturnType operator[]( size_t index ) const {
312  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
313  return vector_[index] * scalar_;
314  }
315  //**********************************************************************************************
316 
317  //**Begin function******************************************************************************
322  inline ConstIterator begin() const {
323  return ConstIterator( vector_.begin(), scalar_ );
324  }
325  //**********************************************************************************************
326 
327  //**End function********************************************************************************
332  inline ConstIterator end() const {
333  return ConstIterator( vector_.end(), scalar_ );
334  }
335  //**********************************************************************************************
336 
337  //**Size function*******************************************************************************
342  inline size_t size() const {
343  return vector_.size();
344  }
345  //**********************************************************************************************
346 
347  //**NonZeros function***************************************************************************
352  inline size_t nonZeros() const {
353  return vector_.nonZeros();
354  }
355  //**********************************************************************************************
356 
357  //**Left operand access*************************************************************************
362  inline LeftOperand leftOperand() const {
363  return vector_;
364  }
365  //**********************************************************************************************
366 
367  //**Right operand access************************************************************************
372  inline RightOperand rightOperand() const {
373  return scalar_;
374  }
375  //**********************************************************************************************
376 
377  //**********************************************************************************************
383  template< typename T >
384  inline bool canAlias( const T* alias ) const {
385  return vector_.canAlias( alias );
386  }
387  //**********************************************************************************************
388 
389  //**********************************************************************************************
395  template< typename T >
396  inline bool isAliased( const T* alias ) const {
397  return vector_.isAliased( alias );
398  }
399  //**********************************************************************************************
400 
401  private:
402  //**Member variables****************************************************************************
405  //**********************************************************************************************
406 
407  //**Assignment to dense vectors*****************************************************************
421  template< typename VT2 > // Type of the target dense vector
422  friend inline typename EnableIf< UseAssign<VT2> >::Type
423  assign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
424  {
426 
427  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
428 
429  assign( ~lhs, rhs.vector_ );
430  (~lhs) *= rhs.scalar_;
431  }
433  //**********************************************************************************************
434 
435  //**Assignment to sparse vectors****************************************************************
449  template< typename VT2 > // Type of the target sparse vector
450  friend inline typename EnableIf< UseAssign<VT2> >::Type
452  {
454 
455  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
456 
457  assign( ~lhs, rhs.vector_ );
458  (~lhs) *= rhs.scalar_;
459  }
461  //**********************************************************************************************
462 
463  //**Addition assignment to dense vectors********************************************************
477  template< typename VT2 > // Type of the target dense vector
478  friend inline typename EnableIf< UseAssign<VT2> >::Type
479  addAssign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
480  {
482 
486 
487  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
488 
489  const ResultType tmp( rhs );
490  addAssign( ~lhs, tmp );
491  }
493  //**********************************************************************************************
494 
495  //**Addition assignment to sparse vectors*******************************************************
496  // No special implementation for the addition assignment to sparse vectors.
497  //**********************************************************************************************
498 
499  //**Subtraction assignment to dense vectors*****************************************************
513  template< typename VT2 > // Type of the target dense vector
514  friend inline typename EnableIf< UseAssign<VT2> >::Type
515  subAssign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
516  {
518 
522 
523  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
524 
525  const ResultType tmp( rhs );
526  subAssign( ~lhs, tmp );
527  }
529  //**********************************************************************************************
530 
531  //**Subtraction assignment to sparse vectors****************************************************
532  // No special implementation for the subtraction assignment to sparse vectors.
533  //**********************************************************************************************
534 
535  //**Multiplication assignment to dense vectors**************************************************
549  template< typename VT2 > // Type of the target dense vector
550  friend inline typename EnableIf< UseAssign<VT2> >::Type
551  multAssign( DenseVector<VT2,TF>& lhs, const SVecScalarMultExpr& rhs )
552  {
554 
558 
559  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
560 
561  const ResultType tmp( rhs );
562  multAssign( ~lhs, tmp );
563  }
565  //**********************************************************************************************
566 
567  //**Multiplication assignment to sparse vectors*************************************************
568  // No special implementation for the multiplication assignment to sparse vectors.
569  //**********************************************************************************************
570 
571  //**Compile time checks*************************************************************************
578  //**********************************************************************************************
579 };
580 //*************************************************************************************************
581 
582 
583 
584 
585 //=================================================================================================
586 //
587 // GLOBAL UNARY ARITHMETIC OPERATORS
588 //
589 //=================================================================================================
590 
591 //*************************************************************************************************
608 template< typename VT // Type of the sparse vector
609  , bool TF > // Transpose flag
610 inline const SVecScalarMultExpr<VT,typename BaseElementType<VT>::Type,TF>
612 {
614 
615  typedef typename BaseElementType<VT>::Type ElementType;
617 }
618 //*************************************************************************************************
619 
620 
621 
622 
623 //=================================================================================================
624 //
625 // GLOBAL BINARY ARITHMETIC OPERATORS
626 //
627 //=================================================================================================
628 
629 //*************************************************************************************************
650 template< typename T1 // Type of the left-hand side sparse vector
651  , typename T2 // Type of the right-hand side scalar
652  , bool TF > // Transpose flag
653 inline const typename EnableIf< IsNumeric<T2>, typename MultExprTrait<T1,T2>::Type >::Type
654  operator*( const SparseVector<T1,TF>& vec, T2 scalar )
655 {
657 
658  typedef typename MultExprTrait<T1,T2>::Type Type;
659  return Type( ~vec, scalar );
660 }
661 //*************************************************************************************************
662 
663 
664 //*************************************************************************************************
685 template< typename T1 // Type of the left-hand side scalar
686  , typename T2 // Type of the right-hand side sparse vector
687  , bool TF > // Transpose flag
688 inline const typename EnableIf< IsNumeric<T1>, typename MultExprTrait<T1,T2>::Type >::Type
689  operator*( T1 scalar, const SparseVector<T2,TF>& vec )
690 {
692 
693  typedef typename MultExprTrait<T1,T2>::Type Type;
694  return Type( ~vec, scalar );
695 }
696 //*************************************************************************************************
697 
698 
699 
700 
701 //=================================================================================================
702 //
703 // GLOBAL FUNCTIONS
704 //
705 //=================================================================================================
706 
707 //*************************************************************************************************
725 template< typename VT // Type of the sparse vector
726  , bool TF > // Transpose flag
727 inline const SVecScalarMultExpr<VT,typename VT::ElementType,TF>
729 {
730  typedef typename VT::ElementType ElementType;
731 
733 
734  const ElementType len ( length( ~vec ) );
735  const ElementType ilen( ( len != ElementType(0) )?( ElementType(1) / len ):( 0 ) );
736 
737  return SVecScalarMultExpr<VT,ElementType,TF>( ~vec, ilen );
738 }
739 //*************************************************************************************************
740 
741 
742 
743 
744 //=================================================================================================
745 //
746 // GLOBAL RESTRUCTURING UNARY ARITHMETIC OPERATORS
747 //
748 //=================================================================================================
749 
750 //*************************************************************************************************
762 template< typename VT // Type of the sparse vector
763  , typename ST // Type of the scalar
764  , bool TF > // Transpose flag
765 inline const SVecScalarMultExpr<VT,ST,TF>
766  operator-( const SVecScalarMultExpr<VT,ST,TF>& sv )
767 {
769 
770  return SVecScalarMultExpr<VT,ST,TF>( sv.leftOperand(), -sv.rightOperand() );
771 }
773 //*************************************************************************************************
774 
775 
776 
777 
778 //=================================================================================================
779 //
780 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
781 //
782 //=================================================================================================
783 
784 //*************************************************************************************************
797 template< typename VT // Type of the sparse vector of the left-hand side expression
798  , typename ST1 // Type of the scalar of the left-hand side expression
799  , bool TF // Transpose flag of the sparse vector
800  , typename ST2 > // Type of the right-hand side scalar
801 inline const typename EnableIf< IsNumeric<ST2>
802  , typename MultExprTrait< SVecScalarMultExpr<VT,ST1,TF>, ST2 >::Type >::Type
803  operator*( const SVecScalarMultExpr<VT,ST1,TF>& vec, ST2 scalar )
804 {
806 
807  return vec.leftOperand() * ( vec.rightOperand() * scalar );
808 }
810 //*************************************************************************************************
811 
812 
813 //*************************************************************************************************
826 template< typename ST1 // Type of the left-hand side scalar
827  , typename VT // Type of the sparse vector of the right-hand side expression
828  , typename ST2 // Type of the scalar of the right-hand side expression
829  , bool TF > // Transpose flag of the sparse vector
830 inline const typename EnableIf< IsNumeric<ST1>
831  , typename MultExprTrait< ST1, SVecScalarMultExpr<VT,ST2,TF> >::Type >::Type
832  operator*( ST1 scalar, const SVecScalarMultExpr<VT,ST2,TF>& vec )
833 {
835 
836  return vec.leftOperand() * ( scalar * vec.rightOperand() );
837 }
839 //*************************************************************************************************
840 
841 
842 //*************************************************************************************************
855 template< typename VT // Type of the dense vector of the left-hand side expression
856  , typename ST1 // Type of the scalar of the left-hand side expression
857  , bool TF // Transpose flag of the dense vector
858  , typename ST2 > // Type of the right-hand side scalar
859 inline const typename EnableIf< IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>
860  , typename DivExprTrait< SVecScalarMultExpr<VT,ST1,TF>, ST2 >::Type >::Type
861  operator/( const SVecScalarMultExpr<VT,ST1,TF>& vec, ST2 scalar )
862 {
864 
865  return vec.leftOperand() * ( vec.rightOperand() / scalar );
866 }
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
885 template< typename VT1 // Type of the sparse vector of the left-hand side expression
886  , typename ST // Type of the scalar of the left-hand side expression
887  , bool TF // Transpose flag of the dense vectors
888  , typename VT2 > // Type of the right-hand side dense vector
889 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,TF>, VT2 >::Type
890  operator*( const SVecScalarMultExpr<VT1,ST,TF>& lhs, const DenseVector<VT2,TF>& rhs )
891 {
893 
894  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
895 }
897 //*************************************************************************************************
898 
899 
900 //*************************************************************************************************
914 template< typename VT1 // Type of the left-hand side dense vector
915  , bool TF // Transpose flag of the dense vectors
916  , typename VT2 // Type of the sparse vector of the right-hand side expression
917  , typename ST > // Type of the scalar of the right-hand side expression
918 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,TF> >::Type
919  operator*( const DenseVector<VT1,TF>& lhs, const SVecScalarMultExpr<VT2,ST,TF>& rhs )
920 {
922 
923  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
924 }
926 //*************************************************************************************************
927 
928 
929 //*************************************************************************************************
943 template< typename VT1 // Type of the sparse vector of the left-hand side expression
944  , typename ST // Type of the scalar of the left-hand side expression
945  , typename VT2 > // Type of the right-hand side dense vector
946 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >::Type
947  operator*( const SVecScalarMultExpr<VT1,ST,false>& lhs, const DenseVector<VT2,true>& rhs )
948 {
950 
951  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
952 }
954 //*************************************************************************************************
955 
956 
957 //*************************************************************************************************
971 template< typename VT1 // Type of the left-hand side dense vector
972  , typename VT2 // Type of the sparse vector of the right-hand side expression
973  , typename ST > // Type of the scalar of the right-hand side expression
974 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >::Type
975  operator*( const DenseVector<VT1,false>& lhs, const SVecScalarMultExpr<VT2,ST,true>& rhs )
976 {
978 
979  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
980 }
982 //*************************************************************************************************
983 
984 
985 //*************************************************************************************************
999 template< typename VT1 // Type of the sparse vector of the left-hand side expression
1000  , typename ST // Type of the scalar of the left-hand side expression
1001  , bool TF // Transpose flag of the vectors
1002  , typename VT2 > // Type of the right-hand side sparse vector
1003 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,TF>, VT2 >::Type
1004  operator*( const SVecScalarMultExpr<VT1,ST,TF>& lhs, const SparseVector<VT2,TF>& rhs )
1005 {
1007 
1008  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1009 }
1011 //*************************************************************************************************
1012 
1013 
1014 //*************************************************************************************************
1028 template< typename VT1 // Type of the left-hand side sparse vector
1029  , bool TF // Transpose flag of the vectors
1030  , typename VT2 // Type of the sparse vector of the right-hand side expression
1031  , typename ST > // Type of the scalar of the right-hand side expression
1032 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,TF> >::Type
1033  operator*( const SparseVector<VT1,TF>& lhs, const SVecScalarMultExpr<VT2,ST,TF>& rhs )
1034 {
1036 
1037  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1038 }
1040 //*************************************************************************************************
1041 
1042 
1043 //*************************************************************************************************
1057 template< typename VT1 // Type of the sparse vector of the left-hand side expression
1058  , typename ST1 // Type of the scalar of the left-hand side expression
1059  , bool TF // Transpose flag of the sparse vectors
1060  , typename VT2 // Type of the sparse vector of the right-hand side expression
1061  , typename ST2 > // Type of the scalar of the right-hand side expression
1062 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST1,TF>, SVecScalarMultExpr<VT2,ST2,TF> >::Type
1063  operator*( const SVecScalarMultExpr<VT1,ST1,TF>& lhs, const SVecScalarMultExpr<VT2,ST2,TF>& rhs )
1064 {
1066 
1067  return ( lhs.leftOperand() * rhs.leftOperand() ) * ( lhs.rightOperand() * rhs.rightOperand() );
1068 }
1070 //*************************************************************************************************
1071 
1072 
1073 //*************************************************************************************************
1087 template< typename VT1 // Type of the sparse vector of the left-hand side expression
1088  , typename ST // Type of the scalar of the left-hand side expression
1089  , typename VT2 > // Type of the right-hand side sparse vector
1090 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >::Type
1091  operator*( const SVecScalarMultExpr<VT1,ST,false>& lhs, const SparseVector<VT2,true>& rhs )
1092 {
1094 
1095  return ( lhs.leftOperand() * (~rhs) ) * lhs.rightOperand();
1096 }
1098 //*************************************************************************************************
1099 
1100 
1101 //*************************************************************************************************
1115 template< typename VT1 // Type of the left-hand side sparse vector
1116  , typename VT2 // Type of the sparse vector of the right-hand side expression
1117  , typename ST > // Type of the scalar of the right-hand side expression
1118 inline const typename MultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >::Type
1119  operator*( const SparseVector<VT1,false>& lhs, const SVecScalarMultExpr<VT2,ST,true>& rhs )
1120 {
1122 
1123  return ( (~lhs) * rhs.leftOperand() ) * rhs.rightOperand();
1124 }
1126 //*************************************************************************************************
1127 
1128 
1129 //*************************************************************************************************
1143 template< typename VT1 // Type of the sparse vector of the left-hand side expression
1144  , typename ST1 // Type of the scalar of the left-hand side expression
1145  , typename VT2 // Type of the sparse vector of the right-hand side expression
1146  , typename ST2 > // Type of the scalar of the right-hand side expression
1147 inline const typename MultExprTrait< SVecScalarMultExpr<VT1,ST1,false>, SVecScalarMultExpr<VT2,ST2,true> >::Type
1148  operator*( const SVecScalarMultExpr<VT1,ST1,false>& lhs, const SVecScalarMultExpr<VT2,ST2,true>& rhs )
1149 {
1151 
1152  return ( lhs.leftOperand() * rhs.leftOperand() ) * ( lhs.rightOperand() * rhs.rightOperand() );
1153 }
1155 //*************************************************************************************************
1156 
1157 
1158 //*************************************************************************************************
1172 template< typename MT // Type of the left-hand side dense matrix
1173  , bool SO // Storage order of the left-hand side dense matrix
1174  , typename VT // Type of the sparse vector of the right-hand side expression
1175  , typename ST > // Type of the scalar of the right-hand side expression
1176 inline const typename MultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >::Type
1177  operator*( const DenseMatrix<MT,SO>& mat, const SVecScalarMultExpr<VT,ST,false>& vec )
1178 {
1180 
1181  return ( (~mat) * vec.leftOperand() ) * vec.rightOperand();
1182 }
1184 //*************************************************************************************************
1185 
1186 
1187 //*************************************************************************************************
1201 template< typename VT // Type of the sparse vector of the left-hand side expression
1202  , typename ST // Type of the scalar of the left-hand side expression
1203  , typename MT // Type of the right-hand side dense matrix
1204  , bool SO > // Storage order of the right-hand side dense matrix
1205 inline const typename MultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >::Type
1206  operator*( const SVecScalarMultExpr<VT,ST,true>& vec, const DenseMatrix<MT,SO>& mat )
1207 {
1209 
1210  return ( vec.leftOperand() * (~mat) ) * vec.rightOperand();
1211 }
1213 //*************************************************************************************************
1214 
1215 
1216 //*************************************************************************************************
1230 template< typename MT // Type of the left-hand side sparse matrix
1231  , bool SO // Storage order of the left-hand side sparse matrix
1232  , typename VT // Type of the sparse vector of the right-hand side expression
1233  , typename ST > // Type of the scalar of the right-hand side expression
1234 inline const typename MultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >::Type
1235  operator*( const SparseMatrix<MT,SO>& mat, const SVecScalarMultExpr<VT,ST,false>& vec )
1236 {
1238 
1239  return ( (~mat) * vec.leftOperand() ) * vec.rightOperand();
1240 }
1242 //*************************************************************************************************
1243 
1244 
1245 //*************************************************************************************************
1259 template< typename VT // Type of the sparse vector of the left-hand side expression
1260  , typename ST // Type of the scalar of the left-hand side expression
1261  , typename MT // Type of the right-hand side sparse matrix
1262  , bool SO > // Storage order of the right-hand side sparse matrix
1263 inline const typename MultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >::Type
1264  operator*( const SVecScalarMultExpr<VT,ST,true>& vec, const SparseMatrix<MT,SO>& mat )
1265 {
1267 
1268  return ( vec.leftOperand() * (~mat) ) * vec.rightOperand();
1269 }
1271 //*************************************************************************************************
1272 
1273 
1274 
1275 
1276 //=================================================================================================
1277 //
1278 // SVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1279 //
1280 //=================================================================================================
1281 
1282 //*************************************************************************************************
1284 template< typename VT, typename ST1, typename ST2 >
1285 struct SVecScalarMultExprTrait< SVecScalarMultExpr<VT,ST1,false>, ST2 >
1286 {
1287  public:
1288  //**********************************************************************************************
1289  typedef typename SelectType< IsSparseVector<VT>::value && IsColumnVector<VT>::value &&
1290  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1291  , typename SVecScalarMultExprTrait<VT,typename MultTrait<ST1,ST2>::Type>::Type
1292  , INVALID_TYPE >::Type Type;
1293  //**********************************************************************************************
1294 };
1296 //*************************************************************************************************
1297 
1298 
1299 
1300 
1301 //=================================================================================================
1302 //
1303 // TSVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1304 //
1305 //=================================================================================================
1306 
1307 //*************************************************************************************************
1309 template< typename VT, typename ST1, typename ST2 >
1310 struct TSVecScalarMultExprTrait< SVecScalarMultExpr<VT,ST1,true>, ST2 >
1311 {
1312  public:
1313  //**********************************************************************************************
1314  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1315  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1316  , typename TSVecScalarMultExprTrait<VT,typename MultTrait<ST1,ST2>::Type>::Type
1317  , INVALID_TYPE >::Type Type;
1318  //**********************************************************************************************
1319 };
1321 //*************************************************************************************************
1322 
1323 
1324 
1325 
1326 //=================================================================================================
1327 //
1328 // SVECSCALARDIVEXPRTRAIT SPECIALIZATIONS
1329 //
1330 //=================================================================================================
1331 
1332 //*************************************************************************************************
1334 template< typename VT, typename ST1, typename ST2 >
1335 struct SVecScalarDivExprTrait< SVecScalarMultExpr<VT,ST1,false>, ST2 >
1336 {
1337  private:
1338  //**********************************************************************************************
1339  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1340  //**********************************************************************************************
1341 
1342  //**********************************************************************************************
1343  typedef typename SVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1344  typedef typename SVecScalarDivExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1345  //**********************************************************************************************
1346 
1347  public:
1348  //**********************************************************************************************
1349  typedef typename SelectType< IsSparseVector<VT>::value && IsColumnVector<VT>::value &&
1350  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1351  , typename SelectType<condition,T1,T2>::Type
1352  , INVALID_TYPE >::Type Type;
1353  //**********************************************************************************************
1354 };
1356 //*************************************************************************************************
1357 
1358 
1359 
1360 
1361 //=================================================================================================
1362 //
1363 // TSVECSCALARDIVEXPRTRAIT SPECIALIZATIONS
1364 //
1365 //=================================================================================================
1366 
1367 //*************************************************************************************************
1369 template< typename VT, typename ST1, typename ST2 >
1370 struct TSVecScalarDivExprTrait< SVecScalarMultExpr<VT,ST1,true>, ST2 >
1371 {
1372  private:
1373  //**********************************************************************************************
1374  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1375  //**********************************************************************************************
1376 
1377  //**********************************************************************************************
1378  typedef typename TSVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1379  typedef typename TSVecScalarDivExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T2;
1380  //**********************************************************************************************
1381 
1382  public:
1383  //**********************************************************************************************
1384  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1385  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1386  , typename SelectType<condition,T1,T2>::Type
1387  , INVALID_TYPE >::Type Type;
1388  //**********************************************************************************************
1389 };
1391 //*************************************************************************************************
1392 
1393 
1394 
1395 
1396 //=================================================================================================
1397 //
1398 // DVECSVECMULTEXPRTRAIT SPECIALIZATIONS
1399 //
1400 //=================================================================================================
1401 
1402 //*************************************************************************************************
1404 template< typename VT1, typename VT2, typename ST >
1405 struct DVecSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,false> >
1406 {
1407  public:
1408  //**********************************************************************************************
1409  typedef typename SelectType< IsDenseVector<VT1>::value && IsColumnVector<VT1>::value &&
1410  IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
1411  IsNumeric<ST>::value
1412  , typename SVecScalarMultExprTrait<typename DVecSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1413  , INVALID_TYPE >::Type Type;
1414  //**********************************************************************************************
1415 };
1417 //*************************************************************************************************
1418 
1419 
1420 
1421 
1422 //=================================================================================================
1423 //
1424 // DVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1425 //
1426 //=================================================================================================
1427 
1428 //*************************************************************************************************
1430 template< typename VT1, typename VT2, typename ST >
1431 struct DVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1432 {
1433  public:
1434  //**********************************************************************************************
1435  typedef typename SelectType< IsDenseVector<VT1>::value && IsColumnVector<VT1>::value &&
1436  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1437  IsNumeric<ST>::value
1438  , typename SMatScalarMultExprTrait<typename DVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1439  , INVALID_TYPE >::Type Type;
1440  //**********************************************************************************************
1441 };
1443 //*************************************************************************************************
1444 
1445 
1446 
1447 
1448 //=================================================================================================
1449 //
1450 // TDVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1451 //
1452 //=================================================================================================
1453 
1454 //*************************************************************************************************
1456 template< typename VT1, typename VT2, typename ST >
1457 struct TDVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1458 {
1459  public:
1460  //**********************************************************************************************
1461  typedef typename SelectType< IsDenseVector<VT1>::value && IsRowVector<VT1>::value &&
1462  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1463  IsNumeric<ST>::value
1464  , typename TSVecScalarMultExprTrait<typename TDVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1465  , INVALID_TYPE >::Type Type;
1466  //**********************************************************************************************
1467 };
1469 //*************************************************************************************************
1470 
1471 
1472 
1473 
1474 //=================================================================================================
1475 //
1476 // SVECDVECMULTEXPRTRAIT SPECIALIZATIONS
1477 //
1478 //=================================================================================================
1479 
1480 //*************************************************************************************************
1482 template< typename VT1, typename ST, typename VT2 >
1483 struct SVecDVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1484 {
1485  public:
1486  //**********************************************************************************************
1487  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1488  IsDenseVector<VT2>::value && IsColumnVector<VT2>::value &&
1489  IsNumeric<ST>::value
1490  , typename SVecScalarMultExprTrait<typename SVecDVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1491  , INVALID_TYPE >::Type Type;
1492  //**********************************************************************************************
1493 };
1495 //*************************************************************************************************
1496 
1497 
1498 
1499 
1500 //=================================================================================================
1501 //
1502 // SVECTDVECMULTEXPRTRAIT SPECIALIZATIONS
1503 //
1504 //=================================================================================================
1505 
1506 //*************************************************************************************************
1508 template< typename VT1, typename ST, typename VT2 >
1509 struct SVecTDVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1510 {
1511  public:
1512  //**********************************************************************************************
1513  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1514  IsDenseVector<VT2>::value && IsRowVector<VT2>::value &&
1515  IsNumeric<ST>::value
1516  , typename TSMatScalarMultExprTrait<typename SVecTDVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1517  , INVALID_TYPE >::Type Type;
1518  //**********************************************************************************************
1519 };
1521 //*************************************************************************************************
1522 
1523 
1524 
1525 
1526 //=================================================================================================
1527 //
1528 // TSVECTDVECMULTEXPRTRAIT SPECIALIZATIONS
1529 //
1530 //=================================================================================================
1531 
1532 //*************************************************************************************************
1534 template< typename VT1, typename ST, typename VT2 >
1535 struct TSVecTDVecMultExprTrait< SVecScalarMultExpr<VT1,ST,true>, VT2 >
1536 {
1537  public:
1538  //**********************************************************************************************
1539  typedef typename SelectType< IsSparseVector<VT1>::value && IsRowVector<VT1>::value &&
1540  IsDenseVector<VT2>::value && IsRowVector<VT2>::value &&
1541  IsNumeric<ST>::value
1542  , typename TSVecScalarMultExprTrait<typename TSVecTDVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1543  , INVALID_TYPE >::Type Type;
1544  //**********************************************************************************************
1545 };
1547 //*************************************************************************************************
1548 
1549 
1550 
1551 
1552 //=================================================================================================
1553 //
1554 // SVECSVECMULTEXPRTRAIT SPECIALIZATIONS
1555 //
1556 //=================================================================================================
1557 
1558 //*************************************************************************************************
1560 template< typename VT1, typename ST, typename VT2 >
1561 struct SVecSVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1562 {
1563  public:
1564  //**********************************************************************************************
1565  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1566  IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
1567  IsNumeric<ST>::value
1568  , typename SVecScalarMultExprTrait<typename SVecSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1569  , INVALID_TYPE >::Type Type;
1570  //**********************************************************************************************
1571 };
1573 //*************************************************************************************************
1574 
1575 
1576 //*************************************************************************************************
1578 template< typename VT1, typename VT2, typename ST >
1579 struct SVecSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,false> >
1580 {
1581  public:
1582  //**********************************************************************************************
1583  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1584  IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
1585  IsNumeric<ST>::value
1586  , typename SVecScalarMultExprTrait<typename SVecSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1587  , INVALID_TYPE >::Type Type;
1588  //**********************************************************************************************
1589 };
1591 //*************************************************************************************************
1592 
1593 
1594 //*************************************************************************************************
1596 template< typename VT1, typename ST1, typename VT2, typename ST2 >
1597 struct SVecSVecMultExprTrait< SVecScalarMultExpr<VT1,ST1,false>, SVecScalarMultExpr<VT2,ST2,false> >
1598 {
1599  public:
1600  //**********************************************************************************************
1601  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1602  IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
1603  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1604  , typename SVecScalarMultExprTrait<typename SVecSVecMultExprTrait<VT1,VT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1605  , INVALID_TYPE >::Type Type;
1606  //**********************************************************************************************
1607 };
1609 //*************************************************************************************************
1610 
1611 
1612 
1613 
1614 //=================================================================================================
1615 //
1616 // SVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1617 //
1618 //=================================================================================================
1619 
1620 //*************************************************************************************************
1622 template< typename VT1, typename ST, typename VT2 >
1623 struct SVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST,false>, VT2 >
1624 {
1625  public:
1626  //**********************************************************************************************
1627  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1628  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1629  IsNumeric<ST>::value
1630  , typename SMatScalarMultExprTrait<typename SVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1631  , INVALID_TYPE >::Type Type;
1632  //**********************************************************************************************
1633 };
1635 //*************************************************************************************************
1636 
1637 
1638 //*************************************************************************************************
1640 template< typename VT1, typename VT2, typename ST >
1641 struct SVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1642 {
1643  public:
1644  //**********************************************************************************************
1645  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1646  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1647  IsNumeric<ST>::value
1648  , typename SMatScalarMultExprTrait<typename SVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1649  , INVALID_TYPE >::Type Type;
1650  //**********************************************************************************************
1651 };
1653 //*************************************************************************************************
1654 
1655 
1656 //*************************************************************************************************
1658 template< typename VT1, typename ST1, typename VT2, typename ST2 >
1659 struct SVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST1,false>, SVecScalarMultExpr<VT2,ST2,true> >
1660 {
1661  public:
1662  //**********************************************************************************************
1663  typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
1664  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1665  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1666  , typename SMatScalarMultExprTrait<typename SVecTSVecMultExprTrait<VT1,VT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1667  , INVALID_TYPE >::Type Type;
1668  //**********************************************************************************************
1669 };
1671 //*************************************************************************************************
1672 
1673 
1674 
1675 
1676 //=================================================================================================
1677 //
1678 // TSVECTSVECMULTEXPRTRAIT SPECIALIZATIONS
1679 //
1680 //=================================================================================================
1681 
1682 //*************************************************************************************************
1684 template< typename VT1, typename ST, typename VT2 >
1685 struct TSVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST,true>, VT2 >
1686 {
1687  public:
1688  //**********************************************************************************************
1689  typedef typename SelectType< IsSparseVector<VT1>::value && IsRowVector<VT1>::value &&
1690  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1691  IsNumeric<ST>::value
1692  , typename TSVecScalarMultExprTrait<typename TSVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1693  , INVALID_TYPE >::Type Type;
1694  //**********************************************************************************************
1695 };
1697 //*************************************************************************************************
1698 
1699 
1700 //*************************************************************************************************
1702 template< typename VT1, typename VT2, typename ST >
1703 struct TSVecTSVecMultExprTrait< VT1, SVecScalarMultExpr<VT2,ST,true> >
1704 {
1705  public:
1706  //**********************************************************************************************
1707  typedef typename SelectType< IsSparseVector<VT1>::value && IsRowVector<VT1>::value &&
1708  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1709  IsNumeric<ST>::value
1710  , typename TSVecScalarMultExprTrait<typename TSVecTSVecMultExprTrait<VT1,VT2>::Type,ST>::Type
1711  , INVALID_TYPE >::Type Type;
1712  //**********************************************************************************************
1713 };
1715 //*************************************************************************************************
1716 
1717 
1718 //*************************************************************************************************
1720 template< typename VT1, typename ST1, typename VT2, typename ST2 >
1721 struct TSVecTSVecMultExprTrait< SVecScalarMultExpr<VT1,ST1,true>, SVecScalarMultExpr<VT2,ST2,true> >
1722 {
1723  public:
1724  //**********************************************************************************************
1725  typedef typename SelectType< IsSparseVector<VT1>::value && IsRowVector<VT1>::value &&
1726  IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
1727  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1728  , typename TSVecScalarMultExprTrait<typename TSVecTSVecMultExprTrait<VT1,VT2>::Type,typename MultTrait<ST1,ST2>::Type>::Type
1729  , INVALID_TYPE >::Type Type;
1730  //**********************************************************************************************
1731 };
1733 //*************************************************************************************************
1734 
1735 
1736 
1737 
1738 //=================================================================================================
1739 //
1740 // DMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1741 //
1742 //=================================================================================================
1743 
1744 //*************************************************************************************************
1746 template< typename MT, typename VT, typename ST >
1747 struct DMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1748 {
1749  public:
1750  //**********************************************************************************************
1751  typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1752  IsSparseVector<VT>::value && IsColumnVector<VT>::value &&
1753  IsNumeric<ST>::value
1754  , typename DVecScalarMultExprTrait<typename DMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1755  , INVALID_TYPE >::Type Type;
1756  //**********************************************************************************************
1757 };
1759 //*************************************************************************************************
1760 
1761 
1762 
1763 
1764 //=================================================================================================
1765 //
1766 // TDMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1767 //
1768 //=================================================================================================
1769 
1770 //*************************************************************************************************
1772 template< typename MT, typename VT, typename ST >
1773 struct TDMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1774 {
1775  public:
1776  //**********************************************************************************************
1777  typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1778  IsSparseVector<VT>::value && IsColumnVector<VT>::value &&
1779  IsNumeric<ST>::value
1780  , typename DVecScalarMultExprTrait<typename TDMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1781  , INVALID_TYPE >::Type Type;
1782  //**********************************************************************************************
1783 };
1785 //*************************************************************************************************
1786 
1787 
1788 
1789 
1790 //=================================================================================================
1791 //
1792 // TSVECDMATMULTEXPRTRAIT SPECIALIZATIONS
1793 //
1794 //=================================================================================================
1795 
1796 //*************************************************************************************************
1798 template< typename VT, typename ST, typename MT >
1799 struct TSVecDMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1800 {
1801  public:
1802  //**********************************************************************************************
1803  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1804  IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1805  IsNumeric<ST>::value
1806  , typename TDVecScalarMultExprTrait<typename TSVecDMatMultExprTrait<VT,MT>::Type,ST>::Type
1807  , INVALID_TYPE >::Type Type;
1808  //**********************************************************************************************
1809 };
1811 //*************************************************************************************************
1812 
1813 
1814 
1815 
1816 //=================================================================================================
1817 //
1818 // TSVECTDMATMULTEXPRTRAIT SPECIALIZATIONS
1819 //
1820 //=================================================================================================
1821 
1822 //*************************************************************************************************
1824 template< typename VT, typename ST, typename MT >
1825 struct TSVecTDMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1826 {
1827  public:
1828  //**********************************************************************************************
1829  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1830  IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1831  IsNumeric<ST>::value
1832  , typename TDVecScalarMultExprTrait<typename TSVecTDMatMultExprTrait<VT,MT>::Type,ST>::Type
1833  , INVALID_TYPE >::Type Type;
1834  //**********************************************************************************************
1835 };
1837 //*************************************************************************************************
1838 
1839 
1840 
1841 
1842 //=================================================================================================
1843 //
1844 // SMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1845 //
1846 //=================================================================================================
1847 
1848 //*************************************************************************************************
1850 template< typename MT, typename VT, typename ST >
1851 struct SMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1852 {
1853  public:
1854  //**********************************************************************************************
1855  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1856  IsSparseVector<VT>::value && IsColumnVector<VT>::value &&
1857  IsNumeric<ST>::value
1858  , typename SVecScalarMultExprTrait<typename SMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1859  , INVALID_TYPE >::Type Type;
1860  //**********************************************************************************************
1861 };
1863 //*************************************************************************************************
1864 
1865 
1866 
1867 
1868 //=================================================================================================
1869 //
1870 // TSMATSVECMULTEXPRTRAIT SPECIALIZATIONS
1871 //
1872 //=================================================================================================
1873 
1874 //*************************************************************************************************
1876 template< typename MT, typename VT, typename ST >
1877 struct TSMatSVecMultExprTrait< MT, SVecScalarMultExpr<VT,ST,false> >
1878 {
1879  public:
1880  //**********************************************************************************************
1881  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1882  IsSparseVector<VT>::value && IsColumnVector<VT>::value &&
1883  IsNumeric<ST>::value
1884  , typename SVecScalarMultExprTrait<typename TSMatSVecMultExprTrait<MT,VT>::Type,ST>::Type
1885  , INVALID_TYPE >::Type Type;
1886  //**********************************************************************************************
1887 };
1889 //*************************************************************************************************
1890 
1891 
1892 
1893 
1894 //=================================================================================================
1895 //
1896 // TSVECSMATMULTEXPRTRAIT SPECIALIZATIONS
1897 //
1898 //=================================================================================================
1899 
1900 //*************************************************************************************************
1902 template< typename VT, typename ST, typename MT >
1903 struct TSVecSMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1904 {
1905  public:
1906  //**********************************************************************************************
1907  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1908  IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1909  IsNumeric<ST>::value
1910  , typename TSVecScalarMultExprTrait<typename TSVecSMatMultExprTrait<VT,MT>::Type,ST>::Type
1911  , INVALID_TYPE >::Type Type;
1912  //**********************************************************************************************
1913 };
1915 //*************************************************************************************************
1916 
1917 
1918 
1919 
1920 //=================================================================================================
1921 //
1922 // TSVECTSMATMULTEXPRTRAIT SPECIALIZATIONS
1923 //
1924 //=================================================================================================
1925 
1926 //*************************************************************************************************
1928 template< typename VT, typename ST, typename MT >
1929 struct TSVecTSMatMultExprTrait< SVecScalarMultExpr<VT,ST,true>, MT >
1930 {
1931  public:
1932  //**********************************************************************************************
1933  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1934  IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1935  IsNumeric<ST>::value
1936  , typename TSVecScalarMultExprTrait<typename TSVecTSMatMultExprTrait<VT,MT>::Type,ST>::Type
1937  , INVALID_TYPE >::Type Type;
1938  //**********************************************************************************************
1939 };
1941 //*************************************************************************************************
1942 
1943 
1944 
1945 
1946 //=================================================================================================
1947 //
1948 // SUBVECTOREXPRTRAIT SPECIALIZATIONS
1949 //
1950 //=================================================================================================
1951 
1952 //*************************************************************************************************
1954 template< typename VT, typename ST, bool TF >
1955 struct SubvectorExprTrait< SVecScalarMultExpr<VT,ST,TF> >
1956 {
1957  public:
1958  //**********************************************************************************************
1959  typedef typename MultExprTrait< typename SubvectorExprTrait<const VT>::Type, ST >::Type Type;
1960  //**********************************************************************************************
1961 };
1963 //*************************************************************************************************
1964 
1965 } // namespace blaze
1966 
1967 #endif
ValueType & ReferenceType
Reference return type.
Definition: SVecScalarMultExpr.h:181
Pointer difference type of the Blaze library.
Data type constraint.
Constraint on the data type.
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecScalarMultExpr.h:384
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:3703
const EnableIf< IsNumeric< T2 >, typename DivExprTrait< T1, T2 >::Type >::Type operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:745
Header file for the SparseVector base class.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecScalarMultExpr.h:332
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecScalarMultExpr.h:342
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecScalarMultExpr.h:182
PointerType pointer
Pointer return type.
Definition: SVecScalarMultExpr.h:187
Header file for the IsSparseMatrix type trait.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:196
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecScalarMultExpr.h:396
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecScalarMultExpr.h:159
Header file for the IsColumnMajorMatrix type trait.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecScalarMultExpr.h:322
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecScalarMultExpr.h:280
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2375
Header file for the IsRowVector type trait.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:248
MultExprTrait< RN, ST >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SVecScalarMultExpr.h:123
Iterator over the elements of the sparse vector/scalar multiplication expression. ...
Definition: SVecScalarMultExpr.h:168
ValueType * PointerType
Pointer return type.
Definition: SVecScalarMultExpr.h:180
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecScalarMultExpr.h:237
Header file for the VecScalarMultExpr base class.
ConstIterator(IteratorType vector, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SVecScalarMultExpr.h:195
Constraint on the data type.
Header file for the DivExprTrait class template.
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:250
Header file for the ValueIndexPair class.
ResultType::ElementType ElementType
Resulting element type.
Definition: SVecScalarMultExpr.h:150
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: SVecScalarMultExpr.h:288
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarMultExpr.h:227
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecScalarMultExpr.h:258
Header file for the IsFloatingPoint type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2379
IteratorCategory iterator_category
The iterator category.
Definition: SVecScalarMultExpr.h:185
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:179
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
LeftOperand vector_
Left-hand side sparse vector of the multiplication expression.
Definition: SVecScalarMultExpr.h:403
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:89
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:79
size_t index() const
Access to the current index of the sparse element.
Definition: SVecScalarMultExpr.h:247
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
DifferenceType difference_type
Difference between two iterators.
Definition: SVecScalarMultExpr.h:189
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SVecScalarMultExpr.h:149
RemoveReference< LeftOperand >::Type::ConstIterator IteratorType
Iterator type of the sparse vector expression.
Definition: SVecScalarMultExpr.h:176
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2373
IteratorType vector_
Iterator over the elements of the left-hand side sparse vector expression.
Definition: SVecScalarMultExpr.h:287
void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:269
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
CMathTrait< typename VT::ElementType >::Type length(const DenseVector< VT, TF > &dv)
Calculation of the dense vector length .
Definition: DenseVector.h:480
Constraint on the data type.
Header file for the IsDenseMatrix type trait.
Header file for the EnableIf class template.
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecScalarMultExpr.h:206
Header file for the BaseElementType type trait.
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: SVecScalarMultExpr.h:404
Header file for the IsNumeric type trait.
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecScalarMultExpr.h:173
Header file for the IsSparseVector type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2374
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Element ValueType
Type of the underlying pointers.
Definition: SVecScalarMultExpr.h:179
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecScalarMultExpr.h:269
Header file for run time assertion macros.
Utility type for generic codes.
Base template for the MultTrait class.
Definition: MultTrait.h:141
ValueType value_type
Type of the underlying pointers.
Definition: SVecScalarMultExpr.h:186
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecScalarMultExpr.h:178
VT::CompositeType CT
Composite type of the sparse vector expression.
Definition: SVecScalarMultExpr.h:110
Header file for the division trait.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecScalarMultExpr.h:352
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:209
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
ReferenceType reference
Reference return type.
Definition: SVecScalarMultExpr.h:188
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:239
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarMultExpr.h:217
RightOperand rightOperand() const
Returns the right-hand side scalar operand.
Definition: SVecScalarMultExpr.h:372
Evaluation of the base element type of a given data type.Via this type trait it is possible to evalua...
Definition: BaseElementType.h:75
Header file for the RemoveReference type trait.
Header file for the IsDenseVector type trait.
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:69
Header file for the IsRowMajorMatrix type trait.
Header file for the IsComputation type trait class.
SelectType< useAssign, const ResultType, const SVecScalarMultExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SVecScalarMultExpr.h:156
Expression object for sparse vector-scalar multiplications.The SVecScalarMultExpr class represents th...
Definition: Forward.h:112
SVecScalarMultExpr(const VT &vector, ST scalar)
Constructor for the SVecScalarMultExpr class.
Definition: SVecScalarMultExpr.h:299
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
VT::ResultType RT
Result type of the sparse vector expression.
Definition: SVecScalarMultExpr.h:108
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2370
SVecScalarMultExpr< VT, ST, TF > This
Type of this SVecScalarMultExpr instance.
Definition: SVecScalarMultExpr.h:147
Header file for basic type definitions.
Header file for the SubvectorExprTrait class template.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SVecScalarMultExpr.h:153
const DVecScalarMultExpr< VT, typename VT::ElementType, TF > normalize(const DenseVector< VT, TF > &vec)
Normalization of the dense vector ( ).
Definition: DVecScalarMultExpr.h:866
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: SVecScalarMultExpr.h:362
Header file for the IsColumnVector type trait.
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SVecScalarMultExpr.h:162
Evaluation of the resulting expression type of a multiplication.Via this type trait it is possible to...
Definition: MultExprTrait.h:137
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:238
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
VT::ReturnType RN
Return type of the sparse vector expression.
Definition: SVecScalarMultExpr.h:109
MultTrait< RT, ST >::Type ResultType
Result type for expression template evaluations.
Definition: SVecScalarMultExpr.h:148
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecScalarMultExpr.h:311
#define BLAZE_CONSTRAINT_MUST_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is not a floating point data type...
Definition: FloatingPoint.h:79
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.