All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SMatSVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATSVECMULTEXPR_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 SMATDVECMULTEXPR
79 //
80 //=================================================================================================
81 
82 //*************************************************************************************************
89 template< typename MT // Type of the left-hand side sparse matrix
90  , typename VT > // Type of the right-hand side sparse vector
91 class SMatSVecMultExpr : public SparseVector< SMatSVecMultExpr<MT,VT>, false >
92  , private MatVecMultExpr
93  , private Computation
94 {
95  private:
96  //**Type definitions****************************************************************************
97  typedef typename MT::ResultType MRT;
98  typedef typename VT::ResultType VRT;
99  typedef typename MT::CompositeType MCT;
100  typedef typename VT::CompositeType VCT;
101  //**********************************************************************************************
102 
103  //**********************************************************************************************
105  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
106  //**********************************************************************************************
107 
108  //**********************************************************************************************
110  enum { evaluateVector = IsComputation<VT>::value };
111  //**********************************************************************************************
112 
113  //**********************************************************************************************
115 
118  template< typename T1, typename T2, typename T3 >
119  struct UseSMPAssignKernel {
120  enum { value = evaluateMatrix || evaluateVector };
121  };
123  //**********************************************************************************************
124 
125  public:
126  //**Type definitions****************************************************************************
131  typedef const ElementType ReturnType;
132 
134  typedef const ResultType CompositeType;
135 
137  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
138 
140  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type RightOperand;
141 
143  typedef MCT LT;
144 
147  //**********************************************************************************************
148 
149  //**Compilation flags***************************************************************************
151  enum { smpAssignable = !evaluateMatrix && !evaluateVector };
152  //**********************************************************************************************
153 
154  //**Constructor*********************************************************************************
160  explicit inline SMatSVecMultExpr( const MT& mat, const VT& vec )
161  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
162  , vec_( vec ) // Right-hand side sparse vector of the multiplication expression
163  {
164  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
165  }
166  //**********************************************************************************************
167 
168  //**Subscript operator**************************************************************************
174  inline ReturnType operator[]( size_t index ) const {
175  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
176 
177  typedef typename RemoveReference<MCT>::Type::ConstIterator MatrixIterator;
178  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
179 
180  ElementType res = ElementType();
181 
182  // Early exit
183  if( vec_.size() == 0UL )
184  return res;
185 
186  // Fast computation in case both the left-hand side matrix operand and the right-hand
187  // side vector operand directly provide iterators
189  {
190  MCT A( mat_ ); // Evaluation of the left-hand side sparse matrix operand
191  VCT x( vec_ ); // Evaluation of the right-hand side sparse vector operand
192 
193  MatrixIterator melem( A.begin(index) );
194  const MatrixIterator mend( A.end(index) );
195  if( melem == mend ) {
196  return res;
197  }
198 
199  VectorIterator velem( x.begin() );
200  const VectorIterator vend( x.end() );
201  if( velem == vend ) {
202  return res;
203  }
204 
205  while( true ) {
206  if( melem->index() < velem->index() ) {
207  ++melem;
208  if( melem == mend ) break;
209  }
210  else if( velem->index() < melem->index() ) {
211  ++velem;
212  if( velem == vend ) break;
213  }
214  else {
215  res = melem->value() * velem->value();
216  ++melem;
217  ++velem;
218  break;
219  }
220  }
221 
222  if( melem != mend && velem != vend )
223  {
224  while( true ) {
225  if( melem->index() < velem->index() ) {
226  ++melem;
227  if( melem == mend ) break;
228  }
229  else if( velem->index() < melem->index() ) {
230  ++velem;
231  if( velem == vend ) break;
232  }
233  else {
234  res += melem->value() * velem->value();
235  ++melem;
236  if( melem == mend ) break;
237  ++velem;
238  if( velem == vend ) break;
239  }
240  }
241  }
242  }
243 
244  // Optimized computation in case the left-hand side matrix operand directly provides iterators
246  {
247  MCT A( mat_ ); // Evaluation of the left-hand side sparse matrix operand
248 
249  MatrixIterator melem( A.begin(index) );
250  const MatrixIterator mend( A.end(index) );
251 
252  if( melem == mend )
253  return res;
254 
255  res = melem->value() * vec_[melem->index()];
256  ++melem;
257  for( ; melem!=mend; ++melem ) {
258  res += melem->value() * vec_[melem->index()];
259  }
260  }
261 
262  // Optimized computation in case the right-hand side vector operand directly provides iterators
264  {
265  VCT x( vec_ ); // Evaluation of the right-hand side sparse vector operand
266 
267  VectorIterator velem( x.begin() );
268  const VectorIterator vend( x.end() );
269 
270  if( velem == vend )
271  return res;
272 
273  res = mat_(index,velem->index()) * velem->value();
274  ++velem;
275  for( ; velem!=vend; ++velem ) {
276  res += mat_(index,velem->index()) * velem->value();
277  }
278  }
279 
280  // Default computation in case both operands don't provide iterators
281  else {
282  res = mat_(index,0UL) * vec_[0UL];
283  for( size_t j=1UL; j<vec_.size(); ++j ) {
284  res += mat_(index,j) * vec_[j];
285  }
286  }
287 
288  return res;
289  }
290  //**********************************************************************************************
291 
292  //**Size function*******************************************************************************
297  inline size_t size() const {
298  return mat_.rows();
299  }
300  //**********************************************************************************************
301 
302  //**NonZeros function***************************************************************************
307  inline size_t nonZeros() const {
308  return mat_.rows();
309  }
310  //**********************************************************************************************
311 
312  //**Left operand access*************************************************************************
317  inline LeftOperand leftOperand() const {
318  return mat_;
319  }
320  //**********************************************************************************************
321 
322  //**Right operand access************************************************************************
327  inline RightOperand rightOperand() const {
328  return vec_;
329  }
330  //**********************************************************************************************
331 
332  //**********************************************************************************************
338  template< typename T >
339  inline bool canAlias( const T* alias ) const {
340  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
341  }
342  //**********************************************************************************************
343 
344  //**********************************************************************************************
350  template< typename T >
351  inline bool isAliased( const T* alias ) const {
352  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
353  }
354  //**********************************************************************************************
355 
356  //**********************************************************************************************
361  inline bool canSMPAssign() const {
362  return ( size() > SMP_SMATSVECMULT_THRESHOLD );
363  }
364  //**********************************************************************************************
365 
366  private:
367  //**Member variables****************************************************************************
370  //**********************************************************************************************
371 
372  //**Assignment to dense vectors*****************************************************************
384  template< typename VT1 > // Type of the target dense vector
385  friend inline void assign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
386  {
388 
389  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
390 
391  // Resetting the left-hand side target dense vector
392  reset( ~lhs );
393 
394  // Evaluation of the right-hand side sparse vector operand
395  RT x( rhs.vec_ );
396  if( x.nonZeros() == 0UL ) return;
397 
398  // Evaluation of the left-hand side sparse matrix operand
399  LT A( rhs.mat_ );
400 
401  // Checking the evaluated operators
402  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
403  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
404  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
405  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
406 
407  // Performing the sparse matrix-sparse vector multiplication
408  SMatSVecMultExpr::selectAssignKernel( ~lhs, A, x );
409  }
411  //**********************************************************************************************
412 
413  //**Serial assignment to dense vectors**********************************************************
427  template< typename VT1 // Type of the left-hand side target vector
428  , typename MT1 // Type of the left-hand side matrix operand
429  , typename VT2 > // Type of the right-hand side vector operand
430  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
431  selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
432  {
433  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
434  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
435 
436  const VectorIterator vend( x.end() );
437 
438  for( size_t i=0UL; i<y.size(); ++i )
439  {
440  const MatrixIterator mend ( A.end(i) );
441  MatrixIterator melem( A.begin(i) );
442 
443  if( melem == mend ) continue;
444 
445  VectorIterator velem( x.begin() );
446 
447  while( true ) {
448  if( melem->index() < velem->index() ) {
449  ++melem;
450  if( melem == mend ) break;
451  }
452  else if( velem->index() < melem->index() ) {
453  ++velem;
454  if( velem == vend ) break;
455  }
456  else {
457  y[i] = melem->value() * velem->value();
458  ++melem;
459  ++velem;
460  break;
461  }
462  }
463 
464  if( melem != mend && velem != vend )
465  {
466  while( true ) {
467  if( melem->index() < velem->index() ) {
468  ++melem;
469  if( melem == mend ) break;
470  }
471  else if( velem->index() < melem->index() ) {
472  ++velem;
473  if( velem == vend ) break;
474  }
475  else {
476  y[i] += melem->value() * velem->value();
477  ++melem;
478  if( melem == mend ) break;
479  ++velem;
480  if( velem == vend ) break;
481  }
482  }
483  }
484  }
485  }
487  //**********************************************************************************************
488 
489  //**SMP assignment to dense vectors*************************************************************
503  template< typename VT1 // Type of the left-hand side target vector
504  , typename MT1 // Type of the left-hand side matrix operand
505  , typename VT2 > // Type of the right-hand side vector operand
506  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
507  selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
508  {
509  smpAssign( y, A * x );
510  }
512  //**********************************************************************************************
513 
514  //**Assignment to sparse vectors****************************************************************
526  template< typename VT1 > // Type of the target sparse vector
527  friend inline void assign( SparseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
528  {
530 
531  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
532 
533  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
534  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
535 
536  RT x( rhs.vec_ ); // Evaluation of the right-hand side sparse vector operand
537  if( x.nonZeros() == 0UL ) return;
538 
539  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
540 
541  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
542  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
543  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
544  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
545 
546  ElementType accu;
547  const VectorIterator vend( x.end() );
548 
549  for( size_t i=0UL; i<(~lhs).size(); ++i )
550  {
551  const MatrixIterator mend ( A.end(i) );
552  MatrixIterator melem( A.begin(i) );
553 
554  if( melem == mend ) continue;
555 
556  VectorIterator velem( x.begin() );
557 
558  reset( accu );
559 
560  while( true ) {
561  if( melem->index() < velem->index() ) {
562  ++melem;
563  if( melem == mend ) break;
564  }
565  else if( velem->index() < melem->index() ) {
566  ++velem;
567  if( velem == vend ) break;
568  }
569  else {
570  accu = melem->value() * velem->value();
571  ++melem;
572  ++velem;
573  break;
574  }
575  }
576 
577  if( melem != mend && velem != vend )
578  {
579  while( true ) {
580  if( melem->index() < velem->index() ) {
581  ++melem;
582  if( melem == mend ) break;
583  }
584  else if( velem->index() < melem->index() ) {
585  ++velem;
586  if( velem == vend ) break;
587  }
588  else {
589  accu += melem->value() * velem->value();
590  ++melem;
591  if( melem == mend ) break;
592  ++velem;
593  if( velem == vend ) break;
594  }
595  }
596  }
597 
598  if( !isDefault( accu ) )
599  (~lhs).insert( i, accu );
600  }
601  }
603  //**********************************************************************************************
604 
605  //**Addition assignment to dense vectors********************************************************
617  template< typename VT1 > // Type of the target dense vector
618  friend inline void addAssign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
619  {
621 
622  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
623 
624  // Evaluation of the right-hand side sparse vector operand
625  RT x( rhs.vec_ );
626  if( x.nonZeros() == 0UL ) return;
627 
628  // Evaluation of the left-hand side sparse matrix operand
629  LT A( rhs.mat_ );
630 
631  // Checking the evaluated operators
632  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
633  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
634  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
635  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
636 
637  // Performing the sparse matrix-sparse vector multiplication
638  SMatSVecMultExpr::selectAddAssignKernel( ~lhs, A, x );
639  }
641  //**********************************************************************************************
642 
643  //**Serial addition assignment to dense vectors*************************************************
657  template< typename VT1 // Type of the left-hand side target vector
658  , typename MT1 // Type of the left-hand side matrix operand
659  , typename VT2 > // Type of the right-hand side vector operand
660  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
661  selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
662  {
663  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
664  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
665 
666  const VectorIterator vend( x.end() );
667 
668  for( size_t i=0UL; i<y.size(); ++i )
669  {
670  const MatrixIterator mend ( A.end(i) );
671  MatrixIterator melem( A.begin(i) );
672 
673  if( melem == mend ) continue;
674 
675  VectorIterator velem( x.begin() );
676 
677  while( true ) {
678  if( melem->index() < velem->index() ) {
679  ++melem;
680  if( melem == mend ) break;
681  }
682  else if( velem->index() < melem->index() ) {
683  ++velem;
684  if( velem == vend ) break;
685  }
686  else {
687  y[i] += melem->value() * velem->value();
688  ++melem;
689  if( melem == mend ) break;
690  ++velem;
691  if( velem == vend ) break;
692  }
693  }
694  }
695  }
697  //**********************************************************************************************
698 
699  //**SMP addition assignment to dense vectors****************************************************
713  template< typename VT1 // Type of the left-hand side target vector
714  , typename MT1 // Type of the left-hand side matrix operand
715  , typename VT2 > // Type of the right-hand side vector operand
716  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
717  selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
718  {
719  smpAddAssign( y, A * x );
720  }
722  //**********************************************************************************************
723 
724  //**Addition assignment to sparse vectors*******************************************************
725  // No special implementation for the addition assignment to sparse vectors.
726  //**********************************************************************************************
727 
728  //**Subtraction assignment to dense vectors*****************************************************
740  template< typename VT1 > // Type of the target dense vector
741  friend inline void subAssign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
742  {
744 
745  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
746 
747  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
748  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
749 
750  // Evaluation of the right-hand side sparse vector operand
751  RT x( rhs.vec_ );
752  if( x.nonZeros() == 0UL ) return;
753 
754  // Evaluation of the left-hand side sparse matrix operand
755  LT A( rhs.mat_ );
756 
757  // Checking the evaluated operators
758  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
759  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
760  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
761  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
762 
763  // Performing the sparse matrix-sparse vector multiplication
764  SMatSVecMultExpr::selectSubAssignKernel( ~lhs, A, x );
765  }
767  //**********************************************************************************************
768 
769  //**Serial subtraction assignment to dense vectors**********************************************
783  template< typename VT1 // Type of the left-hand side target vector
784  , typename MT1 // Type of the left-hand side matrix operand
785  , typename VT2 > // Type of the right-hand side vector operand
786  static inline typename DisableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
787  selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
788  {
789  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
790  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
791 
792  const VectorIterator vend( x.end() );
793 
794  for( size_t i=0UL; i<y.size(); ++i )
795  {
796  const MatrixIterator mend ( A.end(i) );
797  MatrixIterator melem( A.begin(i) );
798 
799  if( melem == mend ) continue;
800 
801  VectorIterator velem( x.begin() );
802 
803  while( true ) {
804  if( melem->index() < velem->index() ) {
805  ++melem;
806  if( melem == mend ) break;
807  }
808  else if( velem->index() < melem->index() ) {
809  ++velem;
810  if( velem == vend ) break;
811  }
812  else {
813  y[i] -= melem->value() * velem->value();
814  ++melem;
815  if( melem == mend ) break;
816  ++velem;
817  if( velem == vend ) break;
818  }
819  }
820  }
821  }
823  //**********************************************************************************************
824 
825  //**SMP subtraction assignment to dense vectors*************************************************
839  template< typename VT1 // Type of the left-hand side target vector
840  , typename MT1 // Type of the left-hand side matrix operand
841  , typename VT2 > // Type of the right-hand side vector operand
842  static inline typename EnableIf< UseSMPAssignKernel<VT1,MT1,VT2> >::Type
843  selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
844  {
845  smpSubAssign( y, A * x );
846  }
848  //**********************************************************************************************
849 
850  //**Subtraction assignment to sparse vectors****************************************************
851  // No special implementation for the subtraction assignment to sparse vectors.
852  //**********************************************************************************************
853 
854  //**Multiplication assignment to dense vectors**************************************************
866  template< typename VT1 > // Type of the target dense vector
867  friend inline void multAssign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
868  {
870 
874 
875  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
876 
877  const ResultType tmp( rhs );
878  smpMultAssign( ~lhs, tmp );
879  }
881  //**********************************************************************************************
882 
883  //**Multiplication assignment to sparse vectors*************************************************
884  // No special implementation for the multiplication assignment to sparse vectors.
885  //**********************************************************************************************
886 
887  //**Compile time checks*************************************************************************
894  //**********************************************************************************************
895 };
896 //*************************************************************************************************
897 
898 
899 
900 
901 //=================================================================================================
902 //
903 // GLOBAL BINARY ARITHMETIC OPERATORS
904 //
905 //=================================================================================================
906 
907 //*************************************************************************************************
938 template< typename T1 // Type of the left-hand side sparse matrix
939  , typename T2 > // Type of the right-hand side sparse vector
940 inline const typename DisableIf< IsMatMatMultExpr<T1>, SMatSVecMultExpr<T1,T2> >::Type
942 {
944 
945  if( (~mat).columns() != (~vec).size() )
946  throw std::invalid_argument( "Matrix and vector sizes do not match" );
947 
948  return SMatSVecMultExpr<T1,T2>( ~mat, ~vec );
949 }
950 //*************************************************************************************************
951 
952 
953 
954 
955 //=================================================================================================
956 //
957 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
958 //
959 //=================================================================================================
960 
961 //*************************************************************************************************
974 template< typename T1 // Type of the left-hand side sparse matrix
975  , bool SO // Storage order of the left-hand side sparse matrix
976  , typename T2 > // Type of the right-hand side sparse vector
977 inline const typename EnableIf< IsMatMatMultExpr<T1>, MultExprTrait<T1,T2> >::Type::Type
979 {
981 
982  return (~mat).leftOperand() * ( (~mat).rightOperand() * vec );
983 }
984 //*************************************************************************************************
985 
986 
987 
988 
989 //=================================================================================================
990 //
991 // EXPRESSION TRAIT SPECIALIZATIONS
992 //
993 //=================================================================================================
994 
995 //*************************************************************************************************
997 template< typename MT, typename VT, bool AF >
998 struct SubvectorExprTrait< SMatSVecMultExpr<MT,VT>, AF >
999 {
1000  public:
1001  //**********************************************************************************************
1002  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type, VT >::Type Type;
1003  //**********************************************************************************************
1004 };
1006 //*************************************************************************************************
1007 
1008 } // namespace blaze
1009 
1010 #endif
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: SMatSVecMultExpr.h:369
const size_t SMP_SMATSVECMULT_THRESHOLD
SMP row-major sparse matrix/sparse vector multiplication threshold.This threshold represents the syst...
Definition: Thresholds.h:295
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
SMatSVecMultExpr(const MT &mat, const VT &vec)
Constructor for the SMatSVecMultExpr class.
Definition: SMatSVecMultExpr.h:160
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
Header file for the SparseVector base class.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SMatSVecMultExpr.h:174
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatSVecMultExpr.h:339
MCT LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: SMatSVecMultExpr.h:143
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
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: TransposeFlag.h:159
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
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: SMatSVecMultExpr.h:140
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatSVecMultExpr.h:134
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatSVecMultExpr.h:129
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
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.
size_t size() const
Returns the current size/dimension of the vector.
Definition: SMatSVecMultExpr.h:297
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatSVecMultExpr.h:131
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.
Expression object for sparse matrix-sparse vector multiplications.The SMatSVecMultExpr class represen...
Definition: Forward.h:96
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
Header file for the IsMatMatMultExpr type trait class.
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatSVecMultExpr.h:137
MultTrait< MRT, VRT >::Type ResultType
Result type for expression template evaluations.
Definition: SMatSVecMultExpr.h:128
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
MT::CompositeType MCT
Composite type of the left-hand side sparse matrix expression.
Definition: SMatSVecMultExpr.h:99
VT::CompositeType VCT
Composite type of the right-hand side sparse vector expression.
Definition: SMatSVecMultExpr.h:100
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.
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.
ResultType::ElementType ElementType
Resulting element type.
Definition: SMatSVecMultExpr.h:130
Header file for the EnableIf class template.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatSVecMultExpr.h:351
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
SMatSVecMultExpr< MT, VT > This
Type of this SMatSVecMultExpr instance.
Definition: SMatSVecMultExpr.h:127
#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
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
RightOperand rightOperand() const
Returns the right-hand side sparse vector operand.
Definition: SMatSVecMultExpr.h:327
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
Header file for the isDefault shim.
MT::ResultType MRT
Result type of the left-hand side sparse matrix expression.
Definition: SMatSVecMultExpr.h:97
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
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: SMatSVecMultExpr.h:307
Header file for the IsComputation type trait class.
Header file for the sparse vector SMP implementation.
VT::ResultType VRT
Result type of the right-hand side sparse vector expression.
Definition: SMatSVecMultExpr.h:98
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
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:154
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SMatSVecMultExpr.h:361
Header file for basic type definitions.
Header file for the SubvectorExprTrait class template.
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatSVecMultExpr.h:368
Header file for the MatVecMultExpr base class.
SelectType< evaluateVector, const VRT, VCT >::Type RT
Type for the assignment of the right-hand side sparse vector operand.
Definition: SMatSVecMultExpr.h:146
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
Header file for the IsExpression type trait class.
LeftOperand leftOperand() const
Returns the left-hand side sparse matrix operand.
Definition: SMatSVecMultExpr.h:317
Header file for the FunctionTrace class.