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 
43 #include <stdexcept>
56 #include <blaze/math/shims/Reset.h>
74 #include <blaze/util/Assert.h>
76 #include <blaze/util/DisableIf.h>
77 #include <blaze/util/EnableIf.h>
79 #include <blaze/util/mpl/Or.h>
80 #include <blaze/util/SelectType.h>
81 #include <blaze/util/Types.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS DMATSVECMULTEXPR
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
100 template< typename MT // Type of the left-hand side dense matrix
101  , typename VT > // Type of the right-hand side sparse vector
102 class DMatSVecMultExpr : public DenseVector< DMatSVecMultExpr<MT,VT>, false >
103  , private MatVecMultExpr
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
108  typedef typename MT::ResultType MRT;
109  typedef typename VT::ResultType VRT;
110  typedef typename MT::CompositeType MCT;
111  typedef typename VT::CompositeType VCT;
112  //**********************************************************************************************
113 
114  //**********************************************************************************************
116  enum { evaluateMatrix = RequiresEvaluation<MT>::value };
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
121  enum { evaluateVector = IsComputation<VT>::value || RequiresEvaluation<VT>::value };
122  //**********************************************************************************************
123 
124  //**********************************************************************************************
126 
132  enum { useAssign = evaluateMatrix || evaluateVector };
133  //**********************************************************************************************
134 
135  //**********************************************************************************************
137  template< typename VT2 >
139  struct UseAssign {
140  enum { value = useAssign };
141  };
143  //**********************************************************************************************
144 
145  //**********************************************************************************************
147 
151  template< typename T1 >
152  struct UseSMPAssign {
153  enum { value = useAssign };
154  };
156  //**********************************************************************************************
157 
158  public:
159  //**Type definitions****************************************************************************
164  typedef const ElementType ReturnType;
165 
168 
170  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
171 
173  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type RightOperand;
174 
177 
180  //**********************************************************************************************
181 
182  //**Compilation flags***************************************************************************
184  enum { vectorizable = 0 };
185 
187  enum { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
188  !evaluateVector && VT::smpAssignable };
189  //**********************************************************************************************
190 
191  //**Constructor*********************************************************************************
197  explicit inline DMatSVecMultExpr( const MT& mat, const VT& vec )
198  : mat_( mat ) // Left-hand side dense matrix of the multiplication expression
199  , vec_( vec ) // Right-hand side sparse vector of the multiplication expression
200  {
201  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
202  }
203  //**********************************************************************************************
204 
205  //**Subscript operator**************************************************************************
211  inline ReturnType operator[]( size_t index ) const {
212  BLAZE_USER_ASSERT( index < mat_.rows(), "Invalid vector access index" );
213 
215 
216  VCT x( vec_ ); // Evaluation of the right-hand side sparse vector operand
217 
218  BLAZE_INTERNAL_ASSERT( x.size() == vec_.size(), "Invalid vector size" );
219 
220  const ConstIterator end( ( IsLower<MT>::value )
221  ?( IsStrictlyLower<MT>::value ? x.lowerBound( index ) : x.upperBound( index ) )
222  :( x.end() ) );
223  ConstIterator element( ( IsUpper<MT>::value )
224  ?( IsStrictlyUpper<MT>::value ? x.upperBound( index ) : x.lowerBound( index ) )
225  :( x.begin() ) );
226 
227  ElementType res = ElementType();
228 
229  if( element != end ) {
230  res = mat_( index, element->index() ) * element->value();
231  ++element;
232  for( ; element!=end; ++element ) {
233  res += mat_( index, element->index() ) * element->value();
234  }
235  }
236 
237  return res;
238  }
239  //**********************************************************************************************
240 
241  //**Size function*******************************************************************************
246  inline size_t size() const {
247  return mat_.rows();
248  }
249  //**********************************************************************************************
250 
251  //**Left operand access*************************************************************************
256  inline LeftOperand leftOperand() const {
257  return mat_;
258  }
259  //**********************************************************************************************
260 
261  //**Right operand access************************************************************************
266  inline RightOperand rightOperand() const {
267  return vec_;
268  }
269  //**********************************************************************************************
270 
271  //**********************************************************************************************
277  template< typename T >
278  inline bool canAlias( const T* alias ) const {
279  return mat_.isAliased( alias ) || vec_.isAliased( alias );
280  }
281  //**********************************************************************************************
282 
283  //**********************************************************************************************
289  template< typename T >
290  inline bool isAliased( const T* alias ) const {
291  return mat_.isAliased( alias ) || vec_.isAliased( alias );
292  }
293  //**********************************************************************************************
294 
295  //**********************************************************************************************
300  inline bool isAligned() const {
301  return mat_.isAligned();
302  }
303  //**********************************************************************************************
304 
305  //**********************************************************************************************
310  inline bool canSMPAssign() const {
311  return ( size() > SMP_DMATSVECMULT_THRESHOLD );
312  }
313  //**********************************************************************************************
314 
315  private:
316  //**Member variables****************************************************************************
317  LeftOperand mat_;
318  RightOperand vec_;
319  //**********************************************************************************************
320 
321  //**Assignment to dense vectors*****************************************************************
337  template< typename VT1 > // Type of the target dense vector
338  friend inline typename EnableIf< UseAssign<VT1> >::Type
340  {
342 
343  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
344 
346 
347  // Evaluation of the right-hand side sparse vector operand
348  RT x( serial( rhs.vec_ ) );
349  if( x.nonZeros() == 0UL ) {
350  reset( ~lhs );
351  return;
352  }
353 
354  // Evaluation of the left-hand side dense matrix operand
355  LT A( serial( rhs.mat_ ) );
356 
357  // Checking the evaluated operands
358  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
359  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
360  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
361  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
362 
363  // Performing the dense matrix-sparse vector multiplication
364  assign( ~lhs, A * x );
365  }
367  //**********************************************************************************************
368 
369  //**Assignment to sparse vectors****************************************************************
385  template< typename VT1 > // Type of the target sparse vector
386  friend inline typename EnableIf< UseAssign<VT1> >::Type
388  {
390 
394 
395  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
396 
397  const ResultType tmp( serial( rhs ) );
398  assign( ~lhs, tmp );
399  }
401  //**********************************************************************************************
402 
403  //**Addition assignment to dense vectors********************************************************
419  template< typename VT1 > // Type of the target dense vector
420  friend inline typename EnableIf< UseAssign<VT1> >::Type
421  addAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
422  {
424 
425  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
426 
428 
429  // Evaluation of the right-hand side sparse vector operand
430  RT x( serial( rhs.vec_ ) );
431  if( x.nonZeros() == 0UL ) return;
432 
433  // Evaluation of the left-hand side dense matrix operand
434  LT A( serial( rhs.mat_ ) );
435 
436  // Checking the evaluated operands
437  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
438  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
439  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
440  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
441 
442  // Performing the dense matrix-sparse vector multiplication
443  addAssign( ~lhs, A * x );
444  }
446  //**********************************************************************************************
447 
448  //**Addition assignment to sparse vectors*******************************************************
449  // No special implementation for the addition assignment to sparse vectors.
450  //**********************************************************************************************
451 
452  //**Subtraction assignment to dense vectors*****************************************************
468  template< typename VT1 > // Type of the target dense vector
469  friend inline typename EnableIf< UseAssign<VT1> >::Type
470  subAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
471  {
473 
474  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
475 
477 
478  // Evaluation of the right-hand side sparse vector operand
479  RT x( serial( rhs.vec_ ) );
480  if( x.nonZeros() == 0UL ) return;
481 
482  // Evaluation of the left-hand side dense matrix operand
483  LT A( serial( rhs.mat_ ) );
484 
485  // Checking the evaluated operands
486  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
487  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
488  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
489  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
490 
491  // Performing the dense matrix-sparse vector multiplication
492  subAssign( ~lhs, A * x );
493  }
495  //**********************************************************************************************
496 
497  //**Subtraction assignment to sparse vectors****************************************************
498  // No special implementation for the subtraction assignment to sparse vectors.
499  //**********************************************************************************************
500 
501  //**Multiplication assignment to dense vectors**************************************************
517  template< typename VT1 > // Type of the target dense vector
518  friend inline typename EnableIf< UseAssign<VT1> >::Type
519  multAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
520  {
522 
526 
527  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
528 
529  const ResultType tmp( serial( rhs ) );
530  multAssign( ~lhs, tmp );
531  }
533  //**********************************************************************************************
534 
535  //**Addition assignment to sparse vectors*******************************************************
536  // No special implementation for the multiplication assignment to sparse vectors.
537  //**********************************************************************************************
538 
539  //**SMP assignment to dense vectors*************************************************************
554  template< typename VT1 > // Type of the target dense vector
555  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
556  smpAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
557  {
559 
560  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
561 
563 
564  // Evaluation of the right-hand side sparse vector operand
565  RT x( rhs.vec_ );
566  if( x.nonZeros() == 0UL ) {
567  reset( ~lhs );
568  return;
569  }
570 
571  // Evaluation of the left-hand side dense matrix operand
572  LT A( rhs.mat_ );
573 
574  // Checking the evaluated operands
575  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
576  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
577  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
578  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
579 
580  // Performing the dense matrix-sparse vector multiplication
581  smpAssign( ~lhs, A * x );
582  }
584  //**********************************************************************************************
585 
586  //**SMP assignment to sparse vectors************************************************************
601  template< typename VT1 > // Type of the target sparse vector
602  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
603  smpAssign( SparseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
604  {
606 
610 
611  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
612 
613  const ResultType tmp( rhs );
614  smpAssign( ~lhs, tmp );
615  }
617  //**********************************************************************************************
618 
619  //**SMP addition assignment to dense vectors****************************************************
634  template< typename VT1 > // Type of the target dense vector
635  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
636  smpAddAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
637  {
639 
640  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
641 
643 
644  // Evaluation of the right-hand side sparse vector operand
645  RT x( rhs.vec_ );
646  if( x.nonZeros() == 0UL ) return;
647 
648  // Evaluation of the left-hand side dense matrix operand
649  LT A( rhs.mat_ );
650 
651  // Checking the evaluated operands
652  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
653  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
654  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
655  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
656 
657  // Performing the dense matrix-sparse vector multiplication
658  smpAddAssign( ~lhs, A * x );
659  }
661  //**********************************************************************************************
662 
663  //**SMP addition assignment to sparse vectors***************************************************
664  // No special implementation for the SMP addition assignment to sparse vectors.
665  //**********************************************************************************************
666 
667  //**SMP subtraction assignment to dense vectors*************************************************
682  template< typename VT1 > // Type of the target dense vector
683  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
684  smpSubAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
685  {
687 
688  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
689 
691 
692  // Evaluation of the right-hand side sparse vector operand
693  RT x( rhs.vec_ );
694  if( x.nonZeros() == 0UL ) return;
695 
696  // Evaluation of the left-hand side dense matrix operand
697  LT A( rhs.mat_ );
698 
699  // Checking the evaluated operands
700  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
701  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
702  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
703  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
704 
705  // Performing the dense matrix-sparse vector multiplication
706  smpSubAssign( ~lhs, A * x );
707  }
709  //**********************************************************************************************
710 
711  //**SMP subtraction assignment to sparse vectors************************************************
712  // No special implementation for the SMP subtraction assignment to sparse vectors.
713  //**********************************************************************************************
714 
715  //**SMP multiplication assignment to dense vectors**********************************************
730  template< typename VT1 > // Type of the target dense vector
731  friend inline typename EnableIf< UseSMPAssign<VT1> >::Type
732  smpMultAssign( DenseVector<VT1,false>& lhs, const DMatSVecMultExpr& rhs )
733  {
735 
739 
740  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
741 
742  const ResultType tmp( rhs );
743  smpMultAssign( ~lhs, tmp );
744  }
746  //**********************************************************************************************
747 
748  //**SMP multiplication assignment to sparse vectors*********************************************
749  // No special implementation for the SMP multiplication assignment to sparse vectors.
750  //**********************************************************************************************
751 
752  //**Compile time checks*************************************************************************
761  //**********************************************************************************************
762 };
763 //*************************************************************************************************
764 
765 
766 
767 
768 //=================================================================================================
769 //
770 // GLOBAL BINARY ARITHMETIC OPERATORS
771 //
772 //=================================================================================================
773 
774 //*************************************************************************************************
806 template< typename T1 // Type of the left-hand side dense matrix
807  , typename T2 > // Type of the right-hand side sparse vector
808 inline const typename DisableIf< Or< IsSymmetric<T1>, IsMatMatMultExpr<T1> >
809  , DMatSVecMultExpr<T1,T2> >::Type
811 {
813 
814  if( (~mat).columns() != (~vec).size() )
815  throw std::invalid_argument( "Matrix and vector sizes do not match" );
816 
817  return DMatSVecMultExpr<T1,T2>( ~mat, ~vec );
818 }
819 //*************************************************************************************************
820 
821 
822 
823 
824 //=================================================================================================
825 //
826 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
827 //
828 //=================================================================================================
829 
830 //*************************************************************************************************
845 template< typename T1 // Type of the left-hand side dense matrix
846  , typename T2 > // Type of the right-hand side sparse vector
847 inline const typename EnableIf< IsSymmetric<T1>, typename MultExprTrait<T1,T2>::Type >::Type
848  operator*( const DenseMatrix<T1,false>& mat, const SparseVector<T2,false>& vec )
849 {
851 
853 
854  if( (~mat).columns() != (~vec).size() )
855  throw std::invalid_argument( "Matrix and vector sizes do not match" );
856 
857  return trans( ~mat ) * (~vec);
858 }
860 //*************************************************************************************************
861 
862 
863 //*************************************************************************************************
877 template< typename T1 // Type of the left-hand side dense matrix
878  , bool SO // Storage order of the left-hand side dense matrix
879  , typename T2 > // Type of the right-hand side sparse vector
880 inline const typename EnableIf< IsMatMatMultExpr<T1>, typename MultExprTrait<T1,T2>::Type >::Type
881  operator*( const DenseMatrix<T1,SO>& mat, const SparseVector<T2,false>& vec )
882 {
884 
886 
887  return (~mat).leftOperand() * ( (~mat).rightOperand() * vec );
888 }
890 //*************************************************************************************************
891 
892 
893 
894 
895 //=================================================================================================
896 //
897 // SIZE SPECIALIZATIONS
898 //
899 //=================================================================================================
900 
901 //*************************************************************************************************
903 template< typename MT, typename VT >
904 struct Size< DMatSVecMultExpr<MT,VT> >
905  : public Rows<MT>
906 {};
908 //*************************************************************************************************
909 
910 
911 
912 
913 //=================================================================================================
914 //
915 // EXPRESSION TRAIT SPECIALIZATIONS
916 //
917 //=================================================================================================
918 
919 //*************************************************************************************************
921 template< typename MT, typename VT, bool AF >
922 struct SubvectorExprTrait< DMatSVecMultExpr<MT,VT>, AF >
923 {
924  public:
925  //**********************************************************************************************
926  typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type
927  , typename SubvectorExprTrait<const VT,AF>::Type >::Type Type;
928  //**********************************************************************************************
929 };
931 //*************************************************************************************************
932 
933 } // namespace blaze
934 
935 #endif
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatSVecMultExpr.h:300
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
BLAZE_ALWAYS_INLINE 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:879
#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:8247
Header file for basic type definitions.
DMatSVecMultExpr< MT, VT > This
Type of this DMatSVecMultExpr instance.
Definition: DMatSVecMultExpr.h:160
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
LeftOperand leftOperand() const
Returns the left-hand side dense matrix operand.
Definition: DMatSVecMultExpr.h:256
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:258
#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
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
#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:821
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:261
MultTrait< MRT, VRT >::Type ResultType
Result type for expression template evaluations.
Definition: DMatSVecMultExpr.h:161
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:699
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
Header file for the RequiresEvaluation type trait.
LeftOperand mat_
Left-hand side dense matrix of the multiplication expression.
Definition: DMatSVecMultExpr.h:317
VT::ResultType VRT
Result type of the right-hand side sparse vector expression.
Definition: DMatSVecMultExpr.h:109
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.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatSVecMultExpr.h:162
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:263
Expression object for dense matrix-sparse vector multiplications.The DMatSVecMultExpr class represent...
Definition: DMatSVecMultExpr.h:102
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:179
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
Header file for the Or class template.
Header file for the IsMatMatMultExpr type trait class.
BLAZE_ALWAYS_INLINE 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:635
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: DMatSVecMultExpr.h:318
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:173
Constraint on the data type.
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:266
#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
Constraints on the storage order of matrix types.
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:110
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: StorageOrder.h:81
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:246
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:150
BLAZE_ALWAYS_INLINE 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:742
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatSVecMultExpr.h:170
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:163
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:278
Constraint on the data type.
Header file for the RemoveReference type trait.
const size_t SMP_DMATSVECMULT_THRESHOLD
SMP row-major dense matrix/sparse vector multiplication threshold.This threshold specifies when a row...
Definition: Thresholds.h:414
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:164
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:937
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:290
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:108
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
Header file for the SubvectorExprTrait class template.
Constraint on the data type.
Header file for the IsUpper type trait.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DMatSVecMultExpr.h:211
Header file for the MatVecMultExpr base class.
SelectType< useAssign, const ResultType, const DMatSVecMultExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatSVecMultExpr.h:167
DMatSVecMultExpr(const MT &mat, const VT &vec)
Constructor for the DMatSVecMultExpr class.
Definition: DMatSVecMultExpr.h:197
Constraint on the data type.
MT::ResultType MRT
Result type of the left-hand side dense matrix expression.
Definition: DMatSVecMultExpr.h:108
VT::CompositeType VCT
Composite type of the right-hand side sparse vector expression.
Definition: DMatSVecMultExpr.h:111
SelectType< evaluateMatrix, const MRT, MCT >::Type LT
Type for the assignment of the left-hand side dense matrix operand.
Definition: DMatSVecMultExpr.h:176
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatSVecMultExpr.h:310
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.
BLAZE_ALWAYS_INLINE 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:849