All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSVecTSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSVECTSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSVECTSMATMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
53 #include <blaze/math/shims/Reset.h>
62 #include <blaze/util/Assert.h>
64 #include <blaze/util/DisableIf.h>
66 #include <blaze/util/SelectType.h>
67 #include <blaze/util/Types.h>
69 
70 
71 namespace blaze {
72 
73 //=================================================================================================
74 //
75 // CLASS TSVECTSMATMULTEXPR
76 //
77 //=================================================================================================
78 
79 //*************************************************************************************************
86 template< typename VT // Type of the left-hand side sparse vector
87  , typename MT > // Type of the right-hand side sparse matrix
88 class TSVecTSMatMultExpr : public SparseVector< TSVecTSMatMultExpr<VT,MT>, true >
89  , private TVecMatMultExpr
90  , private Computation
91 {
92  private:
93  //**Type definitions****************************************************************************
94  typedef typename VT::ResultType VRT;
95  typedef typename MT::ResultType MRT;
96  typedef typename VT::CompositeType VCT;
97  typedef typename MT::CompositeType MCT;
98  //**********************************************************************************************
99 
100  //**********************************************************************************************
102  enum { evaluateVector = IsComputation<VT>::value };
103  //**********************************************************************************************
104 
105  //**********************************************************************************************
107  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
108  //**********************************************************************************************
109 
110  //**********************************************************************************************
112 
115  template< typename T1, typename T2, typename T3 >
116  struct UseSMPAssignKernel {
117  enum { value = evaluateVector || evaluateMatrix };
118  };
120  //**********************************************************************************************
121 
122  public:
123  //**Type definitions****************************************************************************
128  typedef const ElementType ReturnType;
129  typedef const ResultType CompositeType;
130 
132  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
133 
135  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type RightOperand;
136 
139 
141  typedef MCT RT;
142  //**********************************************************************************************
143 
144  //**Compilation flags***************************************************************************
146  enum { smpAssignable = !evaluateMatrix && !evaluateVector };
147  //**********************************************************************************************
148 
149  //**Constructor*********************************************************************************
155  explicit inline TSVecTSMatMultExpr( const VT& vec, const MT& mat )
156  : vec_( vec ) // Left-hand side sparse vector of the multiplication expression
157  , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
158  {
159  BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
160  }
161  //**********************************************************************************************
162 
163  //**Subscript operator**************************************************************************
169  inline ReturnType operator[]( size_t index ) const {
170  BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
171 
172  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
173  typedef typename RemoveReference<MCT>::Type::ConstIterator MatrixIterator;
174 
175  VCT x( vec_ ); // Evaluation of the left-hand side sparse vector operand
176  MCT A( mat_ ); // Evaluation of the right-hand side sparse matrix operand
177 
178  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size() , "Invalid vector size" );
179  BLAZE_INTERNAL_ASSERT( A.rows() == mat_.rows() , "Invalid number of rows" );
180  BLAZE_INTERNAL_ASSERT( A.columns() == mat_.columns(), "Invalid number of columns" );
181 
182  ElementType res = ElementType();
183 
184  VectorIterator velem( x.begin() );
185  const VectorIterator vend( x.end() );
186  if( velem == vend ) {
187  reset( res );
188  return res;
189  }
190 
191  MatrixIterator melem( A.begin(index) );
192  const MatrixIterator mend( A.end(index) );
193  if( melem == mend ) {
194  reset( res );
195  return res;
196  }
197 
198  while( true ) {
199  if( velem->index() < melem->index() ) {
200  ++velem;
201  if( velem == vend ) break;
202  }
203  else if( melem->index() < velem->index() ) {
204  ++melem;
205  if( melem == mend ) break;
206  }
207  else {
208  res = velem->value() * melem->value();
209  ++velem;
210  ++melem;
211  break;
212  }
213  }
214 
215  if( melem != mend && velem != vend )
216  {
217  while( true ) {
218  if( velem->index() < melem->index() ) {
219  ++velem;
220  if( velem == vend ) break;
221  }
222  else if( melem->index() < velem->index() ) {
223  ++melem;
224  if( melem == mend ) break;
225  }
226  else {
227  res += velem->value() * melem->value();
228  ++velem;
229  if( velem == vend ) break;
230  ++melem;
231  if( melem == mend ) break;
232  }
233  }
234  }
235 
236  return res;
237  }
238  //**********************************************************************************************
239 
240  //**Size function*******************************************************************************
245  inline size_t size() const {
246  return mat_.columns();
247  }
248  //**********************************************************************************************
249 
250  //**NonZeros function***************************************************************************
255  inline size_t nonZeros() const {
256  return mat_.columns();
257  }
258  //**********************************************************************************************
259 
260  //**Left operand access*************************************************************************
265  inline LeftOperand leftOperand() const {
266  return vec_;
267  }
268  //**********************************************************************************************
269 
270  //**Right operand access************************************************************************
275  inline RightOperand rightOperand() const {
276  return mat_;
277  }
278  //**********************************************************************************************
279 
280  //**********************************************************************************************
286  template< typename T >
287  inline bool canAlias( const T* alias ) const {
288  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
289  }
290  //**********************************************************************************************
291 
292  //**********************************************************************************************
298  template< typename T >
299  inline bool isAliased( const T* alias ) const {
300  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
301  }
302  //**********************************************************************************************
303 
304  //**********************************************************************************************
309  inline bool canSMPAssign() const {
310  return ( size() > SMP_TSVECSMATMULT_THRESHOLD );
311  }
312  //**********************************************************************************************
313 
314  private:
315  //**Member variables****************************************************************************
318  //**********************************************************************************************
319 
320  //**Assignment to dense vectors*****************************************************************
333  template< typename VT1 > // Type of the target dense vector
334  friend inline void assign( DenseVector<VT1,true>& lhs, const TSVecTSMatMultExpr& rhs )
335  {
337 
338  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
339 
340  // Resetting the left-hand side target dense vector
341  reset( ~lhs );
342 
343  // Evaluation of the left-hand side sparse vector operand
344  LT x( rhs.vec_ );
345  if( x.nonZeros() == 0UL ) return;
346 
347  // Evaluation of the right-hand side sparse matrix operand
348  RT A( rhs.mat_ );
349 
350  // Checking the evaluated operands
351  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
352  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
353  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
354  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
355 
356  // Performing the sparse vector-sparse matrix multiplication
357  TSVecTSMatMultExpr::selectAssignKernel( ~lhs, x, A );
358  }
360  //**********************************************************************************************
361 
362  //**Serial assignment to dense vectors**********************************************************
376  template< typename VT1 // Type of the left-hand side target vector
377  , typename VT2 // Type of the left-hand side vector operand
378  , typename MT1 > // Type of the right-hand side matrix operand
379  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
380  selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
381  {
382  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
383  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
384 
385  const VectorIterator vend( x.end() );
386 
387  for( size_t j=0UL; j<A.columns(); ++j )
388  {
389  const MatrixIterator mend ( A.end(j) );
390  MatrixIterator melem( A.begin(j) );
391 
392  if( melem == mend ) continue;
393 
394  VectorIterator velem( x.begin() );
395 
396  while( true ) {
397  if( velem->index() < melem->index() ) {
398  ++velem;
399  if( velem == vend ) break;
400  }
401  else if( melem->index() < velem->index() ) {
402  ++melem;
403  if( melem == mend ) break;
404  }
405  else {
406  y[j] = velem->value() * melem->value();
407  ++velem;
408  ++melem;
409  break;
410  }
411  }
412 
413  if( velem != vend && melem != mend )
414  {
415  while( true ) {
416  if( velem->index() < melem->index() ) {
417  ++velem;
418  if( velem == vend ) break;
419  }
420  else if( melem->index() < velem->index() ) {
421  ++melem;
422  if( melem == mend ) break;
423  }
424  else {
425  y[j] += velem->value() * melem->value();
426  ++velem;
427  if( velem == vend ) break;
428  ++melem;
429  if( melem == mend ) break;
430  }
431  }
432  }
433  }
434  }
436  //**********************************************************************************************
437 
438  //**SMP assignment to dense vectors*************************************************************
452  template< typename VT1 // Type of the left-hand side target vector
453  , typename VT2 // Type of the left-hand side vector operand
454  , typename MT1 > // Type of the right-hand side matrix operand
455  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
456  selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
457  {
458  smpAssign( y, x * A );
459  }
461  //**********************************************************************************************
462 
463  //**Assignment to sparse vectors****************************************************************
476  template< typename VT1 > // Type of the target sparse vector
477  friend inline void assign( SparseVector<VT1,true>& lhs, const TSVecTSMatMultExpr& rhs )
478  {
480 
481  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
482 
483  typedef typename RemoveReference<LT>::Type::ConstIterator VectorIterator;
484  typedef typename RemoveReference<RT>::Type::ConstIterator MatrixIterator;
485 
486  // Evaluation of the left-hand side sparse vector operand
487  LT x( rhs.vec_ );
488  if( x.nonZeros() == 0UL ) return;
489 
490  // Evaluation of the right-hand side sparse matrix operand
491  RT A( rhs.mat_ );
492 
493  // Checking the evaluated operands
494  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
495  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
496  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
497  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
498 
499  // Performing the sparse vector-sparse matrix multiplication
500  ElementType accu;
501  const VectorIterator vend( x.end() );
502 
503  for( size_t j=0UL; j<A.columns(); ++j )
504  {
505  const MatrixIterator mend ( A.end(j) );
506  MatrixIterator melem( A.begin(j) );
507 
508  if( melem == mend ) continue;
509 
510  VectorIterator velem( x.begin() );
511 
512  reset( accu );
513 
514  while( true ) {
515  if( velem->index() < melem->index() ) {
516  ++velem;
517  if( velem == vend ) break;
518  }
519  else if( melem->index() < velem->index() ) {
520  ++melem;
521  if( melem == mend ) break;
522  }
523  else {
524  accu = velem->value() * melem->value();
525  ++velem;
526  ++melem;
527  break;
528  }
529  }
530 
531  if( velem != vend && melem != mend )
532  {
533  while( true ) {
534  if( velem->index() < melem->index() ) {
535  ++velem;
536  if( velem == vend ) break;
537  }
538  else if( melem->index() < velem->index() ) {
539  ++melem;
540  if( melem == mend ) break;
541  }
542  else {
543  accu += velem->value() * melem->value();
544  ++velem;
545  if( velem == vend ) break;
546  ++melem;
547  if( melem == mend ) break;
548  }
549  }
550  }
551 
552  if( !isDefault( accu ) )
553  (~lhs).insert( j, accu );
554  }
555  }
557  //**********************************************************************************************
558 
559  //**Addition assignment to dense vectors********************************************************
572  template< typename VT1 > // Type of the target dense vector
573  friend inline void addAssign( DenseVector<VT1,true>& lhs, const TSVecTSMatMultExpr& rhs )
574  {
576 
577  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
578 
579  // Evaluation of the left-hand side sparse vector operand
580  LT x( rhs.vec_ );
581  if( x.nonZeros() == 0UL ) return;
582 
583  // Evaluation of the right-hand side sparse matrix operand
584  RT A( rhs.mat_ );
585 
586  // Checking the evaluated operands
587  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
588  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
589  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
590  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
591 
592  // Performing the sparse matrix-sparse vector multiplication
593  TSVecTSMatMultExpr::selectAddAssignKernel( ~lhs, x, A );
594  }
596  //**********************************************************************************************
597 
598  //**Serial addition assignment to dense vectors*************************************************
612  template< typename VT1 // Type of the left-hand side target vector
613  , typename VT2 // Type of the left-hand side vector operand
614  , typename MT1 > // Type of the right-hand side matrix operand
615  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
616  selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
617  {
618  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
619  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
620 
621  const VectorIterator vend( x.end() );
622 
623  for( size_t j=0UL; j<A.columns(); ++j )
624  {
625  const MatrixIterator mend ( A.end(j) );
626  MatrixIterator melem( A.begin(j) );
627 
628  if( melem == mend ) continue;
629 
630  VectorIterator velem( x.begin() );
631 
632  while( true ) {
633  if( velem->index() < melem->index() ) {
634  ++velem;
635  if( velem == vend ) break;
636  }
637  else if( melem->index() < velem->index() ) {
638  ++melem;
639  if( melem == mend ) break;
640  }
641  else {
642  y[j] += velem->value() * melem->value();
643  ++velem;
644  if( velem == vend ) break;
645  ++melem;
646  if( melem == mend ) break;
647  }
648  }
649  }
650  }
652  //**********************************************************************************************
653 
654  //**SMP addition assignment to dense vectors****************************************************
668  template< typename VT1 // Type of the left-hand side target vector
669  , typename VT2 // Type of the left-hand side vector operand
670  , typename MT1 > // Type of the right-hand side matrix operand
671  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
672  selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
673  {
674  smpAddAssign( y, x * A );
675  }
677  //**********************************************************************************************
678 
679  //**Addition assignment to sparse vectors*******************************************************
680  // No special implementation for the addition assignment to sparse vectors.
681  //**********************************************************************************************
682 
683  //**Subtraction assignment to dense vectors*****************************************************
696  template< typename VT1 > // Type of the target dense vector
697  friend inline void subAssign( DenseVector<VT1,true>& lhs, const TSVecTSMatMultExpr& rhs )
698  {
700 
701  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
702 
703  // Evaluation of the left-hand side sparse vector operand
704  LT x( rhs.vec_ );
705  if( x.nonZeros() == 0UL ) return;
706 
707  // Evaluation of the right-hand side sparse matrix operand
708  RT A( rhs.mat_ );
709 
710  // Checking the evaluated operands
711  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
712  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
713  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
714  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
715 
716  // Performing the sparse matrix-sparse vector multiplication
717  TSVecTSMatMultExpr::selectSubAssignKernel( ~lhs, x, A );
718  }
720  //**********************************************************************************************
721 
722  //**Serial subtraction assignment to dense vectors*********************************************
736  template< typename VT1 // Type of the left-hand side target vector
737  , typename VT2 // Type of the left-hand side vector operand
738  , typename MT1 > // Type of the right-hand side matrix operand
739  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
740  selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
741  {
742  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
743  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
744 
745  const VectorIterator vend( x.end() );
746 
747  for( size_t j=0UL; j<A.columns(); ++j )
748  {
749  const MatrixIterator mend ( A.end(j) );
750  MatrixIterator melem( A.begin(j) );
751 
752  if( melem == mend ) continue;
753 
754  VectorIterator velem( x.begin() );
755 
756  while( true ) {
757  if( velem->index() < melem->index() ) {
758  ++velem;
759  if( velem == vend ) break;
760  }
761  else if( melem->index() < velem->index() ) {
762  ++melem;
763  if( melem == mend ) break;
764  }
765  else {
766  y[j] -= velem->value() * melem->value();
767  ++velem;
768  if( velem == vend ) break;
769  ++melem;
770  if( melem == mend ) break;
771  }
772  }
773  }
774  }
776  //**********************************************************************************************
777 
778  //**SMP subtraction assignment to dense vectors*************************************************
792  template< typename VT1 // Type of the left-hand side target vector
793  , typename VT2 // Type of the left-hand side vector operand
794  , typename MT1 > // Type of the right-hand side matrix operand
795  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
796  selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
797  {
798  smpSubAssign( y, x * A );
799  }
801  //**********************************************************************************************
802 
803  //**Subtraction assignment to sparse vectors****************************************************
804  // No special implementation for the subtraction assignment to sparse vectors.
805  //**********************************************************************************************
806 
807  //**Multiplication assignment to dense vectors**************************************************
820  template< typename VT1 > // Type of the target dense vector
821  friend inline void multAssign( DenseVector<VT1,true>& lhs, const TSVecTSMatMultExpr& rhs )
822  {
824 
828 
829  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
830 
831  const ResultType tmp( rhs );
832  smpMultAssign( ~lhs, tmp );
833  }
835  //**********************************************************************************************
836 
837  //**Multiplication assignment to sparse vectors*************************************************
838  // No special implementation for the multiplication assignment to sparse vectors.
839  //**********************************************************************************************
840 
841  //**Compile time checks*************************************************************************
848  //**********************************************************************************************
849 };
850 //*************************************************************************************************
851 
852 
853 
854 
855 //=================================================================================================
856 //
857 // GLOBAL BINARY ARITHMETIC OPERATORS
858 //
859 //=================================================================================================
860 
861 //*************************************************************************************************
892 template< typename T1 // Type of the left-hand side sparse vector
893  , typename T2 > // Type of the right-hand side sparse matrix
894 inline const typename DisableIf< IsMatMatMultExpr<T2>, TSVecTSMatMultExpr<T1,T2> >::Type
896 {
898 
899  if( (~vec).size() != (~mat).rows() )
900  throw std::invalid_argument( "Vector and matrix sizes do not match" );
901 
902  return TSVecTSMatMultExpr<T1,T2>( ~vec, ~mat );
903 }
904 //*************************************************************************************************
905 
906 
907 
908 
909 //=================================================================================================
910 //
911 // EXPRESSION TRAIT SPECIALIZATIONS
912 //
913 //=================================================================================================
914 
915 //*************************************************************************************************
917 template< typename VT, typename MT, bool AF >
918 struct SubvectorExprTrait< TSVecTSMatMultExpr<VT,MT>, AF >
919 {
920  public:
921  //**********************************************************************************************
922  typedef typename MultExprTrait< VT, typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
923  //**********************************************************************************************
924 };
926 //*************************************************************************************************
927 
928 } // namespace blaze
929 
930 #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
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
size_t size() const
Returns the current size/dimension of the vector.
Definition: TSVecTSMatMultExpr.h:245
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
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
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:249
Header file for the Computation base class.
TSVecTSMatMultExpr< VT, MT > This
Type of this TSVecTSMatMultExpr instance.
Definition: TSVecTSMatMultExpr.h:124
Header file for the RequiresEvaluation type trait.
MT::CompositeType MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecTSMatMultExpr.h:97
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: TSVecTSMatMultExpr.h:265
TSVecTSMatMultExpr(const VT &vec, const MT &mat)
Constructor for the TSVecTSMatMultExpr class.
Definition: TSVecTSMatMultExpr.h:155
LeftOperand vec_
Left-hand side sparse vector of the multiplication expression.
Definition: TSVecTSMatMultExpr.h:316
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.
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: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.
MCT RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TSVecTSMatMultExpr.h:141
Header file for the dense vector SMP implementation.
#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:2388
Expression object for sparse vector-sparse matrix multiplications.The TSVecTSMatMultExpr class repres...
Definition: Forward.h:146
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
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSVecTSMatMultExpr.h:255
Constraints on the storage order of matrix types.
MultTrait< VRT, MRT >::Type ResultType
Result type for expression template evaluations.
Definition: TSVecTSMatMultExpr.h:125
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.
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecTSMatMultExpr.h:135
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
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSVecTSMatMultExpr.h:129
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: TSVecTSMatMultExpr.h:126
MT::ResultType MRT
Result type of the right-hand side sparse matrix expression.
Definition: TSVecTSMatMultExpr.h:95
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
SelectType< evaluateVector, const VRT, VCT >::Type LT
Type for the assignment of the left-hand side sparse vector operand.
Definition: TSVecTSMatMultExpr.h:138
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
VT::CompositeType VCT
Composite type of the left-hand side sparse vector expression.
Definition: TSVecTSMatMultExpr.h:96
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
ResultType::ElementType ElementType
Resulting element type.
Definition: TSVecTSMatMultExpr.h:127
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
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
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TSVecTSMatMultExpr.h:299
Header file for the IsComputation type trait class.
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSVecTSMatMultExpr.h:317
VT::ResultType VRT
Result type of the left-hand side sparse vector expression.
Definition: TSVecTSMatMultExpr.h:94
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSVecTSMatMultExpr.h:128
Header file for the sparse vector SMP implementation.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSVecTSMatMultExpr.h:169
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
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: TSVecTSMatMultExpr.h:132
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2379
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: TSVecTSMatMultExpr.h:287
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
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
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: TSVecTSMatMultExpr.h:309
#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.
RightOperand rightOperand() const
Returns the right-hand side transpose sparse matrix operand.
Definition: TSVecTSMatMultExpr.h:275