SMatDVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATDVECMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
52 #include <blaze/math/Exception.h>
57 #include <blaze/math/shims/Reset.h>
66 #include <blaze/math/views/Check.h>
68 #include <blaze/util/Assert.h>
69 #include <blaze/util/DisableIf.h>
70 #include <blaze/util/EnableIf.h>
72 #include <blaze/util/mpl/If.h>
73 #include <blaze/util/Types.h>
74 #include <blaze/util/Unused.h>
75 
76 
77 namespace blaze {
78 
79 //=================================================================================================
80 //
81 // CLASS SMATDVECMULTEXPR
82 //
83 //=================================================================================================
84 
85 //*************************************************************************************************
92 template< typename MT // Type of the left-hand side sparse matrix
93  , typename VT > // Type of the right-hand side dense vector
94 class SMatDVecMultExpr
95  : public MatVecMultExpr< DenseVector< SMatDVecMultExpr<MT,VT>, false > >
96  , private Computation
97 {
98  private:
99  //**Type definitions****************************************************************************
104  //**********************************************************************************************
105 
106  //**********************************************************************************************
108  static constexpr bool evaluateMatrix = RequiresEvaluation_v<MT>;
109  //**********************************************************************************************
110 
111  //**********************************************************************************************
113  static constexpr bool evaluateVector = ( IsComputation_v<VT> || RequiresEvaluation_v<VT> );
114  //**********************************************************************************************
115 
116  //**********************************************************************************************
118 
124  static constexpr bool useAssign = ( evaluateMatrix || evaluateVector );
125  //**********************************************************************************************
126 
127  //**********************************************************************************************
129  template< typename VT2 >
131  static constexpr bool UseAssign_v = useAssign;
133  //**********************************************************************************************
134 
135  //**********************************************************************************************
137 
141  template< typename T1 >
142  static constexpr bool UseSMPAssign_v = useAssign;
144  //**********************************************************************************************
145 
146  public:
147  //**Type definitions****************************************************************************
153  using ReturnType = const ElementType;
154 
157 
159  using LeftOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
160 
162  using RightOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
163 
166 
169  //**********************************************************************************************
170 
171  //**Compilation flags***************************************************************************
173  static constexpr bool simdEnabled = false;
174 
176  static constexpr bool smpAssignable =
178  //**********************************************************************************************
179 
180  //**Constructor*********************************************************************************
186  explicit inline SMatDVecMultExpr( const MT& mat, const VT& vec ) noexcept
187  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
188  , vec_( vec ) // Right-hand side dense vector of the multiplication expression
189  {
190  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
191  }
192  //**********************************************************************************************
193 
194  //**Subscript operator**************************************************************************
200  inline ReturnType operator[]( size_t index ) const {
201  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
202  return row( mat_, index, unchecked ) * vec_;
203  }
204  //**********************************************************************************************
205 
206  //**At function*********************************************************************************
213  inline ReturnType at( size_t index ) const {
214  if( index >= mat_.rows() ) {
215  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
216  }
217  return (*this)[index];
218  }
219  //**********************************************************************************************
220 
221  //**Size function*******************************************************************************
226  inline size_t size() const noexcept {
227  return mat_.rows();
228  }
229  //**********************************************************************************************
230 
231  //**Left operand access*************************************************************************
236  inline LeftOperand leftOperand() const noexcept {
237  return mat_;
238  }
239  //**********************************************************************************************
240 
241  //**Right operand access************************************************************************
246  inline RightOperand rightOperand() const noexcept {
247  return vec_;
248  }
249  //**********************************************************************************************
250 
251  //**********************************************************************************************
257  template< typename T >
258  inline bool canAlias( const T* alias ) const noexcept {
259  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
260  }
261  //**********************************************************************************************
262 
263  //**********************************************************************************************
269  template< typename T >
270  inline bool isAliased( const T* alias ) const noexcept {
271  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
272  }
273  //**********************************************************************************************
274 
275  //**********************************************************************************************
280  inline bool isAligned() const noexcept {
281  return vec_.isAligned();
282  }
283  //**********************************************************************************************
284 
285  //**********************************************************************************************
290  inline bool canSMPAssign() const noexcept {
291  return ( size() > SMP_SMATDVECMULT_THRESHOLD );
292  }
293  //**********************************************************************************************
294 
295  private:
296  //**Member variables****************************************************************************
299  //**********************************************************************************************
300 
301  //**Assignment to dense vectors*****************************************************************
317  template< typename VT1 > // Type of the target dense vector
318  friend inline auto assign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
320  {
322 
323  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
324 
325  if( rhs.mat_.columns() == 0UL ) {
326  reset( ~lhs );
327  return;
328  }
329 
330  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
331  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
332 
333  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
334  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
335  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
336  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
337 
338  assign( ~lhs, A * x );
339  }
341  //**********************************************************************************************
342 
343  //**Assignment to sparse vectors****************************************************************
359  template< typename VT1 > // Type of the target sparse vector
360  friend inline auto assign( SparseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
362  {
364 
368 
369  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
370 
371  const ResultType tmp( serial( rhs ) );
372  assign( ~lhs, tmp );
373  }
375  //**********************************************************************************************
376 
377  //**Addition assignment to dense vectors********************************************************
393  template< typename VT1 > // Type of the target dense vector
394  friend inline auto addAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
395  -> EnableIf_t< UseAssign_v<VT1> >
396  {
398 
399  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
400 
401  if( rhs.mat_.columns() == 0UL ) {
402  return;
403  }
404 
405  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
406  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
407 
408  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
409  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
410  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
411  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
412 
413  addAssign( ~lhs, A * x );
414  }
416  //**********************************************************************************************
417 
418  //**Addition assignment to sparse vectors*******************************************************
419  // No special implementation for the addition assignment to sparse vectors.
420  //**********************************************************************************************
421 
422  //**Subtraction assignment to dense vectors*****************************************************
438  template< typename VT1 > // Type of the target dense vector
439  friend inline auto subAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
440  -> EnableIf_t< UseAssign_v<VT1> >
441  {
443 
444  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
445 
446  if( rhs.mat_.columns() == 0UL ) {
447  return;
448  }
449 
450  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
451  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
452 
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  subAssign( ~lhs, A * x );
459  }
461  //**********************************************************************************************
462 
463  //**Subtraction assignment to sparse vectors****************************************************
464  // No special implementation for the subtraction assignment to sparse vectors.
465  //**********************************************************************************************
466 
467  //**Multiplication assignment to dense vectors**************************************************
483  template< typename VT1 > // Type of the target dense vector
484  friend inline auto multAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
485  -> EnableIf_t< UseAssign_v<VT1> >
486  {
488 
492 
493  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
494 
495  const ResultType tmp( serial( rhs ) );
496  multAssign( ~lhs, tmp );
497  }
499  //**********************************************************************************************
500 
501  //**Multiplication assignment to sparse vectors*************************************************
502  // No special implementation for the multiplication assignment to sparse vectors.
503  //**********************************************************************************************
504 
505  //**Division assignment to dense vectors********************************************************
521  template< typename VT1 > // Type of the target dense vector
522  friend inline auto divAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
523  -> EnableIf_t< UseAssign_v<VT1> >
524  {
526 
530 
531  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
532 
533  const ResultType tmp( serial( rhs ) );
534  divAssign( ~lhs, tmp );
535  }
537  //**********************************************************************************************
538 
539  //**Division assignment to sparse vectors*******************************************************
540  // No special implementation for the division assignment to sparse vectors.
541  //**********************************************************************************************
542 
543  //**SMP assignment to dense vectors*************************************************************
558  template< typename VT1 > // Type of the target dense vector
559  friend inline auto smpAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
560  -> EnableIf_t< UseSMPAssign_v<VT1> >
561  {
563 
564  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
565 
566  if( rhs.mat_.columns() == 0UL ) {
567  reset( ~lhs );
568  return;
569  }
570 
571  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
572  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
573 
574  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
575  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
576  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
577  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
578 
579  smpAssign( ~lhs, A * x );
580  }
582  //**********************************************************************************************
583 
584  //**SMP assignment to sparse vectors************************************************************
599  template< typename VT1 > // Type of the target sparse vector
600  friend inline auto smpAssign( SparseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
601  -> EnableIf_t< UseSMPAssign_v<VT1> >
602  {
604 
608 
609  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
610 
611  const ResultType tmp( rhs );
612  smpAssign( ~lhs, tmp );
613  }
615  //**********************************************************************************************
616 
617  //**SMP addition assignment to dense vectors****************************************************
632  template< typename VT1 > // Type of the target dense vector
633  friend inline auto smpAddAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
634  -> EnableIf_t< UseSMPAssign_v<VT1> >
635  {
637 
638  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
639 
640  if( rhs.mat_.columns() == 0UL ) {
641  return;
642  }
643 
644  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
645  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
646 
647  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
648  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
649  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
650  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
651 
652  smpAddAssign( ~lhs, A * x );
653  }
655  //**********************************************************************************************
656 
657  //**SMP addition assignment to sparse vectors***************************************************
658  // No special implementation for the SMP addition assignment to sparse vectors.
659  //**********************************************************************************************
660 
661  //**SMP subtraction assignment to dense vectors*************************************************
676  template< typename VT1 > // Type of the target dense vector
677  friend inline auto smpSubAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
678  -> EnableIf_t< UseSMPAssign_v<VT1> >
679  {
681 
682  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
683 
684  if( rhs.mat_.columns() == 0UL ) {
685  return;
686  }
687 
688  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
689  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
690 
691  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
692  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
693  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
694  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
695 
696  smpSubAssign( ~lhs, A * x );
697  }
699  //**********************************************************************************************
700 
701  //**SMP subtraction assignment to sparse vectors************************************************
702  // No special implementation for the SMP subtraction assignment to sparse vectors.
703  //**********************************************************************************************
704 
705  //**SMP multiplication assignment to dense vectors**********************************************
720  template< typename VT1 > // Type of the target dense vector
721  friend inline auto smpMultAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
722  -> EnableIf_t< UseSMPAssign_v<VT1> >
723  {
725 
729 
730  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
731 
732  const ResultType tmp( rhs );
733  smpMultAssign( ~lhs, tmp );
734  }
736  //**********************************************************************************************
737 
738  //**SMP multiplication assignment to sparse vectors*********************************************
739  // No special implementation for the SMP multiplication assignment to sparse vectors.
740  //**********************************************************************************************
741 
742  //**SMP division assignment to dense vectors****************************************************
757  template< typename VT1 > // Type of the target dense vector
758  friend inline auto smpDivAssign( DenseVector<VT1,false>& lhs, const SMatDVecMultExpr& rhs )
759  -> EnableIf_t< UseSMPAssign_v<VT1> >
760  {
762 
766 
767  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
768 
769  const ResultType tmp( rhs );
770  smpDivAssign( ~lhs, tmp );
771  }
773  //**********************************************************************************************
774 
775  //**SMP division assignment to sparse vectors***************************************************
776  // No special implementation for the SMP division assignment to sparse vectors.
777  //**********************************************************************************************
778 
779  //**Compile time checks*************************************************************************
788  //**********************************************************************************************
789 };
790 //*************************************************************************************************
791 
792 
793 
794 
795 //=================================================================================================
796 //
797 // GLOBAL BINARY ARITHMETIC OPERATORS
798 //
799 //=================================================================================================
800 
801 //*************************************************************************************************
814 template< typename MT // Type of the left-hand side sparse matrix
815  , typename VT // Type of the right-hand side dense vector
816  , DisableIf_t< ( IsIdentity_v<MT> &&
817  IsSame_v< ElementType_t<MT>, ElementType_t<VT> > ) ||
818  IsZero_v<MT> >* = nullptr >
819 inline const SMatDVecMultExpr<MT,VT>
820  smatdvecmult( const SparseMatrix<MT,false>& mat, const DenseVector<VT,false>& vec )
821 {
823 
824  BLAZE_INTERNAL_ASSERT( (~mat).columns() == (~vec).size(), "Invalid matrix and vector sizes" );
825 
826  return SMatDVecMultExpr<MT,VT>( ~mat, ~vec );
827 }
829 //*************************************************************************************************
830 
831 
832 //*************************************************************************************************
846 template< typename MT // Type of the left-hand side sparse matrix
847  , typename VT // Type of the right-hand side dense vector
848  , EnableIf_t< IsIdentity_v<MT> &&
849  IsSame_v< ElementType_t<MT>, ElementType_t<VT> > >* = nullptr >
850 inline const VT&
851  smatdvecmult( const SparseMatrix<MT,false>& mat, const DenseVector<VT,false>& vec )
852 {
854 
855  UNUSED_PARAMETER( mat );
856 
857  BLAZE_INTERNAL_ASSERT( (~mat).columns() == (~vec).size(), "Invalid matrix and vector sizes" );
858 
859  return (~vec);
860 }
862 //*************************************************************************************************
863 
864 
865 //*************************************************************************************************
878 template< typename MT // Type of the left-hand side sparse matrix
879  , typename VT // Type of the right-hand side dense vector
880  , EnableIf_t< IsZero_v<MT> >* = nullptr >
881 inline decltype(auto)
882  smatdvecmult( const SparseMatrix<MT,false>& mat, const DenseVector<VT,false>& vec )
883 {
885 
886  UNUSED_PARAMETER( vec );
887 
888  BLAZE_INTERNAL_ASSERT( (~mat).columns() == (~vec).size(), "Invalid matrix and vector sizes" );
889 
890  using ReturnType = const MultTrait_t< ResultType_t<MT>, ResultType_t<VT> >;
891 
894 
895  return ReturnType( (~mat).rows() );
896 }
898 //*************************************************************************************************
899 
900 
901 //*************************************************************************************************
932 template< typename MT // Type of the left-hand side sparse matrix
933  , typename VT > // Type of the right-hand side dense vector
934 inline decltype(auto)
935  operator*( const SparseMatrix<MT,false>& mat, const DenseVector<VT,false>& vec )
936 {
938 
940 
941  if( (~mat).columns() != (~vec).size() ) {
942  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
943  }
944 
945  return smatdvecmult( ~mat, ~vec );
946 }
947 //*************************************************************************************************
948 
949 
950 
951 
952 //=================================================================================================
953 //
954 // ISALIGNED SPECIALIZATIONS
955 //
956 //=================================================================================================
957 
958 //*************************************************************************************************
960 template< typename MT, typename VT >
961 struct IsAligned< SMatDVecMultExpr<MT,VT> >
962  : public IsAligned<VT>
963 {};
965 //*************************************************************************************************
966 
967 } // namespace blaze
968 
969 #endif
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatDVecMultExpr.h:151
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the UNUSED_PARAMETER function template.
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
MultTrait_t< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: SMatDVecMultExpr.h:150
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: SMatDVecMultExpr.h:173
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
#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:61
Header file for the serial shim.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:224
Expression object for sparse matrix-dense vector multiplications.The SMatDVecMultExpr class represent...
Definition: Forward.h:118
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SMatDVecMultExpr.h:213
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Constraint on the data type.
Header file for the DenseVector base class.
Header file for the IsIdentity type trait.
ResultType_t< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:100
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatDVecMultExpr.h:258
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SMatDVecMultExpr.h:226
Header file for the Computation base class.
Header file for the reset shim.
SMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the SMatDVecMultExpr class.
Definition: SMatDVecMultExpr.h:186
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
const ElementType ReturnType
Return type for expression template evaluations.
Definition: SMatDVecMultExpr.h:153
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:137
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SMatDVecMultExpr.h:200
Constraint on the transpose flag of vector types.
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:108
Header file for the DisableIf class template.
Header file for the multiplication trait.
If_t< useAssign, const ResultType, const SMatDVecMultExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatDVecMultExpr.h:156
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatDVecMultExpr.h:270
Header file for the If class template.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: SMatDVecMultExpr.h:280
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is not a zero vector or matrix type...
Definition: Zero.h:61
If_t< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: SMatDVecMultExpr.h:165
static constexpr bool evaluateVector
Compilation switch for the composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:113
RightOperand vec_
Right-hand side dense vector of the multiplication expression.
Definition: SMatDVecMultExpr.h:298
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatDVecMultExpr.h:297
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
ResultType_t< VT > VRT
Result type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:101
Header file for the IsAligned type trait.
#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:83
static constexpr bool useAssign
Compilation switch for the evaluation strategy of the multiplication expression.
Definition: SMatDVecMultExpr.h:124
If_t< IsExpression_v< VT >, const VT, const VT &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:162
#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:104
Constraint on the data type.
Header file for the exception macros of the math module.
CompositeType_t< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:102
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatDVecMultExpr.h:290
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatDVecMultExpr.h:152
#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:61
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatDVecMultExpr.h:236
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: SMatDVecMultExpr.h:246
CompositeType_t< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition: SMatDVecMultExpr.h:103
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatDVecMultExpr.h:176
Header file for the IsZero type trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#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:61
Header file for the IsComputation type trait class.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
If_t< IsExpression_v< MT >, const MT, const MT &> LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: SMatDVecMultExpr.h:159
Constraint on the data type.
Header file for the MatVecMultExpr base class.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is a zero vector or matrix type...
Definition: Zero.h:81
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
If_t< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side dense matrix operand.
Definition: SMatDVecMultExpr.h:168
#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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
#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:61
Header file for the IsExpression type trait class.
Header file for the function trace functionality.