TSVecSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSVECSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSVECSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <vector>
56 #include <blaze/math/shims/Reset.h>
68 #include <blaze/util/Assert.h>
69 #include <blaze/util/Byte.h>
71 #include <blaze/util/DisableIf.h>
72 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/Exception.h>
75 #include <blaze/util/SelectType.h>
76 #include <blaze/util/Types.h>
78 
79 
80 namespace blaze {
81 
82 //=================================================================================================
83 //
84 // CLASS TSVECSMATMULTEXPR
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
95 template< typename VT // Type of the left-hand side sparse vector
96  , typename MT > // Type of the right-hand side sparse matrix
97 class TSVecSMatMultExpr : public SparseVector< TSVecSMatMultExpr<VT,MT>, true >
98  , private TVecMatMultExpr
99  , private Computation
100 {
101  private:
102  //**Type definitions****************************************************************************
103  typedef typename VT::ResultType VRT;
104  typedef typename MT::ResultType MRT;
105  typedef typename VT::CompositeType VCT;
106  typedef typename MT::CompositeType MCT;
107  //**********************************************************************************************
108 
109  //**********************************************************************************************
111  enum { evaluateVector = IsComputation<VT>::value };
112  //**********************************************************************************************
113 
114  //**********************************************************************************************
116  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
121 
125  template< typename T1 >
126  struct UseSMPAssign {
127  enum { value = ( evaluateVector || evaluateMatrix ) };
128  };
130  //**********************************************************************************************
131 
132  public:
133  //**Type definitions****************************************************************************
138  typedef const ElementType ReturnType;
139  typedef const ResultType CompositeType;
140 
142  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
143 
145  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type RightOperand;
146 
149 
152  //**********************************************************************************************
153 
154  //**Compilation flags***************************************************************************
156  enum { smpAssignable = !evaluateVector && VT::smpAssignable &&
157  !evaluateMatrix && MT::smpAssignable };
158  //**********************************************************************************************
159 
160  //**Constructor*********************************************************************************
166  explicit inline TSVecSMatMultExpr( const VT& vec, const MT& mat )
167  : vec_( vec ) // Left-hand side sparse vector of the multiplication expression
168  , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
169  {
170  BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
171  }
172  //**********************************************************************************************
173 
174  //**Subscript operator**************************************************************************
180  inline ReturnType operator[]( size_t index ) const {
181  BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
182 
183  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
184 
185  VCT x( vec_ ); // Evaluation of the left-hand side sparse vector operand
186  MCT A( mat_ ); // Evaluation of the right-hand side sparse matrix operand
187 
188  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size() , "Invalid vector size" );
189  BLAZE_INTERNAL_ASSERT( A.rows() == mat_.rows() , "Invalid number of rows" );
190  BLAZE_INTERNAL_ASSERT( A.columns() == mat_.columns(), "Invalid number of columns" );
191 
192  const VectorIterator vend( x.end() );
193  VectorIterator velem( x.begin() );
194  ElementType res;
195 
196  if( velem != vend ) {
197  res = velem->value() * A(velem->index(),index);
198  ++velem;
199  for( ; velem!=vend; ++velem ) {
200  res += velem->value() * A(velem->index(),index);
201  }
202  }
203  else {
204  reset( res );
205  }
206 
207  return res;
208  }
209  //**********************************************************************************************
210 
211  //**At function*********************************************************************************
218  inline ReturnType at( size_t index ) const {
219  if( index >= mat_.columns() ) {
220  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
221  }
222  return (*this)[index];
223  }
224  //**********************************************************************************************
225 
226  //**Size function*******************************************************************************
231  inline size_t size() const {
232  return mat_.columns();
233  }
234  //**********************************************************************************************
235 
236  //**NonZeros function***************************************************************************
241  inline size_t nonZeros() const {
242  return mat_.columns();
243  }
244  //**********************************************************************************************
245 
246  //**Left operand access*************************************************************************
251  inline LeftOperand leftOperand() const {
252  return vec_;
253  }
254  //**********************************************************************************************
255 
256  //**Right operand access************************************************************************
261  inline RightOperand rightOperand() const {
262  return mat_;
263  }
264  //**********************************************************************************************
265 
266  //**********************************************************************************************
272  template< typename T >
273  inline bool canAlias( const T* alias ) const {
274  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
275  }
276  //**********************************************************************************************
277 
278  //**********************************************************************************************
284  template< typename T >
285  inline bool isAliased( const T* alias ) const {
286  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
287  }
288  //**********************************************************************************************
289 
290  //**********************************************************************************************
295  inline bool canSMPAssign() const {
296  return ( size() > SMP_TSVECSMATMULT_THRESHOLD );
297  }
298  //**********************************************************************************************
299 
300  private:
301  //**Member variables****************************************************************************
302  LeftOperand vec_;
303  RightOperand mat_;
304  //**********************************************************************************************
305 
306  //**Assignment to dense vectors*****************************************************************
319  template< typename VT1 > // Type of the target dense vector
320  friend inline void assign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
321  {
323 
324  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
325 
326  // Resetting the left-hand side target dense vector
327  reset( ~lhs );
328 
329  // Evaluation of the left-hand side sparse vector operand
330  LT x( serial( rhs.vec_ ) );
331  if( x.nonZeros() == 0UL ) return;
332 
333  // Evaluation of the right-hand side sparse matrix operand
334  RT A( serial( rhs.mat_ ) );
335 
336  // Checking the evaluated operands
337  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
338  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
339  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
340  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
341 
342  // Performing the sparse vector-sparse matrix multiplication
343  TSVecSMatMultExpr::selectAssignKernel( ~lhs, x, A );
344  }
346  //**********************************************************************************************
347 
348  //**Default assignment to dense vectors*********************************************************
362  template< typename VT1 // Type of the left-hand side target vector
363  , typename VT2 // Type of the left-hand side vector operand
364  , typename MT1 > // Type of the right-hand side matrix operand
365  static inline void selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
366  {
367  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
368  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
369 
370  const VectorIterator vend( x.end() );
371  VectorIterator velem( x.begin() );
372 
373  for( ; velem!=vend; ++velem )
374  {
375  const MatrixIterator mend( A.end( velem->index() ) );
376  MatrixIterator melem( A.begin( velem->index() ) );
377 
378  for( ; melem!=mend; ++melem ) {
380  isDefault( y[melem->index()] ) )
381  y[melem->index()] = velem->value() * melem->value();
382  else
383  y[melem->index()] += velem->value() * melem->value();
384  }
385  }
386  }
388  //**********************************************************************************************
389 
390  //**Assignment to sparse vectors****************************************************************
402  template< typename VT1 > // Type of the target sparse vector
403  friend inline void assign( SparseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
404  {
406 
407  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
408 
409  typedef typename RemoveReference<LT>::Type::ConstIterator VectorIterator;
410  typedef typename RemoveReference<RT>::Type::ConstIterator MatrixIterator;
411 
412  // Evaluation of the left-hand side sparse vector operand
413  LT x( serial( rhs.vec_ ) );
414  if( x.nonZeros() == 0UL ) return;
415 
416  // Evaluation of the right-hand side sparse matrix operand
417  RT A( serial( rhs.mat_ ) );
418 
419  // Checking the evaluated operands
420  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
421  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
422  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
423  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
424 
425  // Performing the sparse vector-sparse matrix multiplication
426  DynamicVector<ElementType> tmp( (~lhs).size() );
427  std::vector<byte> indices( (~lhs).size(), 0 );
428  size_t nonzeros( 0UL );
429 
430  const VectorIterator vend( x.end() );
431  VectorIterator velem( x.begin() );
432 
433  for( ; velem!=vend; ++velem )
434  {
435  const MatrixIterator mend ( A.end ( velem->index() ) );
436  MatrixIterator melem( A.begin( velem->index() ) );
437 
438  for( ; melem!=mend; ++melem ) {
439  if( !indices[melem->index()] ) {
440  indices[melem->index()] = 1;
441  ++nonzeros;
442  tmp[melem->index()] = velem->value() * melem->value();
443  }
444  else {
445  tmp[melem->index()] += velem->value() * melem->value();
446  }
447  }
448  }
449 
450  (~lhs).reserve( nonzeros );
451 
452  for( size_t i=0UL; i<(~lhs).size(); ++i ) {
453  if( indices[i] ) {
454  (~lhs).append( i, tmp[i] );
455  }
456  }
457  }
459  //**********************************************************************************************
460 
461  //**Addition assignment to dense vectors********************************************************
474  template< typename VT1 > // Type of the target dense vector
475  friend inline void addAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
476  {
478 
479  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
480 
481  // Evaluation of the left-hand side sparse vector operand
482  LT x( serial( rhs.vec_ ) );
483  if( x.nonZeros() == 0UL ) return;
484 
485  // Evaluation of the right-hand side sparse matrix operand
486  RT A( serial( rhs.mat_ ) );
487 
488  // Checking the evaluated operands
489  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
490  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
491  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
492  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
493 
494  // Performing the sparse vector-sparse matrix multiplication
495  TSVecSMatMultExpr::selectAddAssignKernel( ~lhs, x, A );
496  }
498  //**********************************************************************************************
499 
500  //**Default addition assignment to dense vectors************************************************
514  template< typename VT1 // Type of the left-hand side target vector
515  , typename VT2 // Type of the left-hand side vector operand
516  , typename MT1 > // Type of the right-hand side matrix operand
517  static inline void selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
518  {
519  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
520  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
521 
522  const VectorIterator vend( x.end() );
523  VectorIterator velem( x.begin() );
524 
525  for( ; velem!=vend; ++velem )
526  {
527  const MatrixIterator mend( A.end( velem->index() ) );
528  MatrixIterator melem( A.begin( velem->index() ) );
529 
530  for( ; melem!=mend; ++melem ) {
531  y[melem->index()] += velem->value() * melem->value();
532  }
533  }
534  }
536  //**********************************************************************************************
537 
538  //**Addition assignment to sparse vectors*******************************************************
539  // No special implementation for the addition assignment to sparse vectors.
540  //**********************************************************************************************
541 
542  //**Subtraction assignment to dense vectors*****************************************************
555  template< typename VT1 > // Type of the target dense vector
556  friend inline void subAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
557  {
559 
560  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
561 
562  // Evaluation of the left-hand side sparse vector operand
563  LT x( serial( rhs.vec_ ) );
564  if( x.nonZeros() == 0UL ) return;
565 
566  // Evaluation of the right-hand side sparse matrix operand
567  RT A( serial( rhs.mat_ ) );
568 
569  // Checking the evaluated operands
570  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
571  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
572  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
573  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
574 
575  // Performing the sparse vector-sparse matrix multiplication
576  TSVecSMatMultExpr::selectSubAssignKernel( ~lhs, x, A );
577  }
579  //**********************************************************************************************
580 
581  //**Default subtraction assignment to dense vectors*********************************************
595  template< typename VT1 // Type of the left-hand side target vector
596  , typename VT2 // Type of the left-hand side vector operand
597  , typename MT1 > // Type of the right-hand side matrix operand
598  static inline void selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
599  {
600  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
601  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
602 
603  const VectorIterator vend( x.end() );
604  VectorIterator velem( x.begin() );
605 
606  for( ; velem!=vend; ++velem )
607  {
608  const MatrixIterator mend( A.end( velem->index() ) );
609  MatrixIterator melem( A.begin( velem->index() ) );
610 
611  for( ; melem!=mend; ++melem ) {
612  y[melem->index()] -= velem->value() * melem->value();
613  }
614  }
615  }
617  //**********************************************************************************************
618 
619  //**Subtraction assignment to sparse vectors****************************************************
620  // No special implementation for the subtraction assignment to sparse vectors.
621  //**********************************************************************************************
622 
623  //**Multiplication assignment to dense vectors**************************************************
636  template< typename VT1 > // Type of the target dense vector
637  friend inline void multAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
638  {
640 
644 
645  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
646 
647  const ResultType tmp( serial( rhs ) );
648  multAssign( ~lhs, tmp );
649  }
651  //**********************************************************************************************
652 
653  //**Multiplication assignment to sparse vectors*************************************************
654  // No special implementation for the multiplication assignment to sparse vectors.
655  //**********************************************************************************************
656 
657  //**SMP assignment to dense vectors*************************************************************
672  template< typename VT1 > // Type of the target dense vector
673  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
674  smpAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
675  {
677 
678  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
679 
680  // Resetting the left-hand side target dense vector
681  reset( ~lhs );
682 
683  // Evaluation of the left-hand side sparse vector operand
684  LT x( rhs.vec_ );
685  if( x.nonZeros() == 0UL ) return;
686 
687  // Evaluation of the right-hand side sparse matrix operand
688  RT A( rhs.mat_ );
689 
690  // Checking the evaluated operands
691  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
692  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
693  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
694  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
695 
696  // Performing the sparse vector-sparse matrix multiplication
697  smpAssign( ~lhs, x * A );
698  }
700  //**********************************************************************************************
701 
702  //**SMP assignment to sparse vectors************************************************************
703  // No special implementation for the SMP assignment to sparse vectors.
704  //**********************************************************************************************
705 
706  //**SMP addition assignment to dense vectors****************************************************
721  template< typename VT1 > // Type of the target dense vector
722  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
723  smpAddAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
724  {
726 
727  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
728 
729  // Evaluation of the left-hand side sparse vector operand
730  LT x( rhs.vec_ );
731  if( x.nonZeros() == 0UL ) return;
732 
733  // Evaluation of the right-hand side sparse matrix operand
734  RT A( rhs.mat_ );
735 
736  // Checking the evaluated operands
737  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
738  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
739  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
740  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
741 
742  // Performing the sparse vector-sparse matrix multiplication
743  smpAddAssign( ~lhs, x * A );
744  }
746  //**********************************************************************************************
747 
748  //**SMP addition assignment to sparse vectors***************************************************
749  // No special implementation for the SMP addition assignment to sparse vectors.
750  //**********************************************************************************************
751 
752  //**SMP subtraction assignment to dense vectors*************************************************
767  template< typename VT1 > // Type of the target dense vector
768  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
769  smpSubAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
770  {
772 
773  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
774 
775  // Evaluation of the left-hand side sparse vector operand
776  LT x( rhs.vec_ );
777  if( x.nonZeros() == 0UL ) return;
778 
779  // Evaluation of the right-hand side sparse matrix operand
780  RT A( rhs.mat_ );
781 
782  // Checking the evaluated operands
783  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
784  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
785  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
786  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
787 
788  // Performing the sparse vector-sparse matrix multiplication
789  smpSubAssign( ~lhs, x * A );
790  }
792  //**********************************************************************************************
793 
794  //**SMP subtraction assignment to sparse vectors************************************************
795  // No special implementation for the SMP subtraction assignment to sparse vectors.
796  //**********************************************************************************************
797 
798  //**SMP multiplication assignment to dense vectors**********************************************
813  template< typename VT1 > // Type of the target dense vector
814  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
815  smpMultAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
816  {
818 
822 
823  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
824 
825  const ResultType tmp( rhs );
826  smpMultAssign( ~lhs, tmp );
827  }
829  //**********************************************************************************************
830 
831  //**SMP multiplication assignment to sparse vectors*********************************************
832  // No special implementation for the SMP multiplication assignment to sparse vectors.
833  //**********************************************************************************************
834 
835  //**Compile time checks*************************************************************************
843  //**********************************************************************************************
844 };
845 //*************************************************************************************************
846 
847 
848 
849 
850 //=================================================================================================
851 //
852 // GLOBAL BINARY ARITHMETIC OPERATORS
853 //
854 //=================================================================================================
855 
856 //*************************************************************************************************
887 template< typename T1 // Type of the left-hand side sparse vector
888  , typename T2 > // Type of the right-hand side sparse matrix
889 inline const typename DisableIf< IsMatMatMultExpr<T2>, TSVecSMatMultExpr<T1,T2> >::Type
891 {
893 
894  if( (~vec).size() != (~mat).rows() ) {
895  BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
896  }
897 
898  return TSVecSMatMultExpr<T1,T2>( ~vec, ~mat );
899 }
900 //*************************************************************************************************
901 
902 
903 
904 
905 //=================================================================================================
906 //
907 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
908 //
909 //=================================================================================================
910 
911 //*************************************************************************************************
924 template< typename T1 // Type of the left-hand side sparse vector
925  , typename T2 // Type of the right-hand side sparse matrix
926  , bool SO > // Storage order of the right-hand side sparse matrix
927 inline const typename EnableIf< IsMatMatMultExpr<T2>, typename MultExprTrait<T1,T2>::Type >::Type
929 {
931 
933 
934  return ( vec * (~mat).leftOperand() ) * (~mat).rightOperand();
935 }
936 //*************************************************************************************************
937 
938 
939 
940 
941 //=================================================================================================
942 //
943 // SIZE SPECIALIZATIONS
944 //
945 //=================================================================================================
946 
947 //*************************************************************************************************
949 template< typename VT, typename MT >
950 struct Size< TSVecSMatMultExpr<VT,MT> > : public Columns<MT>
951 {};
953 //*************************************************************************************************
954 
955 
956 
957 
958 //=================================================================================================
959 //
960 // EXPRESSION TRAIT SPECIALIZATIONS
961 //
962 //=================================================================================================
963 
964 //*************************************************************************************************
966 template< typename VT, typename MT, bool AF >
967 struct SubvectorExprTrait< TSVecSMatMultExpr<VT,MT>, AF >
968 {
969  public:
970  //**********************************************************************************************
971  typedef typename MultExprTrait< typename SubvectorExprTrait<const VT,AF>::Type
972  , typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
973  //**********************************************************************************************
974 };
976 //*************************************************************************************************
977 
978 } // namespace blaze
979 
980 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
VT::CompositeType VCT
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:105
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSVecSMatMultExpr.h:241
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: TSVecSMatMultExpr.h:273
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:138
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:7820
Header file for basic type definitions.
Header file for the SparseVector base class.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:136
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
TSVecSMatMultExpr< VT, MT > This
Type of this TSVecSMatMultExpr instance.
Definition: TSVecSMatMultExpr.h:134
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
MT::ResultType MRT
Result type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:104
Header file for the Computation base class.
Constraints on the storage order of matrix types.
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSVecSMatMultExpr.h:303
Header file for the RequiresEvaluation type trait.
Header file for the implementation of an arbitrarily sized vector.
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:117
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
SelectType< evaluateMatrix, const MRT, MCT >::Type RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:151
Constraint on the data type.
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:261
SelectType< evaluateVector, const VRT, VCT >::Type LT
Type for the assignment of the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:148
MultTrait< VRT, MRT >::Type ResultType
Result type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:135
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:145
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 DisableIf class template.
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:251
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSVecSMatMultExpr.h:218
size_t size() const
Returns the current size/dimension of the vector.
Definition: TSVecSMatMultExpr.h:231
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
Expression object for sparse vector-sparse matrix multiplications.The TSVecSMatMultExpr class represe...
Definition: Forward.h:161
Header file for the IsMatMatMultExpr type trait class.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the Columns type trait.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: TSVecSMatMultExpr.h:295
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#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
#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
ResultType::ElementType ElementType
Resulting element type.
Definition: TSVecSMatMultExpr.h:137
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSVecSMatMultExpr.h:139
Header file for the EnableIf class template.
LeftOperand vec_
Left-hand side sparse vector of the multiplication expression.
Definition: TSVecSMatMultExpr.h:302
Header file for the serial shim.
MT::CompositeType MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:106
Header file for the byte type.
VT::ResultType VRT
Result type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:103
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
RightOperand rightOperand() const
Returns the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:261
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:79
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Base template for the MultTrait class.
Definition: MultTrait.h:138
Header file for the reset shim.
Constraint on the data type.
TSVecSMatMultExpr(const VT &vec, const MT &mat)
Constructor for the TSVecSMatMultExpr class.
Definition: TSVecSMatMultExpr.h:166
Header file for the isDefault shim.
Header file for the TVecMatMultExpr base class.
Constraint on the data type.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TSVecSMatMultExpr.h:285
Header file for the RemoveReference type trait.
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_TVECMATMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/matrix ...
Definition: TVecMatMultExpr.h:166
Header file for the IsComputation type trait class.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:79
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSVecSMatMultExpr.h:180
Header file for exception macros.
Header file for the IsResizable type trait.
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:142
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the Size type trait.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.