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>
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 TSVECSMATMULTEXPR
78 //
79 //=================================================================================================
80 
81 //*************************************************************************************************
88 template< typename VT // Type of the left-hand side sparse vector
89  , typename MT > // Type of the right-hand side sparse matrix
90 class TSVecSMatMultExpr : public SparseVector< TSVecSMatMultExpr<VT,MT>, true >
91  , private TVecMatMultExpr
92  , private Computation
93 {
94  private:
95  //**Type definitions****************************************************************************
96  typedef typename VT::ResultType VRT;
97  typedef typename MT::ResultType MRT;
98  typedef typename VT::CompositeType VCT;
99  typedef typename MT::CompositeType MCT;
100  //**********************************************************************************************
101 
102  //**********************************************************************************************
104  enum { evaluateVector = IsComputation<VT>::value };
105  //**********************************************************************************************
106 
107  //**********************************************************************************************
109  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
110  //**********************************************************************************************
111 
112  //**********************************************************************************************
114 
118  template< typename T1 >
119  struct UseSMPAssign {
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 
145  //**********************************************************************************************
146 
147  //**Compilation flags***************************************************************************
149  enum { smpAssignable = !evaluateVector && VT::smpAssignable &&
150  !evaluateMatrix && MT::smpAssignable };
151  //**********************************************************************************************
152 
153  //**Constructor*********************************************************************************
159  explicit inline TSVecSMatMultExpr( const VT& vec, const MT& mat )
160  : vec_( vec ) // Left-hand side sparse vector of the multiplication expression
161  , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
162  {
163  BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
164  }
165  //**********************************************************************************************
166 
167  //**Subscript operator**************************************************************************
173  inline ReturnType operator[]( size_t index ) const {
174  BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
175 
176  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
177 
178  VCT x( vec_ ); // Evaluation of the left-hand side sparse vector operand
179  MCT A( mat_ ); // Evaluation of the right-hand side sparse matrix operand
180 
181  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size() , "Invalid vector size" );
182  BLAZE_INTERNAL_ASSERT( A.rows() == mat_.rows() , "Invalid number of rows" );
183  BLAZE_INTERNAL_ASSERT( A.columns() == mat_.columns(), "Invalid number of columns" );
184 
185  const VectorIterator vend( x.end() );
186  VectorIterator velem( x.begin() );
187  ElementType res;
188 
189  if( velem != vend ) {
190  res = velem->value() * A(velem->index(),index);
191  ++velem;
192  for( ; velem!=vend; ++velem ) {
193  res += velem->value() * A(velem->index(),index);
194  }
195  }
196  else {
197  reset( res );
198  }
199 
200  return res;
201  }
202  //**********************************************************************************************
203 
204  //**Size function*******************************************************************************
209  inline size_t size() const {
210  return mat_.columns();
211  }
212  //**********************************************************************************************
213 
214  //**NonZeros function***************************************************************************
219  inline size_t nonZeros() const {
220  return mat_.columns();
221  }
222  //**********************************************************************************************
223 
224  //**Left operand access*************************************************************************
229  inline LeftOperand leftOperand() const {
230  return vec_;
231  }
232  //**********************************************************************************************
233 
234  //**Right operand access************************************************************************
239  inline RightOperand rightOperand() const {
240  return mat_;
241  }
242  //**********************************************************************************************
243 
244  //**********************************************************************************************
250  template< typename T >
251  inline bool canAlias( const T* alias ) const {
252  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
253  }
254  //**********************************************************************************************
255 
256  //**********************************************************************************************
262  template< typename T >
263  inline bool isAliased( const T* alias ) const {
264  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
265  }
266  //**********************************************************************************************
267 
268  //**********************************************************************************************
273  inline bool canSMPAssign() const {
274  return ( size() > SMP_TSVECSMATMULT_THRESHOLD );
275  }
276  //**********************************************************************************************
277 
278  private:
279  //**Member variables****************************************************************************
282  //**********************************************************************************************
283 
284  //**Assignment to dense vectors*****************************************************************
297  template< typename VT1 > // Type of the target dense vector
298  friend inline void assign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
299  {
301 
302  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
303 
304  // Resetting the left-hand side target dense vector
305  reset( ~lhs );
306 
307  // Evaluation of the left-hand side sparse vector operand
308  LT x( serial( rhs.vec_ ) );
309  if( x.nonZeros() == 0UL ) return;
310 
311  // Evaluation of the right-hand side sparse matrix operand
312  RT A( serial( rhs.mat_ ) );
313 
314  // Checking the evaluated operands
315  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
316  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
317  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
318  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
319 
320  // Performing the sparse vector-sparse matrix multiplication
321  TSVecSMatMultExpr::selectAssignKernel( ~lhs, x, A );
322  }
324  //**********************************************************************************************
325 
326  //**Default assignment to dense vectors*********************************************************
340  template< typename VT1 // Type of the left-hand side target vector
341  , typename VT2 // Type of the left-hand side vector operand
342  , typename MT1 > // Type of the right-hand side matrix operand
343  static inline void 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  //**Assignment to sparse vectors****************************************************************
380  template< typename VT1 > // Type of the target sparse vector
381  friend inline void assign( SparseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
382  {
384 
385  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
386 
387  typedef typename RemoveReference<LT>::Type::ConstIterator VectorIterator;
388  typedef typename RemoveReference<RT>::Type::ConstIterator MatrixIterator;
389 
390  // Evaluation of the left-hand side sparse vector operand
391  LT x( serial( rhs.vec_ ) );
392  if( x.nonZeros() == 0UL ) return;
393 
394  // Evaluation of the right-hand side sparse matrix operand
395  RT A( serial( rhs.mat_ ) );
396 
397  // Checking the evaluated operands
398  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
399  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
400  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
401  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
402 
403  // Performing the sparse vector-sparse matrix multiplication
404  const VectorIterator vend( x.end() );
405  VectorIterator velem( x.begin() );
406 
407  for( ; velem!=vend; ++velem )
408  {
409  const MatrixIterator mend( A.end( velem->index() ) );
410  MatrixIterator melem( A.begin( velem->index() ) );
411 
412  for( ; melem!=mend; ++melem )
413  {
414  typename VT1::Iterator pos( (~lhs).find( melem->index() ) );
415  if( pos != (~lhs).end() )
416  pos->value() += velem->value() * melem->value();
417  else
418  (~lhs).insert( melem->index(), velem->value() * melem->value() );
419  }
420  }
421  }
423  //**********************************************************************************************
424 
425  //**Addition assignment to dense vectors********************************************************
438  template< typename VT1 > // Type of the target dense vector
439  friend inline void addAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
440  {
442 
443  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
444 
445  // Evaluation of the left-hand side sparse vector operand
446  LT x( serial( rhs.vec_ ) );
447  if( x.nonZeros() == 0UL ) return;
448 
449  // Evaluation of the right-hand side sparse matrix operand
450  RT A( serial( rhs.mat_ ) );
451 
452  // Checking the evaluated operands
453  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
454  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
455  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
456  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
457 
458  // Performing the sparse vector-sparse matrix multiplication
459  TSVecSMatMultExpr::selectAddAssignKernel( ~lhs, x, A );
460  }
462  //**********************************************************************************************
463 
464  //**Default addition assignment to dense vectors************************************************
478  template< typename VT1 // Type of the left-hand side target vector
479  , typename VT2 // Type of the left-hand side vector operand
480  , typename MT1 > // Type of the right-hand side matrix operand
481  static inline void selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
482  {
483  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
484  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
485 
486  const VectorIterator vend( x.end() );
487  VectorIterator velem( x.begin() );
488 
489  for( ; velem!=vend; ++velem )
490  {
491  const MatrixIterator mend( A.end( velem->index() ) );
492  MatrixIterator melem( A.begin( velem->index() ) );
493 
494  for( ; melem!=mend; ++melem ) {
495  y[melem->index()] += velem->value() * melem->value();
496  }
497  }
498  }
500  //**********************************************************************************************
501 
502  //**Addition assignment to sparse vectors*******************************************************
503  // No special implementation for the addition assignment to sparse vectors.
504  //**********************************************************************************************
505 
506  //**Subtraction assignment to dense vectors*****************************************************
519  template< typename VT1 > // Type of the target dense vector
520  friend inline void subAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
521  {
523 
524  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
525 
526  // Evaluation of the left-hand side sparse vector operand
527  LT x( serial( rhs.vec_ ) );
528  if( x.nonZeros() == 0UL ) return;
529 
530  // Evaluation of the right-hand side sparse matrix operand
531  RT A( serial( rhs.mat_ ) );
532 
533  // Checking the evaluated operands
534  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
535  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
536  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
537  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
538 
539  // Performing the sparse vector-sparse matrix multiplication
540  TSVecSMatMultExpr::selectSubAssignKernel( ~lhs, x, A );
541  }
543  //**********************************************************************************************
544 
545  //**Default subtraction assignment to dense vectors*********************************************
559  template< typename VT1 // Type of the left-hand side target vector
560  , typename VT2 // Type of the left-hand side vector operand
561  , typename MT1 > // Type of the right-hand side matrix operand
562  static inline void selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
563  {
564  typedef typename RemoveReference<VT2>::Type::ConstIterator VectorIterator;
565  typedef typename RemoveReference<MT1>::Type::ConstIterator MatrixIterator;
566 
567  const VectorIterator vend( x.end() );
568  VectorIterator velem( x.begin() );
569 
570  for( ; velem!=vend; ++velem )
571  {
572  const MatrixIterator mend( A.end( velem->index() ) );
573  MatrixIterator melem( A.begin( velem->index() ) );
574 
575  for( ; melem!=mend; ++melem ) {
576  y[melem->index()] -= velem->value() * melem->value();
577  }
578  }
579  }
581  //**********************************************************************************************
582 
583  //**Subtraction assignment to sparse vectors****************************************************
584  // No special implementation for the subtraction assignment to sparse vectors.
585  //**********************************************************************************************
586 
587  //**Multiplication assignment to dense vectors**************************************************
600  template< typename VT1 > // Type of the target dense vector
601  friend inline void multAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
602  {
604 
608 
609  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
610 
611  const ResultType tmp( serial( rhs ) );
612  multAssign( ~lhs, tmp );
613  }
615  //**********************************************************************************************
616 
617  //**Multiplication assignment to sparse vectors*************************************************
618  // No special implementation for the multiplication assignment to sparse vectors.
619  //**********************************************************************************************
620 
621  //**SMP assignment to dense vectors*************************************************************
636  template< typename VT1 > // Type of the target dense vector
637  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
638  smpAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
639  {
641 
642  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
643 
644  // Resetting the left-hand side target dense vector
645  reset( ~lhs );
646 
647  // Evaluation of the left-hand side sparse vector operand
648  LT x( rhs.vec_ );
649  if( x.nonZeros() == 0UL ) return;
650 
651  // Evaluation of the right-hand side sparse matrix operand
652  RT A( rhs.mat_ );
653 
654  // Checking the evaluated operands
655  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
656  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
657  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
658  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
659 
660  // Performing the sparse vector-sparse matrix multiplication
661  smpAssign( ~lhs, x * A );
662  }
664  //**********************************************************************************************
665 
666  //**SMP assignment to sparse vectors************************************************************
667  // No special implementation for the SMP assignment to sparse vectors.
668  //**********************************************************************************************
669 
670  //**SMP addition assignment to dense vectors****************************************************
685  template< typename VT1 > // Type of the target dense vector
686  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
687  smpAddAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
688  {
690 
691  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
692 
693  // Evaluation of the left-hand side sparse vector operand
694  LT x( rhs.vec_ );
695  if( x.nonZeros() == 0UL ) return;
696 
697  // Evaluation of the right-hand side sparse matrix operand
698  RT A( rhs.mat_ );
699 
700  // Checking the evaluated operands
701  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
702  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
703  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
704  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
705 
706  // Performing the sparse vector-sparse matrix multiplication
707  smpAddAssign( ~lhs, x * A );
708  }
710  //**********************************************************************************************
711 
712  //**SMP addition assignment to sparse vectors***************************************************
713  // No special implementation for the SMP addition assignment to sparse vectors.
714  //**********************************************************************************************
715 
716  //**SMP subtraction assignment to dense vectors*************************************************
731  template< typename VT1 > // Type of the target dense vector
732  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
733  smpSubAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
734  {
736 
737  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
738 
739  // Evaluation of the left-hand side sparse vector operand
740  LT x( rhs.vec_ );
741  if( x.nonZeros() == 0UL ) return;
742 
743  // Evaluation of the right-hand side sparse matrix operand
744  RT A( rhs.mat_ );
745 
746  // Checking the evaluated operands
747  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
748  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
749  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
750  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
751 
752  // Performing the sparse vector-sparse matrix multiplication
753  smpSubAssign( ~lhs, x * A );
754  }
756  //**********************************************************************************************
757 
758  //**SMP subtraction assignment to sparse vectors************************************************
759  // No special implementation for the SMP subtraction assignment to sparse vectors.
760  //**********************************************************************************************
761 
762  //**SMP multiplication assignment to dense vectors**********************************************
777  template< typename VT1 > // Type of the target dense vector
778  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
779  smpMultAssign( DenseVector<VT1,true>& lhs, const TSVecSMatMultExpr& rhs )
780  {
782 
786 
787  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
788 
789  const ResultType tmp( rhs );
790  smpMultAssign( ~lhs, tmp );
791  }
793  //**********************************************************************************************
794 
795  //**SMP multiplication assignment to sparse vectors*********************************************
796  // No special implementation for the SMP multiplication assignment to sparse vectors.
797  //**********************************************************************************************
798 
799  //**Compile time checks*************************************************************************
806  //**********************************************************************************************
807 };
808 //*************************************************************************************************
809 
810 
811 
812 
813 //=================================================================================================
814 //
815 // GLOBAL BINARY ARITHMETIC OPERATORS
816 //
817 //=================================================================================================
818 
819 //*************************************************************************************************
850 template< typename T1 // Type of the left-hand side sparse vector
851  , typename T2 > // Type of the right-hand side sparse matrix
852 inline const typename DisableIf< IsMatMatMultExpr<T2>, TSVecSMatMultExpr<T1,T2> >::Type
854 {
856 
857  if( (~vec).size() != (~mat).rows() )
858  throw std::invalid_argument( "Vector and matrix sizes do not match" );
859 
860  return TSVecSMatMultExpr<T1,T2>( ~vec, ~mat );
861 }
862 //*************************************************************************************************
863 
864 
865 
866 
867 //=================================================================================================
868 //
869 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
870 //
871 //=================================================================================================
872 
873 //*************************************************************************************************
886 template< typename T1 // Type of the left-hand side sparse vector
887  , typename T2 // Type of the right-hand side sparse matrix
888  , bool SO > // Storage order of the right-hand side sparse matrix
889 inline const typename EnableIf< IsMatMatMultExpr<T2>, MultExprTrait<T1,T2> >::Type::Type
891 {
893 
894  return ( vec * (~mat).leftOperand() ) * (~mat).rightOperand();
895 }
896 //*************************************************************************************************
897 
898 
899 
900 
901 //=================================================================================================
902 //
903 // EXPRESSION TRAIT SPECIALIZATIONS
904 //
905 //=================================================================================================
906 
907 //*************************************************************************************************
909 template< typename VT, typename MT, bool AF >
910 struct SubvectorExprTrait< TSVecSMatMultExpr<VT,MT>, AF >
911 {
912  public:
913  //**********************************************************************************************
914  typedef typename MultExprTrait< VT, typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
915  //**********************************************************************************************
916 };
918 //*************************************************************************************************
919 
920 } // namespace blaze
921 
922 #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:4599
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:4329
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:152
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4642
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: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
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
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:251
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.
VT::CompositeType VCT
Composite type of the left-hand side sparse vector expression.
Definition: TSVecSMatMultExpr.h:98
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:107
Constraint on the data type.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSVecSMatMultExpr.h:173
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: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.
RightOperand rightOperand() const
Returns the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:239
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
Expression object for sparse vector-sparse matrix multiplications.The TSVecSMatMultExpr class represe...
Definition: Forward.h:148
TSVecSMatMultExpr< VT, MT > This
Type of this TSVecSMatMultExpr instance.
Definition: TSVecSMatMultExpr.h:127
Header file for the IsMatMatMultExpr type trait class.
SelectType< evaluateMatrix, const MRT, MCT >::Type RT
Type for the assignment of the right-hand side sparse matrix operand.
Definition: TSVecSMatMultExpr.h:144
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
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
LeftOperand vec_
Left-hand side sparse vector of the multiplication expression.
Definition: TSVecSMatMultExpr.h:280
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:361
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:96
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSVecSMatMultExpr.h:219
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
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TSVecSMatMultExpr.h:281
#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:273
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
size_t size() const
Returns the current size/dimension of the vector.
Definition: TSVecSMatMultExpr.h:209
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
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
Header file for the isDefault shim.
Header file for the TVecMatMultExpr base class.
TSVecSMatMultExpr(const VT &vec, const MT &mat)
Constructor for the TSVecSMatMultExpr class.
Definition: TSVecSMatMultExpr.h:159
Header file for the RemoveReference type trait.
const size_t SMP_TSVECSMATMULT_THRESHOLD
SMP sparse vector/row-major sparse matrix multiplication threshold.This threshold specifies when a sp...
Definition: Thresholds.h:644
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:229
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
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:251
MT::CompositeType MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:99
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TSVecSMatMultExpr.h:263
Header file for the IsResizable type trait.
MT::ResultType MRT
Result type of the right-hand side sparse matrix expression.
Definition: TSVecSMatMultExpr.h:97
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:154
#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.