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>
61 #include <blaze/util/Assert.h>
63 #include <blaze/util/DisableIf.h>
64 #include <blaze/util/EnableIf.h>
66 #include <blaze/util/SelectType.h>
67 #include <blaze/util/Types.h>
69 
70 
71 namespace blaze {
72 
73 //=================================================================================================
74 //
75 // CLASS SMATDVECMULTEXPR
76 //
77 //=================================================================================================
78 
79 //*************************************************************************************************
86 template< typename MT // Type of the left-hand side sparse matrix
87  , typename VT > // Type of the right-hand side sparse vector
88 class SMatSVecMultExpr : public SparseVector< SMatSVecMultExpr<MT,VT>, false >
89  , private MatVecMultExpr
90  , private Computation
91 {
92  private:
93  //**Type definitions****************************************************************************
94  typedef typename MT::ResultType MRT;
95  typedef typename VT::ResultType VRT;
96  typedef typename MT::CompositeType MCT;
97  typedef typename VT::CompositeType VCT;
98  //**********************************************************************************************
99 
100  public:
101  //**Type definitions****************************************************************************
106  typedef const ElementType ReturnType;
107 
109  typedef const ResultType CompositeType;
110 
112  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
113 
115  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type RightOperand;
116 
118  typedef MCT LT;
119 
121  typedef typename SelectType< IsComputation<VT>::value, const VRT, VCT >::Type RT;
122  //**********************************************************************************************
123 
124  //**Constructor*********************************************************************************
130  explicit inline SMatSVecMultExpr( const MT& mat, const VT& vec )
131  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
132  , vec_( vec ) // Right-hand side sparse vector of the multiplication expression
133  {
134  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
135  }
136  //**********************************************************************************************
137 
138  //**Subscript operator**************************************************************************
144  inline ReturnType operator[]( size_t index ) const {
145  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
146 
147  typedef typename RemoveReference<MCT>::Type::ConstIterator MatrixIterator;
148  typedef typename RemoveReference<VCT>::Type::ConstIterator VectorIterator;
149 
150  ElementType res = ElementType();
151 
152  // Early exit
153  if( vec_.size() == 0UL )
154  return res;
155 
156  // Fast computation in case both the left-hand side matrix operand and the right-hand
157  // side vector operand directly provide iterators
159  {
160  MCT A( mat_ ); // Evaluation of the left-hand side sparse matrix operand
161  VCT x( vec_ ); // Evaluation of the right-hand side sparse vector operand
162 
163  MatrixIterator melem( A.begin(index) );
164  const MatrixIterator mend( A.end(index) );
165  if( melem == mend ) {
166  return res;
167  }
168 
169  VectorIterator velem( x.begin() );
170  const VectorIterator vend( x.end() );
171  if( velem == vend ) {
172  return res;
173  }
174 
175  while( true ) {
176  if( melem->index() < velem->index() ) {
177  ++melem;
178  if( melem == mend ) break;
179  }
180  else if( velem->index() < melem->index() ) {
181  ++velem;
182  if( velem == vend ) break;
183  }
184  else {
185  res = melem->value() * velem->value();
186  ++melem;
187  ++velem;
188  break;
189  }
190  }
191 
192  if( melem != mend && velem != vend )
193  {
194  while( true ) {
195  if( melem->index() < velem->index() ) {
196  ++melem;
197  if( melem == mend ) break;
198  }
199  else if( velem->index() < melem->index() ) {
200  ++velem;
201  if( velem == vend ) break;
202  }
203  else {
204  res += melem->value() * velem->value();
205  ++melem;
206  if( melem == mend ) break;
207  ++velem;
208  if( velem == vend ) break;
209  }
210  }
211  }
212  }
213 
214  // Optimized computation in case the left-hand side matrix operand directly provides iterators
216  {
217  MCT A( mat_ ); // Evaluation of the left-hand side sparse matrix operand
218 
219  MatrixIterator melem( A.begin(index) );
220  const MatrixIterator mend( A.end(index) );
221 
222  if( melem == mend )
223  return res;
224 
225  res = melem->value() * vec_[melem->index()];
226  ++melem;
227  for( ; melem!=mend; ++melem ) {
228  res += melem->value() * vec_[melem->index()];
229  }
230  }
231 
232  // Optimized computation in case the right-hand side vector operand directly provides iterators
234  {
235  VCT x( vec_ ); // Evaluation of the right-hand side sparse vector operand
236 
237  VectorIterator velem( x.begin() );
238  const VectorIterator vend( x.end() );
239 
240  if( velem == vend )
241  return res;
242 
243  res = mat_(index,velem->index()) * velem->value();
244  ++velem;
245  for( ; velem!=vend; ++velem ) {
246  res += mat_(index,velem->index()) * velem->value();
247  }
248  }
249 
250  // Default computation in case both operands don't provide iterators
251  else {
252  res = mat_(index,0UL) * vec_[0UL];
253  for( size_t j=1UL; j<vec_.size(); ++j ) {
254  res += mat_(index,j) * vec_[j];
255  }
256  }
257 
258  return res;
259  }
260  //**********************************************************************************************
261 
262  //**Size function*******************************************************************************
267  inline size_t size() const {
268  return mat_.rows();
269  }
270  //**********************************************************************************************
271 
272  //**NonZeros function***************************************************************************
277  inline size_t nonZeros() const {
278  return mat_.rows();
279  }
280  //**********************************************************************************************
281 
282  //**Left operand access*************************************************************************
287  inline LeftOperand leftOperand() const {
288  return mat_;
289  }
290  //**********************************************************************************************
291 
292  //**Right operand access************************************************************************
297  inline RightOperand rightOperand() const {
298  return vec_;
299  }
300  //**********************************************************************************************
301 
302  //**********************************************************************************************
308  template< typename T >
309  inline bool canAlias( const T* alias ) const {
310  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
311  }
312  //**********************************************************************************************
313 
314  //**********************************************************************************************
320  template< typename T >
321  inline bool isAliased( const T* alias ) const {
322  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
323  }
324  //**********************************************************************************************
325 
326  private:
327  //**Member variables****************************************************************************
330  //**********************************************************************************************
331 
332  //**Assignment to dense vectors*****************************************************************
344  template< typename VT1 > // Type of the target dense vector
345  friend inline void assign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
346  {
348 
349  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
350 
351  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
352  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
353 
354  // Resetting the left-hand side target dense vector
355  reset( ~lhs );
356 
357  // Evaluation of the right-hand side sparse vector operand
358  RT x( rhs.vec_ );
359  if( x.nonZeros() == 0UL ) return;
360 
361  // Evaluation of the left-hand side sparse matrix operand
362  LT A( rhs.mat_ );
363 
364  // Checking the evaluated operators
365  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
366  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
367  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
368  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
369 
370  // Performing the sparse matrix-sparse vector multiplication
371  const VectorIterator vend( x.end() );
372 
373  for( size_t i=0UL; i<(~lhs).size(); ++i )
374  {
375  const MatrixIterator mend ( A.end(i) );
376  MatrixIterator melem( A.begin(i) );
377 
378  if( melem == mend ) continue;
379 
380  VectorIterator velem( x.begin() );
381 
382  while( true ) {
383  if( melem->index() < velem->index() ) {
384  ++melem;
385  if( melem == mend ) break;
386  }
387  else if( velem->index() < melem->index() ) {
388  ++velem;
389  if( velem == vend ) break;
390  }
391  else {
392  (~lhs)[i] = melem->value() * velem->value();
393  ++melem;
394  ++velem;
395  break;
396  }
397  }
398 
399  if( melem != mend && velem != vend )
400  {
401  while( true ) {
402  if( melem->index() < velem->index() ) {
403  ++melem;
404  if( melem == mend ) break;
405  }
406  else if( velem->index() < melem->index() ) {
407  ++velem;
408  if( velem == vend ) break;
409  }
410  else {
411  (~lhs)[i] += melem->value() * velem->value();
412  ++melem;
413  if( melem == mend ) break;
414  ++velem;
415  if( velem == vend ) break;
416  }
417  }
418  }
419  }
420  }
422  //**********************************************************************************************
423 
424  //**Assignment to sparse vectors****************************************************************
436  template< typename VT1 > // Type of the target sparse vector
437  friend inline void assign( SparseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
438  {
440 
441  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
442 
443  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
444  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
445 
446  RT x( rhs.vec_ ); // Evaluation of the right-hand side sparse vector operand
447  if( x.nonZeros() == 0UL ) return;
448 
449  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
450 
451  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
452  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
453  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
454  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
455 
456  ElementType accu;
457  const VectorIterator vend( x.end() );
458 
459  for( size_t i=0UL; i<(~lhs).size(); ++i )
460  {
461  const MatrixIterator mend ( A.end(i) );
462  MatrixIterator melem( A.begin(i) );
463 
464  if( melem == mend ) continue;
465 
466  VectorIterator velem( x.begin() );
467 
468  reset( accu );
469 
470  while( true ) {
471  if( melem->index() < velem->index() ) {
472  ++melem;
473  if( melem == mend ) break;
474  }
475  else if( velem->index() < melem->index() ) {
476  ++velem;
477  if( velem == vend ) break;
478  }
479  else {
480  accu = melem->value() * velem->value();
481  ++melem;
482  ++velem;
483  break;
484  }
485  }
486 
487  if( melem != mend && velem != vend )
488  {
489  while( true ) {
490  if( melem->index() < velem->index() ) {
491  ++melem;
492  if( melem == mend ) break;
493  }
494  else if( velem->index() < melem->index() ) {
495  ++velem;
496  if( velem == vend ) break;
497  }
498  else {
499  accu += melem->value() * velem->value();
500  ++melem;
501  if( melem == mend ) break;
502  ++velem;
503  if( velem == vend ) break;
504  }
505  }
506  }
507 
508  if( !isDefault( accu ) )
509  (~lhs).insert( i, accu );
510  }
511  }
513  //**********************************************************************************************
514 
515  //**Addition assignment to dense vectors********************************************************
527  template< typename VT1 > // Type of the target dense vector
528  friend inline void addAssign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
529  {
531 
532  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
533 
534  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
535  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
536 
537  // Evaluation of the right-hand side sparse vector operand
538  RT x( rhs.vec_ );
539  if( x.nonZeros() == 0UL ) return;
540 
541  // Evaluation of the left-hand side sparse matrix operand
542  LT A( rhs.mat_ );
543 
544  // Checking the evaluated operators
545  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
546  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
547  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
548  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
549 
550  // Performing the sparse matrix-sparse vector multiplication
551  const VectorIterator vend( x.end() );
552 
553  for( size_t i=0UL; i<(~lhs).size(); ++i )
554  {
555  const MatrixIterator mend ( A.end(i) );
556  MatrixIterator melem( A.begin(i) );
557 
558  if( melem == mend ) continue;
559 
560  VectorIterator velem( x.begin() );
561 
562  while( true ) {
563  if( melem->index() < velem->index() ) {
564  ++melem;
565  if( melem == mend ) break;
566  }
567  else if( velem->index() < melem->index() ) {
568  ++velem;
569  if( velem == vend ) break;
570  }
571  else {
572  (~lhs)[i] += melem->value() * velem->value();
573  ++melem;
574  if( melem == mend ) break;
575  ++velem;
576  if( velem == vend ) break;
577  }
578  }
579  }
580  }
582  //**********************************************************************************************
583 
584  //**Addition assignment to sparse vectors*******************************************************
585  // No special implementation for the addition assignment to sparse vectors.
586  //**********************************************************************************************
587 
588  //**Subtraction assignment to dense vectors*****************************************************
600  template< typename VT1 > // Type of the target dense vector
601  friend inline void subAssign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
602  {
604 
605  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
606 
607  typedef typename RemoveReference<LT>::Type::ConstIterator MatrixIterator;
608  typedef typename RemoveReference<RT>::Type::ConstIterator VectorIterator;
609 
610  // Evaluation of the right-hand side sparse vector operand
611  RT x( rhs.vec_ );
612  if( x.nonZeros() == 0UL ) return;
613 
614  // Evaluation of the left-hand side sparse matrix operand
615  LT A( rhs.mat_ );
616 
617  // Checking the evaluated operators
618  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
619  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
620  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
621  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
622 
623  // Performing the sparse matrix-sparse vector multiplication
624  const VectorIterator vend( x.end() );
625 
626  for( size_t i=0UL; i<(~lhs).size(); ++i )
627  {
628  const MatrixIterator mend ( A.end(i) );
629  MatrixIterator melem( A.begin(i) );
630 
631  if( melem == mend ) continue;
632 
633  VectorIterator velem( x.begin() );
634 
635  while( true ) {
636  if( melem->index() < velem->index() ) {
637  ++melem;
638  if( melem == mend ) break;
639  }
640  else if( velem->index() < melem->index() ) {
641  ++velem;
642  if( velem == vend ) break;
643  }
644  else {
645  (~lhs)[i] -= melem->value() * velem->value();
646  ++melem;
647  if( melem == mend ) break;
648  ++velem;
649  if( velem == vend ) break;
650  }
651  }
652  }
653  }
655  //**********************************************************************************************
656 
657  //**Subtraction assignment to sparse vectors****************************************************
658  // No special implementation for the subtraction assignment to sparse vectors.
659  //**********************************************************************************************
660 
661  //**Multiplication assignment to dense vectors**************************************************
673  template< typename VT1 > // Type of the target dense vector
674  friend inline void multAssign( DenseVector<VT1,false>& lhs, const SMatSVecMultExpr& rhs )
675  {
677 
681 
682  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
683 
684  const ResultType tmp( rhs );
685  multAssign( ~lhs, tmp );
686  }
688  //**********************************************************************************************
689 
690  //**Multiplication assignment to sparse vectors*************************************************
691  // No special implementation for the multiplication assignment to sparse vectors.
692  //**********************************************************************************************
693 
694  //**Compile time checks*************************************************************************
701  //**********************************************************************************************
702 };
703 //*************************************************************************************************
704 
705 
706 
707 
708 //=================================================================================================
709 //
710 // GLOBAL BINARY ARITHMETIC OPERATORS
711 //
712 //=================================================================================================
713 
714 //*************************************************************************************************
745 template< typename T1 // Type of the left-hand side sparse matrix
746  , typename T2 > // Type of the right-hand side sparse vector
747 inline const typename DisableIf< IsMatMatMultExpr<T1>, SMatSVecMultExpr<T1,T2> >::Type
749 {
751 
752  if( (~mat).columns() != (~vec).size() )
753  throw std::invalid_argument( "Matrix and vector sizes do not match" );
754 
755  return SMatSVecMultExpr<T1,T2>( ~mat, ~vec );
756 }
757 //*************************************************************************************************
758 
759 
760 
761 
762 //=================================================================================================
763 //
764 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
765 //
766 //=================================================================================================
767 
768 //*************************************************************************************************
781 template< typename T1 // Type of the left-hand side sparse matrix
782  , bool SO // Storage order of the left-hand side sparse matrix
783  , typename T2 > // Type of the right-hand side sparse vector
784 inline const typename EnableIf< IsMatMatMultExpr<T1>, MultExprTrait<T1,T2> >::Type::Type
786 {
788 
789  return (~mat).leftOperand() * ( (~mat).rightOperand() * vec );
790 }
791 //*************************************************************************************************
792 
793 
794 
795 
796 //=================================================================================================
797 //
798 // EXPRESSION TRAIT SPECIALIZATIONS
799 //
800 //=================================================================================================
801 
802 //*************************************************************************************************
804 template< typename MT, typename VT >
805 struct SubvectorExprTrait< SMatSVecMultExpr<MT,VT> >
806 {
807  public:
808  //**********************************************************************************************
809  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT>::Type, VT >::Type Type;
810  //**********************************************************************************************
811 };
813 //*************************************************************************************************
814 
815 } // namespace blaze
816 
817 #endif
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: SMatSVecMultExpr.h:329
SMatSVecMultExpr(const MT &mat, const VT &vec)
Constructor for the SMatSVecMultExpr class.
Definition: SMatSVecMultExpr.h:130
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4512
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:3703
Header file for the SparseVector base class.
SelectType< IsComputation< VT >::value, const VRT, VCT >::Type RT
Type for the assignment of the right-hand side sparse vector operand.
Definition: SMatSVecMultExpr.h:121
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SMatSVecMultExpr.h:144
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatSVecMultExpr.h:309
MCT LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: SMatSVecMultExpr.h:118
#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:4555
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:196
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2375
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:248
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: SMatSVecMultExpr.h:115
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatSVecMultExpr.h:109
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatSVecMultExpr.h:104
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:267
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatSVecMultExpr.h:106
Constraint on the data type.
Header file for the MultExprTrait class template.
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:250
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
Header file for the multiplication trait.
Expression object for sparse matrix-sparse vector multiplications.The SMatSVecMultExpr class represen...
Definition: Forward.h:96
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2379
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:112
MultTrait< MRT, VRT >::Type ResultType
Result type for expression template evaluations.
Definition: SMatSVecMultExpr.h:103
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:96
VT::CompositeType VCT
Composite type of the right-hand side sparse vector expression.
Definition: SMatSVecMultExpr.h:97
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.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2373
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:105
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:321
SMatSVecMultExpr< MT, VT > This
Type of this SMatSVecMultExpr instance.
Definition: SMatSVecMultExpr.h:102
#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:297
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:94
Header file for the RemoveReference type trait.
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: SMatSVecMultExpr.h:277
Header file for the IsComputation type trait class.
VT::ResultType VRT
Result type of the right-hand side sparse vector expression.
Definition: SMatSVecMultExpr.h:95
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:2370
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:154
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:328
Header file for the MatVecMultExpr base class.
#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:287
Header file for the FunctionTrace class.