All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 <stdexcept>
53 #include <blaze/math/shims/Reset.h>
64 #include <blaze/util/Assert.h>
66 #include <blaze/util/DisableIf.h>
67 #include <blaze/util/EnableIf.h>
69 #include <blaze/util/SelectType.h>
70 #include <blaze/util/Types.h>
72 
73 
74 namespace blaze {
75 
76 //=================================================================================================
77 //
78 // CLASS TSVECSMATMULTEXPR
79 //
80 //=================================================================================================
81 
82 //*************************************************************************************************
89 template< typename VT // Type of the left-hand side sparse vector
90  , typename MT > // Type of the right-hand side sparse matrix
91 class TSVecSMatMultExpr : public SparseVector< TSVecSMatMultExpr<VT,MT>, true >
92  , private TVecMatMultExpr
93  , private Computation
94 {
95  private:
96  //**Type definitions****************************************************************************
97  typedef typename VT::ResultType VRT;
98  typedef typename MT::ResultType MRT;
99  typedef typename VT::CompositeType VCT;
100  typedef typename MT::CompositeType MCT;
101  //**********************************************************************************************
102 
103  //**********************************************************************************************
105  enum { evaluateVector = IsComputation<VT>::value };
106  //**********************************************************************************************
107 
108  //**********************************************************************************************
110  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
111  //**********************************************************************************************
112 
113  //**********************************************************************************************
115 
118  template< typename T1, typename T2, typename T3 >
119  struct UseSMPAssignKernel {
120  enum { value = evaluateVector || evaluateMatrix };
121  };
123  //**********************************************************************************************
124 
125  public:
126  //**Type definitions****************************************************************************
131  typedef const ElementType ReturnType;
132  typedef const ResultType CompositeType;
133 
135  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
136 
138  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type RightOperand;
139 
142 
144  typedef MCT RT;
145  //**********************************************************************************************
146 
147  //**Compilation flags***************************************************************************
149  enum { smpAssignable = !evaluateMatrix && !evaluateVector };
150  //**********************************************************************************************
151 
152  //**Constructor*********************************************************************************
158  explicit inline TSVecSMatMultExpr( const VT& vec, const MT& mat )
159  : vec_( vec ) // Left-hand side sparse vector of the multiplication expression
160  , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
161  {
162  BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
163  }
164  //**********************************************************************************************
165 
166  //**Subscript operator**************************************************************************
172  inline ReturnType operator[]( size_t index ) const {
173  BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
174 
175  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
176 
177  VCT x( vec_ ); // Evaluation of the left-hand side sparse vector operand
178  MCT A( mat_ ); // Evaluation of the right-hand side sparse matrix operand
179 
180  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size() , "Invalid vector size" );
181  BLAZE_INTERNAL_ASSERT( A.rows() == mat_.rows() , "Invalid number of rows" );
182  BLAZE_INTERNAL_ASSERT( A.columns() == mat_.columns(), "Invalid number of columns" );
183 
184  const VectorIterator vend( x.end() );
185  VectorIterator velem( x.begin() );
186  ElementType res;
187 
188  if( velem != vend ) {
189  res = velem->value() * A(velem->index(),index);
190  ++velem;
191  for( ; velem!=vend; ++velem ) {
192  res += velem->value() * A(velem->index(),index);
193  }
194  }
195  else {
196  reset( res );
197  }
198 
199  return res;
200  }
201  //**********************************************************************************************
202 
203  //**Size function*******************************************************************************
208  inline size_t size() const {
209  return mat_.columns();
210  }
211  //**********************************************************************************************
212 
213  //**NonZeros function***************************************************************************
218  inline size_t nonZeros() const {
219  return mat_.columns();
220  }
221  //**********************************************************************************************
222 
223  //**Left operand access*************************************************************************
228  inline LeftOperand leftOperand() const {
229  return vec_;
230  }
231  //**********************************************************************************************
232 
233  //**Right operand access************************************************************************
238  inline RightOperand rightOperand() const {
239  return mat_;
240  }
241  //**********************************************************************************************
242 
243  //**********************************************************************************************
249  template< typename T >
250  inline bool canAlias( const T* alias ) const {
251  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
252  }
253  //**********************************************************************************************
254 
255  //**********************************************************************************************
261  template< typename T >
262  inline bool isAliased( const T* alias ) const {
263  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
264  }
265  //**********************************************************************************************
266 
267  //**********************************************************************************************
272  inline bool canSMPAssign() const {
273  return ( size() > SMP_TSVECSMATMULT_THRESHOLD );
274  }
275  //**********************************************************************************************
276 
277  private:
278  //**Member variables****************************************************************************
281  //**********************************************************************************************
282 
283  //**Assignment to dense vectors*****************************************************************
296  template< typename VT1 > // Type of the target dense vector
297  friend inline void assign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
298  {
300 
301  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
302 
303  // Resetting the left-hand side target dense vector
304  reset( ~lhs );
305 
306  // Evaluation of the left-hand side sparse vector operand
307  LT x( rhs.vec_ );
308  if( x.nonZeros() == 0UL ) return;
309 
310  // Evaluation of the right-hand side sparse matrix operand
311  RT A( rhs.mat_ );
312 
313  // Checking the evaluated operands
314  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
315  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
316  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
317  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
318 
319  // Performing the sparse vector-sparse matrix multiplication
320  TSVecSMatMultExpr::selectAssignKernel( ~lhs, x, A );
321  }
323  //**********************************************************************************************
324 
325  //**Serial assignment to dense vectors**********************************************************
339  template< typename VT1 // Type of the left-hand side target vector
340  , typename VT2 // Type of the left-hand side vector operand
341  , typename MT1 > // Type of the right-hand side matrix operand
342  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
343  selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
344  {
345  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
346  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
347 
348  const VectorIterator vend( x.end() );
349  VectorIterator velem( x.begin() );
350 
351  for( ; velem!=vend; ++velem )
352  {
353  const MatrixIterator mend( A.end( velem->index() ) );
354  MatrixIterator melem( A.begin( velem->index() ) );
355 
356  for( ; melem!=mend; ++melem ) {
358  isDefault( y[melem->index()] ) )
359  y[melem->index()] = velem->value() * melem->value();
360  else
361  y[melem->index()] += velem->value() * melem->value();
362  }
363  }
364  }
366  //**********************************************************************************************
367 
368  //**SMP assignment to dense vectors*************************************************************
382  template< typename VT1 // Type of the left-hand side target vector
383  , typename VT2 // Type of the left-hand side vector operand
384  , typename MT1 > // Type of the right-hand side matrix operand
385  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
386  selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
387  {
388  smpAssign( y, x * A );
389  }
391  //**********************************************************************************************
392 
393  //**Assignment to sparse vectors****************************************************************
405  template< typename VT1 > // Type of the target sparse vector
406  friend inline void assign( SparseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
407  {
409 
410  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
411 
412  typedef typename RemoveReference<LT>::Type::ConstIterator VectorIterator;
413  typedef typename RemoveReference<RT>::Type::ConstIterator MatrixIterator;
414 
415  // Evaluation of the left-hand side sparse vector operand
416  LT x( rhs.vec_ );
417  if( x.nonZeros() == 0UL ) return;
418 
419  // Evaluation of the right-hand side sparse matrix operand
420  RT A( rhs.mat_ );
421 
422  // Checking the evaluated operands
423  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
424  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
425  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
426  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
427 
428  // Performing the sparse vector-sparse matrix multiplication
429  const VectorIterator vend( x.end() );
430  VectorIterator velem( x.begin() );
431 
432  for( ; velem!=vend; ++velem )
433  {
434  const MatrixIterator mend( A.end( velem->index() ) );
435  MatrixIterator melem( A.begin( velem->index() ) );
436 
437  for( ; melem!=mend; ++melem )
438  {
439  typename VT1::Iterator pos( (~lhs).find( melem->index() ) );
440  if( pos != (~lhs).end() )
441  pos->value() += velem->value() * melem->value();
442  else
443  (~lhs).insert( melem->index(), velem->value() * melem->value() );
444  }
445  }
446  }
448  //**********************************************************************************************
449 
450  //**Addition assignment to dense vectors********************************************************
463  template< typename VT1 > // Type of the target dense vector
464  friend inline void addAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
465  {
467 
468  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
469 
470  // Evaluation of the left-hand side sparse vector operand
471  LT x( rhs.vec_ );
472  if( x.nonZeros() == 0UL ) return;
473 
474  // Evaluation of the right-hand side sparse matrix operand
475  RT A( rhs.mat_ );
476 
477  // Checking the evaluated operands
478  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
479  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
480  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
481  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
482 
483  // Performing the sparse vector-sparse matrix multiplication
484  TSVecSMatMultExpr::selectAddAssignKernel( ~lhs, x, A );
485  }
487  //**********************************************************************************************
488 
489  //**Serial addition assignment to dense vectors*************************************************
503  template< typename VT1 // Type of the left-hand side target vector
504  , typename VT2 // Type of the left-hand side vector operand
505  , typename MT1 > // Type of the right-hand side matrix operand
506  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
507  selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
508  {
509  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
510  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
511 
512  const VectorIterator vend( x.end() );
513  VectorIterator velem( x.begin() );
514 
515  for( ; velem!=vend; ++velem )
516  {
517  const MatrixIterator mend( A.end( velem->index() ) );
518  MatrixIterator melem( A.begin( velem->index() ) );
519 
520  for( ; melem!=mend; ++melem ) {
521  y[melem->index()] += velem->value() * melem->value();
522  }
523  }
524  }
526  //**********************************************************************************************
527 
528  //**SMP addition assignment to dense vectors****************************************************
542  template< typename VT1 // Type of the left-hand side target vector
543  , typename VT2 // Type of the left-hand side vector operand
544  , typename MT1 > // Type of the right-hand side matrix operand
545  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
546  selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
547  {
548  smpAddAssign( y, x * A );
549  }
551  //**********************************************************************************************
552 
553  //**Addition assignment to sparse vectors*******************************************************
554  // No special implementation for the addition assignment to sparse vectors.
555  //**********************************************************************************************
556 
557  //**Subtraction assignment to dense vectors*****************************************************
570  template< typename VT1 > // Type of the target dense vector
571  friend inline void subAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
572  {
574 
575  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
576 
577  // Evaluation of the left-hand side sparse vector operand
578  LT x( rhs.vec_ );
579  if( x.nonZeros() == 0UL ) return;
580 
581  // Evaluation of the right-hand side sparse matrix operand
582  RT A( rhs.mat_ );
583 
584  // Checking the evaluated operands
585  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
586  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
587  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
588  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
589 
590  // Performing the sparse vector-sparse matrix multiplication
591  TSVecSMatMultExpr::selectSubAssignKernel( ~lhs, x, A );
592  }
594  //**********************************************************************************************
595 
596  //**Serial subtraction assignment to dense vectors*********************************************
610  template< typename VT1 // Type of the left-hand side target vector
611  , typename VT2 // Type of the left-hand side vector operand
612  , typename MT1 > // Type of the right-hand side matrix operand
613  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
614  selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
615  {
616  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
617  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
618 
619  const VectorIterator vend( x.end() );
620  VectorIterator velem( x.begin() );
621 
622  for( ; velem!=vend; ++velem )
623  {
624  const MatrixIterator mend( A.end( velem->index() ) );
625  MatrixIterator melem( A.begin( velem->index() ) );
626 
627  for( ; melem!=mend; ++melem ) {
628  y[melem->index()] -= velem->value() * melem->value();
629  }
630  }
631  }
633  //**********************************************************************************************
634 
635  //**SMP subtraction assignment to dense vectors*************************************************
649  template< typename VT1 // Type of the left-hand side target vector
650  , typename VT2 // Type of the left-hand side vector operand
651  , typename MT1 > // Type of the right-hand side matrix operand
652  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
653  selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
654  {
655  smpSubAssign( y, x * A );
656  }
658  //**********************************************************************************************
659 
660  //**Subtraction assignment to sparse vectors****************************************************
661  // No special implementation for the subtraction assignment to sparse vectors.
662  //**********************************************************************************************
663 
664  //**Multiplication assignment to dense vectors**************************************************
677  template< typename VT1 > // Type of the target dense vector
678  friend inline void multAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
679  {
681 
685 
686  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
687 
688  const ResultType tmp( rhs );
689  smpMultAssign( ~lhs, tmp );
690  }
692  //**********************************************************************************************
693 
694  //**Multiplication assignment to sparse vectors*************************************************
695  // No special implementation for the multiplication assignment to sparse vectors.
696  //**********************************************************************************************
697 
698  //**Compile time checks*************************************************************************
705  //**********************************************************************************************
706 };
707 //*************************************************************************************************
708 
709 
710 
711 
712 //=================================================================================================
713 //
714 // GLOBAL BINARY ARITHMETIC OPERATORS
715 //
716 //=================================================================================================
717 
718 //*************************************************************************************************
749 template< typename T1 // Type of the left-hand side sparse vector
750  , typename T2 > // Type of the right-hand side sparse matrix
751 inline const typename DisableIf< IsMatMatMultExpr<T2>, TSVecSMatMultExpr<T1,T2> >::Type
753 {
755 
756  if( (~vec).size() != (~mat).rows() )
757  throw std::invalid_argument( "Vector and matrix sizes do not match" );
758 
759  return TSVecSMatMultExpr<T1,T2>( ~vec, ~mat );
760 }
761 //*************************************************************************************************
762 
763 
764 
765 
766 //=================================================================================================
767 //
768 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
769 //
770 //=================================================================================================
771 
772 //*************************************************************************************************
785 template< typename T1 // Type of the left-hand side sparse vector
786  , typename T2 // Type of the right-hand side sparse matrix
787  , bool SO > // Storage order of the right-hand side sparse matrix
788 inline const typename EnableIf< IsMatMatMultExpr<T2>, MultExprTrait<T1,T2> >::Type::Type
790 {
792 
793  return ( vec * (~mat).leftOperand() ) * (~mat).rightOperand();
794 }
795 //*************************************************************************************************
796 
797 
798 
799 
800 //=================================================================================================
801 //
802 // EXPRESSION TRAIT SPECIALIZATIONS
803 //
804 //=================================================================================================
805 
806 //*************************************************************************************************
808 template< typename VT, typename MT, bool AF >
809 struct SubvectorExprTrait< TSVecSMatMultExpr<VT,MT>, AF >
810 {
811  public:
812  //**********************************************************************************************
813  typedef typename MultExprTrait< VT, typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
814  //**********************************************************************************************
815 };
817 //*************************************************************************************************
818 
819 } // namespace blaze
820 
821 #endif
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:4579
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:129
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:4075
Header file for the SparseVector base class.
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:151
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSVecSMatMultExpr.h:132
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:197
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:178
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2384
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:138
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:249
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
VT::CompositeType VCT
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:99
MultTrait< VRT, MRT >::Type ResultType
Result type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:128
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:104
Constraint on the data type.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSVecSMatMultExpr.h:172
Constraint on the data type.
Header file for the MultExprTrait class template.
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:121
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:251
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.
Header file for the dense vector SMP implementation.
RightOperand rightOperand() const
Returns the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:238
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
Expression object for sparse vector-sparse matrix multiplications.The TSVecSMatMultExpr class represe...
Definition: Forward.h:144
TSVecSMatMultExpr< VT, MT > This
Type of this TSVecSMatMultExpr instance.
Definition: TSVecSMatMultExpr.h:127
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:179
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.
#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
Constraints on the storage order of matrix types.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSVecSMatMultExpr.h:131
MCT RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:144
LeftOperand vec_
Left-hand side sparse vector of the multiplication expression.
Definition: TSVecSMatMultExpr.h:279
ResultType::ElementType ElementType
Resulting element type.
Definition: TSVecSMatMultExpr.h:130
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.
Constraint on the data type.
VT::ResultType VRT
Result type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:97
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSVecSMatMultExpr.h:218
Header file for the EnableIf class template.
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:91
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSVecSMatMultExpr.h:280
#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: StorageOrder.h:81
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.
Base template for the MultTrait class.
Definition: MultTrait.h:141
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: TSVecSMatMultExpr.h:272
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
size_t size() const
Returns the current size/dimension of the vector.
Definition: TSVecSMatMultExpr.h:208
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:239
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2387
Header file for the isDefault shim.
Header file for the TVecMatMultExpr base class.
const size_t SMP_TSVECSMATMULT_THRESHOLD
SMP sparse vector/row-major sparse matrix multiplication threshold.This threshold represents the syst...
Definition: Thresholds.h:321
TSVecSMatMultExpr(const VT &vec, const MT &mat)
Constructor for the TSVecSMatMultExpr class.
Definition: TSVecSMatMultExpr.h:158
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
SelectType< evaluateVector, const VRT, VCT >::Type LT
Type for the assignment of the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:141
Header file for the IsComputation type trait class.
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: TSVecSMatMultExpr.h:228
Header file for the sparse vector SMP implementation.
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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2379
Header file for basic type definitions.
#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: TransposeFlag.h:81
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:135
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: TSVecSMatMultExpr.h:250
MT::CompositeType MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:100
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TSVecSMatMultExpr.h:262
Header file for the IsResizable type trait.
MT::ResultType MRT
Result type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:98
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:138
#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
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.