All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSMatSVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATSVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATSVECMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
44 #include <vector>
54 #include <blaze/math/shims/Reset.h>
63 #include <blaze/util/Assert.h>
65 #include <blaze/util/DisableIf.h>
66 #include <blaze/util/EnableIf.h>
68 #include <blaze/util/SelectType.h>
69 #include <blaze/util/Types.h>
71 
72 
73 namespace blaze {
74 
75 //=================================================================================================
76 //
77 // CLASS SMATDVECMULTEXPR
78 //
79 //=================================================================================================
80 
81 //*************************************************************************************************
88 template< typename MT // Type of the left-hand side sparse matrix
89  , typename VT > // Type of the right-hand side sparse vector
90 class TSMatSVecMultExpr : public SparseVector< TSMatSVecMultExpr<MT,VT>, false >
91  , private MatVecMultExpr
92  , private Computation
93 {
94  private:
95  //**Type definitions****************************************************************************
96  typedef typename MT::ResultType MRT;
97  typedef typename VT::ResultType VRT;
98  typedef typename MT::CompositeType MCT;
99  typedef typename VT::CompositeType VCT;
100  //**********************************************************************************************
101 
102  //**********************************************************************************************
104  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
105  //**********************************************************************************************
106 
107  //**********************************************************************************************
109  enum { evaluateVector = RequiresEvaluation<VT>::value || IsComputation<VT>::value };
110  //**********************************************************************************************
111 
112  //**********************************************************************************************
114 
118  template< typename T1 >
119  struct UseSMPAssign {
120  enum { value = ( evaluateMatrix || evaluateVector ) };
121  };
123  //**********************************************************************************************
124 
125  public:
126  //**Type definitions****************************************************************************
131  typedef const ElementType ReturnType;
132 
134  typedef const ResultType CompositeType;
135 
137  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
138 
140  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type RightOperand;
141 
144 
147  //**********************************************************************************************
148 
149  //**Compilation flags***************************************************************************
151  enum { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
152  !evaluateVector && VT::smpAssignable };
153  //**********************************************************************************************
154 
155  //**Constructor*********************************************************************************
161  explicit inline TSMatSVecMultExpr( const MT& mat, const VT& vec )
162  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
163  , vec_( vec ) // Right-hand side sparse vector of the multiplication expression
164  {
165  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
166  }
167  //**********************************************************************************************
168 
169  //**Subscript operator**************************************************************************
175  inline ReturnType operator[]( size_t index ) const {
176  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
177 
178  typedef typename RemoveReference<MCT>::Type::ConstIterator MatrixIterator;
179  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
180 
181  MCT A( mat_ ); // Evaluation of the left-hand side sparse matrix operand
182  VCT x( vec_ ); // Evaluation of the right-hand side sparse vector operand
183 
184  BLAZE_INTERNAL_ASSERT( A.rows() == mat_.rows() , "Invalid number of rows" );
185  BLAZE_INTERNAL_ASSERT( A.columns() == mat_.columns(), "Invalid number of columns" );
186  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size() , "Invalid vector size" );
187 
188  ElementType res;
189 
190  const VectorIterator vend( x.end() );
191  VectorIterator velem( x.begin() );
192 
193  if( vec_.size() > 0UL && velem != vend ) {
194  res = A( index, velem->index() ) * velem->value();
195  ++velem;
196  for( ; velem!=vend; ++velem )
197  res += A( index, velem->index() ) * velem->value();
198  }
199  else {
200  reset( res );
201  }
202 
203  return res;
204  }
205  //**********************************************************************************************
206 
207  //**Size function*******************************************************************************
212  inline size_t size() const {
213  return mat_.rows();
214  }
215  //**********************************************************************************************
216 
217  //**NonZeros function***************************************************************************
222  inline size_t nonZeros() const {
223  return mat_.rows();
224  }
225  //**********************************************************************************************
226 
227  //**Left operand access*************************************************************************
232  inline LeftOperand leftOperand() const {
233  return mat_;
234  }
235  //**********************************************************************************************
236 
237  //**Right operand function**********************************************************************
242  inline RightOperand rightOperand() const {
243  return vec_;
244  }
245  //**********************************************************************************************
246 
247  //**********************************************************************************************
253  template< typename T >
254  inline bool canAlias( const T* alias ) const {
255  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
256  }
257  //**********************************************************************************************
258 
259  //**********************************************************************************************
265  template< typename T >
266  inline bool isAliased( const T* alias ) const {
267  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
268  }
269  //**********************************************************************************************
270 
271  //**********************************************************************************************
276  inline bool canSMPAssign() const {
277  return ( size() > SMP_SMATSVECMULT_THRESHOLD );
278  }
279  //**********************************************************************************************
280 
281  private:
282  //**Member variables****************************************************************************
285  //**********************************************************************************************
286 
287  //**Assignment to dense vectors*****************************************************************
300  template< typename VT1 > // Type of the target dense vector
301  friend inline void assign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
302  {
304 
305  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
306 
307  // Resetting the left-hand side target dense vector
308  reset( ~lhs );
309 
310  // Evaluation of the right-hand side sparse vector operand
311  RT x( serial( rhs.vec_ ) );
312  if( x.nonZeros() == 0UL ) return;
313 
314  // Evaluation of the left-hand side sparse matrix operand
315  LT A( serial( rhs.mat_ ) );
316 
317  // Checking the evaluated operators
318  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
319  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
320  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
321  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
322 
323  // Performing the transpose sparse matrix-sparse vector multiplication
324  TSMatSVecMultExpr::selectAssignKernel( ~lhs, A, x );
325  }
327  //**********************************************************************************************
328 
329  //**Default assignment to dense vectors*********************************************************
343  template< typename VT1 // Type of the left-hand side target vector
344  , typename MT1 // Type of the left-hand side matrix operand
345  , typename VT2 > // Type of the right-hand side vector operand
346  static inline void selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
347  {
348  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
349  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
350 
351  const VectorIterator vend ( x.end() );
352  VectorIterator velem( x.begin() );
353 
354  for( ; velem!=vend; ++velem )
355  {
356  const MatrixIterator mend ( A.end ( velem->index() ) );
357  MatrixIterator melem( A.begin( velem->index() ) );
358 
359  for( ; melem!=mend; ++melem ) {
361  isDefault( y[melem->index()] ) )
362  y[melem->index()] = melem->value() * velem->value();
363  else
364  y[melem->index()] += melem->value() * velem->value();
365  }
366  }
367  }
369  //**********************************************************************************************
370 
371  //**Assignment to sparse vectors****************************************************************
383  template< typename VT1 > // Type of the target sparse vector
384  friend inline void assign( SparseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
385  {
387 
388  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
389 
390  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
391  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
392 
393  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side sparse vector operand
394  if( x.nonZeros() == 0UL ) return;
395 
396  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
397 
398  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
399  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
400  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
401  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
402 
403  DynamicVector<ElementType> tmp( (~lhs).size() );
404  std::vector<bool> indices( (~lhs).size(), false );
405  size_t nonzeros( 0UL );
406 
407  const VectorIterator vend ( x.end() );
408  VectorIterator velem( x.begin() );
409 
410  for( ; velem!=vend; ++velem )
411  {
412  const MatrixIterator mend ( A.end( velem->index() ) );
413  MatrixIterator melem( A.begin( velem->index() ) );
414 
415  for( ; melem!=mend; ++melem ) {
416  if( !indices[melem->index()] ) {
417  indices[melem->index()] = true;
418  ++nonzeros;
419  tmp[melem->index()] = melem->value() * velem->value();
420  }
421  else {
422  tmp[melem->index()] += melem->value() * velem->value();
423  }
424  }
425  }
426 
427  (~lhs).reserve( nonzeros );
428 
429  for( size_t i=0UL; i<(~lhs).size(); ++i ) {
430  if( indices[i] ) {
431  (~lhs).append( i, tmp[i] );
432  }
433  }
434  }
436  //**********************************************************************************************
437 
438  //**Addition assignment to dense vectors********************************************************
451  template< typename VT1 > // Type of the target dense vector
452  friend inline void addAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
453  {
455 
456  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
457 
458  // Evaluation of the right-hand side sparse vector operand
459  RT x( serial( rhs.vec_ ) );
460  if( x.nonZeros() == 0UL ) return;
461 
462  // Evaluation of the left-hand side sparse matrix operand
463  LT A( serial( rhs.mat_ ) );
464 
465  // Checking the evaluated operators
466  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
467  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
468  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
469  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
470 
471  // Performing the transpose sparse matrix-sparse vector multiplication
472  TSMatSVecMultExpr::selectAddAssignKernel( ~lhs, A, x );
473  }
475  //**********************************************************************************************
476 
477  //**Default addition assignment to dense vectors************************************************
491  template< typename VT1 // Type of the left-hand side target vector
492  , typename MT1 // Type of the left-hand side matrix operand
493  , typename VT2 > // Type of the right-hand side vector operand
494  static inline void selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
495  {
496  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
497  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
498 
499  const VectorIterator vend ( x.end() );
500  VectorIterator velem( x.begin() );
501 
502  for( ; velem!=vend; ++velem )
503  {
504  const MatrixIterator mend ( A.end ( velem->index() ) );
505  MatrixIterator melem( A.begin( velem->index() ) );
506 
507  for( ; melem!=mend; ++melem ) {
508  y[melem->index()] += melem->value() * velem->value();
509  }
510  }
511  }
513  //**********************************************************************************************
514 
515  //**Addition assignment to sparse vectors*******************************************************
516  // No special implementation for the addition assignment to sparse vectors.
517  //**********************************************************************************************
518 
519  //**Subtraction assignment to dense vectors*****************************************************
532  template< typename VT1 > // Type of the target dense vector
533  friend inline void subAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
534  {
536 
537  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
538 
539  // Evaluation of the right-hand side sparse vector operand
540  RT x( serial( rhs.vec_ ) );
541  if( x.nonZeros() == 0UL ) return;
542 
543  // Evaluation of the left-hand side sparse matrix operand
544  LT A( serial( rhs.mat_ ) );
545 
546  // Checking the evaluated operators
547  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
548  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
549  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
550  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
551 
552  // Performing the transpose sparse matrix-sparse vector multiplication
553  TSMatSVecMultExpr::selectSubAssignKernel( ~lhs, A, x );
554  }
556  //**********************************************************************************************
557 
558  //**Default subtraction assignment to dense vectors*********************************************
572  template< typename VT1 // Type of the left-hand side target vector
573  , typename MT1 // Type of the left-hand side matrix operand
574  , typename VT2 > // Type of the right-hand side vector operand
575  static inline void selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
576  {
577  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
578  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
579 
580  const VectorIterator vend ( x.end() );
581  VectorIterator velem( x.begin() );
582 
583  for( ; velem!=vend; ++velem )
584  {
585  const MatrixIterator mend ( A.end ( velem->index() ) );
586  MatrixIterator melem( A.begin( velem->index() ) );
587 
588  for( ; melem!=mend; ++melem ) {
589  y[melem->index()] -= melem->value() * velem->value();
590  }
591  }
592  }
594  //**********************************************************************************************
595 
596  //**Subtraction assignment to sparse vectors****************************************************
597  // No special implementation for the subtraction assignment to sparse vectors.
598  //**********************************************************************************************
599 
600  //**Multiplication assignment to dense vectors**************************************************
613  template< typename VT1 > // Type of the target dense vector
614  friend inline void multAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
615  {
617 
621 
622  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
623 
624  const ResultType tmp( serial( rhs ) );
625  multAssign( ~lhs, tmp );
626  }
628  //**********************************************************************************************
629 
630  //**Multiplication assignment to sparse vectors*************************************************
631  // No special implementation for the multiplication assignment to sparse vectors.
632  //**********************************************************************************************
633 
634  //**SMP assignment to dense vectors*************************************************************
649  template< typename VT1 > // Type of the target dense vector
650  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
651  smpAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
652  {
654 
655  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
656 
657  // Resetting the left-hand side target dense vector
658  reset( ~lhs );
659 
660  // Evaluation of the right-hand side sparse vector operand
661  RT x( rhs.vec_ );
662  if( x.nonZeros() == 0UL ) return;
663 
664  // Evaluation of the left-hand side sparse matrix operand
665  LT A( rhs.mat_ );
666 
667  // Checking the evaluated operators
668  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
669  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
670  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
671  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
672 
673  // Performing the transpose sparse matrix-sparse vector multiplication
674  smpAssign( ~lhs, A * x );
675  }
677  //**********************************************************************************************
678 
679  //**SMP assignment to sparse vectors************************************************************
680  // No special implementation for the SMP assignment to sparse vectors.
681  //**********************************************************************************************
682 
683  //**SMP addition assignment to dense vectors****************************************************
698  template< typename VT1 > // Type of the target dense vector
699  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
700  smpAddAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
701  {
703 
704  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
705 
706  // Evaluation of the right-hand side sparse vector operand
707  RT x( rhs.vec_ );
708  if( x.nonZeros() == 0UL ) return;
709 
710  // Evaluation of the left-hand side sparse matrix operand
711  LT A( rhs.mat_ );
712 
713  // Checking the evaluated operators
714  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
715  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
716  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
717  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
718 
719  // Performing the transpose sparse matrix-sparse vector multiplication
720  smpAddAssign( ~lhs, A * x );
721  }
723  //**********************************************************************************************
724 
725  //**SMP addition assignment to sparse vectors***************************************************
726  // No special implementation for the SMP addition assignment to sparse vectors.
727  //**********************************************************************************************
728 
729  //**SMP subtraction assignment to dense vectors*************************************************
744  template< typename VT1 > // Type of the target dense vector
745  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
746  smpSubAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
747  {
749 
750  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
751 
752  // Evaluation of the right-hand side sparse vector operand
753  RT x( rhs.vec_ );
754  if( x.nonZeros() == 0UL ) return;
755 
756  // Evaluation of the left-hand side sparse matrix operand
757  LT A( rhs.mat_ );
758 
759  // Checking the evaluated operators
760  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
761  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
762  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
763  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
764 
765  // Performing the transpose sparse matrix-sparse vector multiplication
766  smpSubAssign( ~lhs, A * x );
767  }
769  //**********************************************************************************************
770 
771  //**SMP subtraction assignment to sparse vectors************************************************
772  // No special implementation for the SMP subtraction assignment to sparse vectors.
773  //**********************************************************************************************
774 
775  //**SMP multiplication assignment to dense vectors**********************************************
790  template< typename VT1 > // Type of the target dense vector
791  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
792  smpMultAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
793  {
795 
799 
800  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
801 
802  const ResultType tmp( rhs );
803  smpMultAssign( ~lhs, tmp );
804  }
806  //**********************************************************************************************
807 
808  //**SMP multiplication assignment to sparse vectors*********************************************
809  // No special implementation for the SMP multiplication assignment to sparse vectors.
810  //**********************************************************************************************
811 
812  //**Compile time checks*************************************************************************
819  //**********************************************************************************************
820 };
821 //*************************************************************************************************
822 
823 
824 
825 
826 //=================================================================================================
827 //
828 // GLOBAL BINARY ARITHMETIC OPERATORS
829 //
830 //=================================================================================================
831 
832 //*************************************************************************************************
863 template< typename T1 // Type of the left-hand side sparse matrix
864  , typename T2 > // Type of the right-hand side sparse vector
865 inline const typename DisableIf< IsMatMatMultExpr<T1>, TSMatSVecMultExpr<T1,T2> >::Type
867 {
869 
870  if( (~mat).columns() != (~vec).size() )
871  throw std::invalid_argument( "Matrix and vector sizes do not match" );
872 
873  return TSMatSVecMultExpr<T1,T2>( ~mat, ~vec );
874 }
875 //*************************************************************************************************
876 
877 
878 
879 
880 //=================================================================================================
881 //
882 // EXPRESSION TRAIT SPECIALIZATIONS
883 //
884 //=================================================================================================
885 
886 //*************************************************************************************************
888 template< typename MT, typename VT, bool AF >
889 struct SubvectorExprTrait< TSMatSVecMultExpr<MT,VT>, AF >
890 {
891  public:
892  //**********************************************************************************************
893  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type, VT >::Type Type;
894  //**********************************************************************************************
895 };
897 //*************************************************************************************************
898 
899 } // namespace blaze
900 
901 #endif
VT::CompositeType VCT
Composite type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:99
const size_t SMP_SMATSVECMULT_THRESHOLD
SMP row-major sparse matrix/sparse vector multiplication threshold.This threshold specifies when a ro...
Definition: Thresholds.h:598
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4599
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:4329
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSMatSVecMultExpr.h:222
Header file for the SparseVector base class.
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:137
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: TransposeFlag.h:159
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatSVecMultExpr.h:134
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4642
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
void smpMultAssign(DenseVector< 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:179
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TSMatSVecMultExpr.h:266
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
size_t size() const
Returns the current size/dimension of the vector.
Definition: TSMatSVecMultExpr.h:212
SelectType< evaluateVector, const VRT, VCT >::Type RT
Type for the assignment of the right-hand side sparse vector operand.
Definition: TSMatSVecMultExpr.h:146
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
SelectType< evaluateMatrix, const MRT, MCT >::Type LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: TSMatSVecMultExpr.h:143
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:140
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
Constraint on the data type.
MT::ResultType MRT
Result type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:96
Constraint on the data type.
void smpAddAssign(DenseMatrix< 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:122
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:253
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.
Expression object for sparse matrix-sparse vector multiplications.The TSMatSVecMultExpr class represe...
Definition: Forward.h:142
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: StorageOrder.h:161
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
Header file for the IsMatMatMultExpr type trait class.
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:271
ResultType::ElementType ElementType
Resulting element type.
Definition: TSMatSVecMultExpr.h:130
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
Constraint on the data type.
LeftOperand leftOperand() const
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatSVecMultExpr.h:232
#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
TSMatSVecMultExpr< MT, VT > This
Type of this TSMatSVecMultExpr instance.
Definition: TSMatSVecMultExpr.h:127
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatSVecMultExpr.h:283
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: TSMatSVecMultExpr.h:254
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:361
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the complete DynamicVector implementation.
Header file for the EnableIf class template.
Header file for the serial shim.
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
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.
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: TSMatSVecMultExpr.h:284
Base template for the MultTrait class.
Definition: MultTrait.h:141
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:301
Header file for the reset shim.
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:331
Header file for the isDefault shim.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSMatSVecMultExpr.h:175
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: TSMatSVecMultExpr.h:276
Header file for the RemoveReference type trait.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:131
VT::ResultType VRT
Result type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:97
Header file for the IsComputation type trait class.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
#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:2403
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:129
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:170
MultTrait< MRT, VRT >::Type ResultType
Result type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:128
Header file for basic type definitions.
TSMatSVecMultExpr(const MT &mat, const VT &vec)
Constructor for the TSMatSVecMultExpr class.
Definition: TSMatSVecMultExpr.h:161
RightOperand rightOperand() const
Returns the right-hand side sparse vector operand.
Definition: TSMatSVecMultExpr.h:242
Header file for the MatVecMultExpr base class.
Header file for the IsResizable 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
MT::CompositeType MCT
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:98
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.