DMatSVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATSVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATSVECMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
55 #include <blaze/math/shims/Reset.h>
74 #include <blaze/util/Assert.h>
76 #include <blaze/util/DisableIf.h>
77 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/Exception.h>
80 #include <blaze/util/mpl/Or.h>
81 #include <blaze/util/SelectType.h>
82 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS DMATSVECMULTEXPR
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
101 template< typename MT // Type of the left-hand side dense matrix
102  , typename VT > // Type of the right-hand side sparse vector
103 class DMatSVecMultExpr : public DenseVector< DMatSVecMultExpr<MT,VT>, false >
104  , private MatVecMultExpr
105  , private Computation
106 {
107  private:
108  //**Type definitions****************************************************************************
109  typedef typename MT::ResultType MRT;
110  typedef typename VT::ResultType VRT;
111  typedef typename MT::CompositeType MCT;
112  typedef typename VT::CompositeType VCT;
113  //**********************************************************************************************
114 
115  //**********************************************************************************************
117  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
118  //**********************************************************************************************
119 
120  //**********************************************************************************************
122  enum { evaluateVector = IsComputation<VT>::value || RequiresEvaluation<VT>::value };
123  //**********************************************************************************************
124 
125  //**********************************************************************************************
127 
133  enum { useAssign = evaluateMatrix || evaluateVector };
134  //**********************************************************************************************
135 
136  //**********************************************************************************************
138  template< typename VT2 >
140  struct UseAssign {
141  enum { value = useAssign };
142  };
144  //**********************************************************************************************
145 
146  //**********************************************************************************************
148 
152  template< typename T1 >
153  struct UseSMPAssign {
154  enum { value = useAssign };
155  };
157  //**********************************************************************************************
158 
159  public:
160  //**Type definitions****************************************************************************
165  typedef const ElementType ReturnType;
166 
169 
171  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
172 
174  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type RightOperand;
175 
178 
181  //**********************************************************************************************
182 
183  //**Compilation flags***************************************************************************
185  enum { vectorizable = 0 };
186 
188  enum { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
189  !evaluateVector && VT::smpAssignable };
190  //**********************************************************************************************
191 
192  //**Constructor*********************************************************************************
198  explicit inline DMatSVecMultExpr( const MT& mat, const VT& vec )
199  : mat_( mat ) // Left-hand side dense matrix of the multiplication expression
200  , vec_( vec ) // Right-hand side sparse vector of the multiplication expression
201  {
202  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
203  }
204  //**********************************************************************************************
205 
206  //**Subscript operator**************************************************************************
212  inline ReturnType operator[]( size_t index ) const {
213  BLAZE_USER_ASSERT( index < mat_.rows(), "Invalid vector access index" );
214 
216 
217  VCT x( vec_ ); // Evaluation of the right-hand side sparse vector operand
218 
219  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size(), "Invalid vector size" );
220 
221  const ConstIterator end( ( IsLower<MT>::value )
222  ?( IsStrictlyLower<MT>::value ? x.lowerBound( index ) : x.upperBound( index ) )
223  :( x.end() ) );
224  ConstIterator element( ( IsUpper<MT>::value )
225  ?( IsStrictlyUpper<MT>::value ? x.upperBound( index ) : x.lowerBound( index ) )
226  :( x.begin() ) );
227 
228  ElementType res = ElementType();
229 
230  if( element != end ) {
231  res = mat_( index, element->index() ) * element->value();
232  ++element;
233  for( ; element!=end; ++element ) {
234  res += mat_( index, element->index() ) * element->value();
235  }
236  }
237 
238  return res;
239  }
240  //**********************************************************************************************
241 
242  //**At function*********************************************************************************
249  inline ReturnType at( size_t index ) const {
250  if( index >= mat_.rows() ) {
251  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
252  }
253  return (*this)[index];
254  }
255  //**********************************************************************************************
256 
257  //**Size function*******************************************************************************
262  inline size_t size() const {
263  return mat_.rows();
264  }
265  //**********************************************************************************************
266 
267  //**Left operand access*************************************************************************
272  inline LeftOperand leftOperand() const {
273  return mat_;
274  }
275  //**********************************************************************************************
276 
277  //**Right operand access************************************************************************
282  inline RightOperand rightOperand() const {
283  return vec_;
284  }
285  //**********************************************************************************************
286 
287  //**********************************************************************************************
293  template< typename T >
294  inline bool canAlias( const T* alias ) const {
295  return mat_.isAliased( alias ) || vec_.isAliased( alias );
296  }
297  //**********************************************************************************************
298 
299  //**********************************************************************************************
305  template< typename T >
306  inline bool isAliased( const T* alias ) const {
307  return mat_.isAliased( alias ) || vec_.isAliased( alias );
308  }
309  //**********************************************************************************************
310 
311  //**********************************************************************************************
316  inline bool isAligned() const {
317  return mat_.isAligned();
318  }
319  //**********************************************************************************************
320 
321  //**********************************************************************************************
326  inline bool canSMPAssign() const {
327  return ( size() > SMP_DMATSVECMULT_THRESHOLD );
328  }
329  //**********************************************************************************************
330 
331  private:
332  //**Member variables****************************************************************************
333  LeftOperand mat_;
334  RightOperand vec_;
335  //**********************************************************************************************
336 
337  //**Assignment to dense vectors*****************************************************************
353  template< typename VT1 > // Type of the target dense vector
354  friend inline typename EnableIf< UseAssign<VT1> >::Type
355  assign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
356  {
358 
359  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
360 
362 
363  // Evaluation of the right-hand side sparse vector operand
364  RT x( serial( rhs.vec_ ) );
365  if( x.nonZeros() == 0UL ) {
366  reset( ~lhs );
367  return;
368  }
369 
370  // Evaluation of the left-hand side dense matrix operand
371  LT A( serial( rhs.mat_ ) );
372 
373  // Checking the evaluated operands
374  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
375  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
376  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
377  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
378 
379  // Performing the dense matrix-sparse vector multiplication
380  assign( ~lhs, A * x );
381  }
383  //**********************************************************************************************
384 
385  //**Assignment to sparse vectors****************************************************************
401  template< typename VT1 > // Type of the target sparse vector
402  friend inline typename EnableIf< UseAssign<VT1> >::Type
403  assign( SparseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
404  {
406 
410 
411  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
412 
413  const ResultType tmp( serial( rhs ) );
414  assign( ~lhs, tmp );
415  }
417  //**********************************************************************************************
418 
419  //**Addition assignment to dense vectors********************************************************
435  template< typename VT1 > // Type of the target dense vector
436  friend inline typename EnableIf< UseAssign<VT1> >::Type
437  addAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
438  {
440 
441  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
442 
444 
445  // Evaluation of the right-hand side sparse vector operand
446  RT x( serial( rhs.vec_ ) );
447  if( x.nonZeros() == 0UL ) return;
448 
449  // Evaluation of the left-hand side dense matrix operand
450  LT A( serial( rhs.mat_ ) );
451 
452  // Checking the evaluated operands
453  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
454  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
455  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
456  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
457 
458  // Performing the dense matrix-sparse vector multiplication
459  addAssign( ~lhs, A * x );
460  }
462  //**********************************************************************************************
463 
464  //**Addition assignment to sparse vectors*******************************************************
465  // No special implementation for the addition assignment to sparse vectors.
466  //**********************************************************************************************
467 
468  //**Subtraction assignment to dense vectors*****************************************************
484  template< typename VT1 > // Type of the target dense vector
485  friend inline typename EnableIf< UseAssign<VT1> >::Type
486  subAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
487  {
489 
490  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
491 
493 
494  // Evaluation of the right-hand side sparse vector operand
495  RT x( serial( rhs.vec_ ) );
496  if( x.nonZeros() == 0UL ) return;
497 
498  // Evaluation of the left-hand side dense matrix operand
499  LT A( serial( rhs.mat_ ) );
500 
501  // Checking the evaluated operands
502  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
503  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
504  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
505  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
506 
507  // Performing the dense matrix-sparse vector multiplication
508  subAssign( ~lhs, A * x );
509  }
511  //**********************************************************************************************
512 
513  //**Subtraction assignment to sparse vectors****************************************************
514  // No special implementation for the subtraction assignment to sparse vectors.
515  //**********************************************************************************************
516 
517  //**Multiplication assignment to dense vectors**************************************************
533  template< typename VT1 > // Type of the target dense vector
534  friend inline typename EnableIf< UseAssign<VT1> >::Type
535  multAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
536  {
538 
542 
543  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
544 
545  const ResultType tmp( serial( rhs ) );
546  multAssign( ~lhs, tmp );
547  }
549  //**********************************************************************************************
550 
551  //**Addition assignment to sparse vectors*******************************************************
552  // No special implementation for the multiplication assignment to sparse vectors.
553  //**********************************************************************************************
554 
555  //**SMP assignment to dense vectors*************************************************************
570  template< typename VT1 > // Type of the target dense vector
571  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
572  smpAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
573  {
575 
576  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
577 
579 
580  // Evaluation of the right-hand side sparse vector operand
581  RT x( rhs.vec_ );
582  if( x.nonZeros() == 0UL ) {
583  reset( ~lhs );
584  return;
585  }
586 
587  // Evaluation of the left-hand side dense matrix operand
588  LT A( rhs.mat_ );
589 
590  // Checking the evaluated operands
591  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
592  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
593  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
594  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
595 
596  // Performing the dense matrix-sparse vector multiplication
597  smpAssign( ~lhs, A * x );
598  }
600  //**********************************************************************************************
601 
602  //**SMP assignment to sparse vectors************************************************************
617  template< typename VT1 > // Type of the target sparse vector
618  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
619  smpAssign( SparseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
620  {
622 
626 
627  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
628 
629  const ResultType tmp( rhs );
630  smpAssign( ~lhs, tmp );
631  }
633  //**********************************************************************************************
634 
635  //**SMP addition assignment to dense vectors****************************************************
650  template< typename VT1 > // Type of the target dense vector
651  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
652  smpAddAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
653  {
655 
656  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
657 
659 
660  // Evaluation of the right-hand side sparse vector operand
661  RT x( rhs.vec_ );
662  if( x.nonZeros() == 0UL ) return;
663 
664  // Evaluation of the left-hand side dense matrix operand
665  LT A( rhs.mat_ );
666 
667  // Checking the evaluated operands
668  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
669  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
670  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
671  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
672 
673  // Performing the dense matrix-sparse vector multiplication
674  smpAddAssign( ~lhs, A * x );
675  }
677  //**********************************************************************************************
678 
679  //**SMP addition assignment to sparse vectors***************************************************
680  // No special implementation for the SMP addition assignment to sparse vectors.
681  //**********************************************************************************************
682 
683  //**SMP subtraction assignment to dense vectors*************************************************
698  template< typename VT1 > // Type of the target dense vector
699  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
700  smpSubAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
701  {
703 
704  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
705 
707 
708  // Evaluation of the right-hand side sparse vector operand
709  RT x( rhs.vec_ );
710  if( x.nonZeros() == 0UL ) return;
711 
712  // Evaluation of the left-hand side dense matrix operand
713  LT A( rhs.mat_ );
714 
715  // Checking the evaluated operands
716  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
717  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
718  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
719  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
720 
721  // Performing the dense matrix-sparse vector multiplication
722  smpSubAssign( ~lhs, A * x );
723  }
725  //**********************************************************************************************
726 
727  //**SMP subtraction assignment to sparse vectors************************************************
728  // No special implementation for the SMP subtraction assignment to sparse vectors.
729  //**********************************************************************************************
730 
731  //**SMP multiplication assignment to dense vectors**********************************************
746  template< typename VT1 > // Type of the target dense vector
747  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
748  smpMultAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
749  {
751 
755 
756  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
757 
758  const ResultType tmp( rhs );
759  smpMultAssign( ~lhs, tmp );
760  }
762  //**********************************************************************************************
763 
764  //**SMP multiplication assignment to sparse vectors*********************************************
765  // No special implementation for the SMP multiplication assignment to sparse vectors.
766  //**********************************************************************************************
767 
768  //**Compile time checks*************************************************************************
777  //**********************************************************************************************
778 };
779 //*************************************************************************************************
780 
781 
782 
783 
784 //=================================================================================================
785 //
786 // GLOBAL BINARY ARITHMETIC OPERATORS
787 //
788 //=================================================================================================
789 
790 //*************************************************************************************************
822 template< typename T1 // Type of the left-hand side dense matrix
823  , typename T2 > // Type of the right-hand side sparse vector
824 inline const typename DisableIf< Or< IsSymmetric<T1>, IsMatMatMultExpr<T1> >
825  , DMatSVecMultExpr<T1,T2> >::Type
827 {
829 
830  if( (~mat).columns() != (~vec).size() ) {
831  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
832  }
833 
834  return DMatSVecMultExpr<T1,T2>( ~mat, ~vec );
835 }
836 //*************************************************************************************************
837 
838 
839 
840 
841 //=================================================================================================
842 //
843 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
844 //
845 //=================================================================================================
846 
847 //*************************************************************************************************
862 template< typename T1 // Type of the left-hand side dense matrix
863  , typename T2 > // Type of the right-hand side sparse vector
864 inline const typename EnableIf< IsSymmetric<T1>, typename MultExprTrait<T1,T2>::Type >::Type
865  operator*( const DenseMatrix<T1,false>& mat, const SparseVector<T2,false>& vec )
866 {
868 
870 
871  if( (~mat).columns() != (~vec).size() ) {
872  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
873  }
874 
875  return trans( ~mat ) * (~vec);
876 }
878 //*************************************************************************************************
879 
880 
881 //*************************************************************************************************
895 template< typename T1 // Type of the left-hand side dense matrix
896  , bool SO // Storage order of the left-hand side dense matrix
897  , typename T2 > // Type of the right-hand side sparse vector
898 inline const typename EnableIf< IsMatMatMultExpr<T1>, typename MultExprTrait<T1,T2>::Type >::Type
899  operator*( const DenseMatrix<T1,SO>& mat, const SparseVector<T2,false>& vec )
900 {
902 
904 
905  return (~mat).leftOperand() * ( (~mat).rightOperand() * vec );
906 }
908 //*************************************************************************************************
909 
910 
911 
912 
913 //=================================================================================================
914 //
915 // SIZE SPECIALIZATIONS
916 //
917 //=================================================================================================
918 
919 //*************************************************************************************************
921 template< typename MT, typename VT >
922 struct Size< DMatSVecMultExpr<MT,VT> > : public Rows<MT>
923 {};
925 //*************************************************************************************************
926 
927 
928 
929 
930 //=================================================================================================
931 //
932 // ISALIGNED SPECIALIZATIONS
933 //
934 //=================================================================================================
935 
936 //*************************************************************************************************
938 template< typename MT, typename VT >
939 struct IsAligned< DMatSVecMultExpr<MT,VT> > : public IsTrue< IsAligned<MT>::value >
940 {};
942 //*************************************************************************************************
943 
944 
945 
946 
947 //=================================================================================================
948 //
949 // EXPRESSION TRAIT SPECIALIZATIONS
950 //
951 //=================================================================================================
952 
953 //*************************************************************************************************
955 template< typename MT, typename VT, bool AF >
956 struct SubvectorExprTrait< DMatSVecMultExpr<MT,VT>, AF >
957 {
958  public:
959  //**********************************************************************************************
960  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type
961  , typename SubvectorExprTrait<const VT,AF>::Type >::Type Type;
962  //**********************************************************************************************
963 };
965 //*************************************************************************************************
966 
967 } // namespace blaze
968 
969 #endif
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatSVecMultExpr.h:316
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
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:7820
Header file for basic type definitions.
DMatSVecMultExpr< MT, VT > This
Type of this DMatSVecMultExpr instance.
Definition: DMatSVecMultExpr.h:161
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
LeftOperand leftOperand() const
Returns the left-hand side dense matrix operand.
Definition: DMatSVecMultExpr.h:272
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:250
#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: ColumnVector.h:79
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
MultTrait< MRT, VRT >::Type ResultType
Result type for expression template evaluations.
Definition: DMatSVecMultExpr.h:162
Header file for the DenseVector base class.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the Computation base class.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
LeftOperand mat_
Left-hand side dense matrix of the multiplication expression.
Definition: DMatSVecMultExpr.h:333
VT::ResultType VRT
Result type of the right-hand side sparse vector expression.
Definition: DMatSVecMultExpr.h:110
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DMatSVecMultExpr.h:249
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Constraint on the data type.
Constraint on the transpose flag of vector types.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatSVecMultExpr.h:163
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:261
Expression object for dense matrix-sparse vector multiplications.The DMatSVecMultExpr class represent...
Definition: DMatSVecMultExpr.h:103
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 IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
SelectType< evaluateVector, const VRT, VCT >::Type RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: DMatSVecMultExpr.h:180
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
Header file for the Or class template.
Header file for the IsMatMatMultExpr type trait class.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: DMatSVecMultExpr.h:334
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Header file for the IsLower type trait.
#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
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DMatSVecMultExpr.h:174
Header file for the IsAligned type trait.
Base class for all matrix/vector multiplication expression templates.The MatVecMultExpr class serves ...
Definition: MatVecMultExpr.h:66
#define BLAZE_CONSTRAINT_MUST_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a matrix/matrix multiplication expressio...
Definition: MatMatMultExpr.h:126
RightOperand rightOperand() const
Returns the right-hand side sparse vector operand.
Definition: DMatSVecMultExpr.h:282
#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
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATVECMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/vector ...
Definition: MatVecMultExpr.h:166
Constraint on the data type.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the serial shim.
MT::CompositeType MCT
Composite type of the left-hand side dense matrix expression.
Definition: DMatSVecMultExpr.h:111
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
Header file for the SubmatrixExprTrait class template.
#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: RowMajorMatrix.h:79
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
size_t size() const
Returns the current size/dimension of the vector.
Definition: DMatSVecMultExpr.h:262
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Base template for the MultTrait class.
Definition: MultTrait.h:138
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatSVecMultExpr.h:171
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
ResultType::ElementType ElementType
Resulting element type.
Definition: DMatSVecMultExpr.h:164
Header file for the reset shim.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatSVecMultExpr.h:294
Constraint on the data type.
Header file for the RemoveReference type trait.
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:79
const ElementType ReturnType
Return type for expression template evaluations.
Definition: DMatSVecMultExpr.h:165
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:944
Header file for the IsComputation type trait class.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatSVecMultExpr.h:306
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< 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:129
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#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:2583
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
Header file for the SubvectorExprTrait class template.
Constraint on the data type.
Header file for the IsUpper type trait.
Header file for exception macros.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DMatSVecMultExpr.h:212
Header file for the MatVecMultExpr base class.
SelectType< useAssign, const ResultType, const DMatSVecMultExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatSVecMultExpr.h:168
DMatSVecMultExpr(const MT &mat, const VT &vec)
Constructor for the DMatSVecMultExpr class.
Definition: DMatSVecMultExpr.h:198
Constraint on the data type.
MT::ResultType MRT
Result type of the left-hand side dense matrix expression.
Definition: DMatSVecMultExpr.h:109
VT::CompositeType VCT
Composite type of the right-hand side sparse vector expression.
Definition: DMatSVecMultExpr.h:112
SelectType< evaluateMatrix, const MRT, MCT >::Type LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: DMatSVecMultExpr.h:177
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatSVecMultExpr.h:326
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< 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:189
Header file for the Size type trait.
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
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.