TSMatDVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATDVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATDVECMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
53 #include <blaze/math/Exception.h>
59 #include <blaze/math/shims/Reset.h>
76 #include <blaze/util/Assert.h>
77 #include <blaze/util/DisableIf.h>
78 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/mpl/If.h>
82 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS TSMATDVECMULTEXPR
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
101 template< typename MT // Type of the left-hand side sparse matrix
102  , typename VT > // Type of the right-hand side dense vector
103 class TSMatDVecMultExpr
104  : public MatVecMultExpr< DenseVector< TSMatDVecMultExpr<MT,VT>, false > >
105  , private Computation
106 {
107  private:
108  //**Type definitions****************************************************************************
113  //**********************************************************************************************
114 
115  //**********************************************************************************************
117  enum : bool { evaluateMatrix = RequiresEvaluation<MT>::value };
118  //**********************************************************************************************
119 
120  //**********************************************************************************************
122  enum : bool { evaluateVector = IsComputation<VT>::value || RequiresEvaluation<VT>::value };
123  //**********************************************************************************************
124 
125  //**********************************************************************************************
127 
131  template< typename T1 >
132  struct UseSMPAssign {
133  enum : bool { value = ( evaluateMatrix || evaluateVector ) };
134  };
136  //**********************************************************************************************
137 
138  public:
139  //**Type definitions****************************************************************************
144  using ReturnType = const ElementType;
145  using CompositeType = const ResultType;
146 
148  using LeftOperand = If_< IsExpression<MT>, const MT, const MT& >;
149 
151  using RightOperand = If_< IsExpression<VT>, const VT, const VT& >;
152 
155 
158  //**********************************************************************************************
159 
160  //**Compilation flags***************************************************************************
162  enum : bool { simdEnabled = false };
163 
165  enum : bool { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
166  !evaluateVector && VT::smpAssignable };
167  //**********************************************************************************************
168 
169  //**Constructor*********************************************************************************
175  explicit inline TSMatDVecMultExpr( const MT& mat, const VT& vec ) noexcept
176  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
177  , vec_( vec ) // Right-hand side dense vector of the multiplication expression
178  {
179  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
180  }
181  //**********************************************************************************************
182 
183  //**Subscript operator**************************************************************************
189  inline ReturnType operator[]( size_t index ) const {
190  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
191 
193  {
194  return mat_(index,index) * vec_[index];
195  }
196  else if( IsLower<MT>::value )
197  {
198  const size_t n( IsStrictlyLower<MT>::value ? index : index+1UL );
199  return subvector( row( mat_, index ), 0UL, n ) * subvector( vec_, 0UL, n );
200  }
201  else if( IsUpper<MT>::value )
202  {
203  const size_t begin( IsStrictlyUpper<MT>::value ? index+1UL : index );
204  const size_t n ( mat_.columns() - begin );
205  return subvector( row( mat_, index ), begin, n ) * subvector( vec_, begin, n );
206  }
207  else
208  {
209  return row( mat_, index ) * vec_;
210  }
211  }
212  //**********************************************************************************************
213 
214  //**At function*********************************************************************************
221  inline ReturnType at( size_t index ) const {
222  if( index >= mat_.rows() ) {
223  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
224  }
225  return (*this)[index];
226  }
227  //**********************************************************************************************
228 
229  //**Size function*******************************************************************************
234  inline size_t size() const noexcept {
235  return mat_.rows();
236  }
237  //**********************************************************************************************
238 
239  //**Left operand access*************************************************************************
244  inline LeftOperand leftOperand() const noexcept {
245  return mat_;
246  }
247  //**********************************************************************************************
248 
249  //**Right operand access************************************************************************
254  inline RightOperand rightOperand() const noexcept {
255  return vec_;
256  }
257  //**********************************************************************************************
258 
259  //**********************************************************************************************
265  template< typename T >
266  inline bool canAlias( const T* alias ) const noexcept {
267  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
268  }
269  //**********************************************************************************************
270 
271  //**********************************************************************************************
277  template< typename T >
278  inline bool isAliased( const T* alias ) const noexcept {
279  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
280  }
281  //**********************************************************************************************
282 
283  //**********************************************************************************************
288  inline bool isAligned() const noexcept {
289  return vec_.isAligned();
290  }
291  //**********************************************************************************************
292 
293  //**********************************************************************************************
298  inline bool canSMPAssign() const noexcept {
299  return ( size() > SMP_TSMATDVECMULT_THRESHOLD );
300  }
301  //**********************************************************************************************
302 
303  private:
304  //**Member variables****************************************************************************
307  //**********************************************************************************************
308 
309  //**Assignment to dense vectors*****************************************************************
322  template< typename VT2 > // Type of the target dense vector
323  friend inline void assign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
324  {
326 
327  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
328 
329  reset( ~lhs );
330 
331  if( rhs.mat_.columns() == 0UL ) return;
332 
333  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
334  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
335 
336  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
337  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
338  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
339  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
340 
341  TSMatDVecMultExpr::selectAssignKernel( ~lhs, A, x );
342  }
344  //**********************************************************************************************
345 
346  //**Optimized assignment to dense vectors*******************************************************
360  template< typename VT1 // Type of the left-hand side target vector
361  , typename MT1 // Type of the left-hand side matrix operand
362  , typename VT2 > // Type of the right-hand side vector operand
363  static inline void selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
364  {
366 
367  for( size_t j=0UL; j<A.columns(); ++j )
368  {
369  ConstIterator element( A.begin(j) );
370  const ConstIterator end( A.end(j) );
371 
372  for( ; element!=end; ++element ) {
373  if( IsResizable< ElementType_<VT1> >::value &&
374  isDefault( y[element->index()] ) )
375  y[element->index()] = element->value() * x[j];
376  else
377  y[element->index()] += element->value() * x[j];
378  }
379  }
380  }
382  //**********************************************************************************************
383 
384  //**Assignment to sparse vectors****************************************************************
397  template< typename VT2 > // Type of the target sparse vector
398  friend inline void assign( SparseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
399  {
401 
405 
406  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
407 
408  const ResultType tmp( serial( rhs ) );
409  assign( ~lhs, tmp );
410  }
412  //**********************************************************************************************
413 
414  //**Addition assignment to dense vectors********************************************************
427  template< typename VT2 > // Type of the target dense vector
428  friend inline void addAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
429  {
431 
432  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
433 
434  if( rhs.mat_.columns() == 0UL ) return;
435 
436  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
437  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
438 
439  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
440  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
441  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
442  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
443 
444  TSMatDVecMultExpr::selectAddAssignKernel( ~lhs, A, x );
445  }
447  //**********************************************************************************************
448 
449  //**Optimized addition assignment to dense vectors**********************************************
463  template< typename VT1 // Type of the left-hand side target vector
464  , typename MT1 // Type of the left-hand side matrix operand
465  , typename VT2 > // Type of the right-hand side vector operand
466  static inline void selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
467  {
469 
470  for( size_t j=0UL; j<A.columns(); ++j )
471  {
472  ConstIterator element( A.begin(j) );
473  const ConstIterator end( A.end(j) );
474 
475  for( ; element!=end; ++element ) {
476  y[element->index()] += element->value() * x[j];
477  }
478  }
479  }
481  //**********************************************************************************************
482 
483  //**Addition assignment to sparse vectors*******************************************************
484  // No special implementation for the addition assignment to sparse vectors.
485  //**********************************************************************************************
486 
487  //**Subtraction assignment to dense vectors*****************************************************
500  template< typename VT2 > // Type of the target dense vector
501  friend inline void subAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
502  {
504 
505  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
506 
507  if( rhs.mat_.columns() == 0UL ) return;
508 
509  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
510  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
511 
512  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
513  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
514  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
515  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
516 
517  TSMatDVecMultExpr::selectSubAssignKernel( ~lhs, A, x );
518  }
520  //**********************************************************************************************
521 
522  //**Optimized subtraction assignment to dense vectors*******************************************
536  template< typename VT1 // Type of the left-hand side target vector
537  , typename MT1 // Type of the left-hand side matrix operand
538  , typename VT2 > // Type of the right-hand side vector operand
539  static inline void selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
540  {
542 
543  for( size_t j=0UL; j<A.columns(); ++j )
544  {
545  ConstIterator element( A.begin(j) );
546  const ConstIterator end( A.end(j) );
547 
548  for( ; element!=end; ++element ) {
549  y[element->index()] -= element->value() * x[j];
550  }
551  }
552  }
554  //**********************************************************************************************
555 
556  //**Subtraction assignment to sparse vectors****************************************************
557  // No special implementation for the subtraction assignment to sparse vectors.
558  //**********************************************************************************************
559 
560  //**Multiplication assignment to dense vectors**************************************************
573  template< typename VT2 > // Type of the target dense vector
574  friend inline void multAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
575  {
577 
581 
582  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
583 
584  const ResultType tmp( serial( rhs ) );
585  multAssign( ~lhs, tmp );
586  }
588  //**********************************************************************************************
589 
590  //**Multiplication assignment to sparse vectors*************************************************
591  // No special implementation for the multiplication assignment to sparse vectors.
592  //**********************************************************************************************
593 
594  //**Division assignment to dense vectors********************************************************
607  template< typename VT2 > // Type of the target dense vector
608  friend inline void divAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
609  {
611 
615 
616  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
617 
618  const ResultType tmp( serial( rhs ) );
619  divAssign( ~lhs, tmp );
620  }
622  //**********************************************************************************************
623 
624  //**Division assignment to sparse vectors*******************************************************
625  // No special implementation for the division assignment to sparse vectors.
626  //**********************************************************************************************
627 
628  //**SMP assignment to dense vectors*************************************************************
643  template< typename VT2 > // Type of the target dense vector
644  friend inline EnableIf_< UseSMPAssign<VT2> >
646  {
648 
649  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
650 
651  reset( ~lhs );
652 
653  if( rhs.mat_.columns() == 0UL ) return;
654 
655  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
656  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
657 
658  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
659  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
660  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
661  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
662 
663  smpAssign( ~lhs, A * x );
664  }
666  //**********************************************************************************************
667 
668  //**SMP assignment to sparse vectors************************************************************
683  template< typename VT2 > // Type of the target sparse vector
684  friend inline EnableIf_< UseSMPAssign<VT2> >
686  {
688 
692 
693  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
694 
695  const ResultType tmp( rhs );
696  smpAssign( ~lhs, tmp );
697  }
699  //**********************************************************************************************
700 
701  //**SMP addition assignment to dense vectors****************************************************
716  template< typename VT2 > // Type of the target dense vector
717  friend inline EnableIf_< UseSMPAssign<VT2> >
719  {
721 
722  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
723 
724  if( rhs.mat_.columns() == 0UL ) return;
725 
726  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
727  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
728 
729  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
730  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
731  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
732  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
733 
734  smpAddAssign( ~lhs, A * x );
735  }
737  //**********************************************************************************************
738 
739  //**SMP addition assignment to sparse vectors***************************************************
740  // No special implementation for the SMP addition assignment to sparse vectors.
741  //**********************************************************************************************
742 
743  //**SMP subtraction assignment to dense vectors*************************************************
758  template< typename VT2 > // Type of the target dense vector
759  friend inline EnableIf_< UseSMPAssign<VT2> >
761  {
763 
764  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
765 
766  if( rhs.mat_.columns() == 0UL ) return;
767 
768  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
769  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
770 
771  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
772  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
773  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
774  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
775 
776  smpSubAssign( ~lhs, A * x );
777  }
779  //**********************************************************************************************
780 
781  //**SMP subtraction assignment to sparse vectors************************************************
782  // No special implementation for the SMP subtraction assignment to sparse vectors.
783  //**********************************************************************************************
784 
785  //**SMP multiplication assignment to dense vectors**********************************************
800  template< typename VT2 > // Type of the target dense vector
801  friend inline EnableIf_< UseSMPAssign<VT2> >
803  {
805 
809 
810  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
811 
812  const ResultType tmp( rhs );
813  smpMultAssign( ~lhs, tmp );
814  }
816  //**********************************************************************************************
817 
818  //**SMP multiplication assignment to sparse vectors*********************************************
819  // No special implementation for the SMP multiplication assignment to sparse vectors.
820  //**********************************************************************************************
821 
822  //**SMP division assignment to dense vectors****************************************************
837  template< typename VT2 > // Type of the target dense vector
838  friend inline EnableIf_< UseSMPAssign<VT2> >
840  {
842 
846 
847  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
848 
849  const ResultType tmp( rhs );
850  smpDivAssign( ~lhs, tmp );
851  }
853  //**********************************************************************************************
854 
855  //**SMP division assignment to sparse vectors***************************************************
856  // No special implementation for the SMP division assignment to sparse vectors.
857  //**********************************************************************************************
858 
859  //**Compile time checks*************************************************************************
868  //**********************************************************************************************
869 };
870 //*************************************************************************************************
871 
872 
873 
874 
875 //=================================================================================================
876 //
877 // GLOBAL BINARY ARITHMETIC OPERATORS
878 //
879 //=================================================================================================
880 
881 //*************************************************************************************************
895 template< typename MT // Type of the left-hand side sparse matrix
896  , typename VT // Type of the right-hand side dense vector
897  , typename = DisableIf_< IsSymmetric<MT> > >
898 inline const TSMatDVecMultExpr<MT,VT>
899  tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
900 {
902 
903  BLAZE_INTERNAL_ASSERT( (~mat).columns() == (~vec).size(), "Invalid matrix and vector sizes" );
904 
905  return TSMatDVecMultExpr<MT,VT>( ~mat, ~vec );
906 }
908 //*************************************************************************************************
909 
910 
911 //*************************************************************************************************
925 template< typename MT // Type of the left-hand side sparse matrix
926  , typename VT // Type of the right-hand side dense vector
927  , typename = EnableIf_< IsSymmetric<MT> > >
928 inline decltype(auto)
929  tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
930 {
932 
933  BLAZE_INTERNAL_ASSERT( (~mat).columns() == (~vec).size(), "Invalid matrix and vector sizes" );
934 
935  return trans( ~mat ) * (~vec);
936 }
938 //*************************************************************************************************
939 
940 
941 //*************************************************************************************************
972 template< typename MT // Type of the left-hand side sparse matrix
973  , typename VT > // Type of the right-hand side dense vector
974 inline decltype(auto)
975  operator*( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
976 {
978 
980 
981  if( (~mat).columns() != (~vec).size() ) {
982  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
983  }
984 
985  return tsmatdvecmult( ~mat, ~vec );
986 }
987 //*************************************************************************************************
988 
989 
990 
991 
992 //=================================================================================================
993 //
994 // SIZE SPECIALIZATIONS
995 //
996 //=================================================================================================
997 
998 //*************************************************************************************************
1000 template< typename MT, typename VT >
1001 struct Size< TSMatDVecMultExpr<MT,VT> >
1002  : public Rows<MT>
1003 {};
1005 //*************************************************************************************************
1006 
1007 
1008 
1009 
1010 //=================================================================================================
1011 //
1012 // ISALIGNED SPECIALIZATIONS
1013 //
1014 //=================================================================================================
1015 
1016 //*************************************************************************************************
1018 template< typename MT, typename VT >
1019 struct IsAligned< TSMatDVecMultExpr<MT,VT> >
1020  : public BoolConstant< IsAligned<VT>::value >
1021 {};
1023 //*************************************************************************************************
1024 
1025 } // namespace blaze
1026 
1027 #endif
#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
MultTrait_< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:141
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatDVecMultExpr.h:305
Header file for auxiliary alias declarations.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
Expression object for transpose sparse matrix-dense vector multiplications.The TSMatDVecMultExpr clas...
Definition: Forward.h:163
Header file for the Rows type trait.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatDVecMultExpr.h:278
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatDVecMultExpr.h:244
Header file for basic type definitions.
Subvector< VT, AF > subvector(Vector< VT, TF > &vector, size_t index, size_t size)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:322
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSMatDVecMultExpr.h:189
#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
EnableIf_< IsDenseMatrix< MT1 > > 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:164
Header file for the serial shim.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:142
Header file for the IsDiagonal type trait.
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSMatDVecMultExpr.h:221
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatDVecMultExpr.h:298
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
EnableIf_< IsDenseVector< VT1 > > 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:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
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:88
IfTrue_< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side dense vector operand.
Definition: TSMatDVecMultExpr.h:157
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSMatDVecMultExpr.h:234
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
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:88
Header file for the RequiresEvaluation type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
EnableIf_< IsDenseMatrix< MT1 > > 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:133
CompositeType_< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:111
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
Constraint on the transpose flag of vector types.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
Constraint on the data type.
RightOperand vec_
Right-hand side dense vector of the multiplication expression.
Definition: TSMatDVecMultExpr.h:306
Constraint on the data type.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TSMatDVecMultExpr.h:288
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
EnableIf_< IsDenseMatrix< MT1 > > 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:102
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
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.
Header file for the IsAligned type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:90
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:340
#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:88
#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:109
Constraint on the data type.
Header file for the exception macros of the math module.
ResultType_< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:109
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
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:264
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
ElementType_< ResultType > ElementType
Resulting element type.
Definition: TSMatDVecMultExpr.h:143
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatDVecMultExpr.h:145
#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:79
If_< IsExpression< MT >, const MT, const MT &> LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:148
Header file for run time assertion macros.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: TSMatDVecMultExpr.h:254
Header file for the reset shim.
#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
IfTrue_< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: TSMatDVecMultExpr.h:154
Header file for the isDefault shim.
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
If_< IsExpression< VT >, const VT, const VT &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:151
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatDVecMultExpr.h:266
TSMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TSMatDVecMultExpr class.
Definition: TSMatDVecMultExpr.h:175
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#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
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
CompositeType_< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:112
Header file for the IsComputation type trait class.
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:74
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:144
Header file for the IntegralConstant class template.
ResultType_< VT > VRT
Result type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:110
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:75
Constraint on the data type.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
Header file for the IsUpper type trait.
Header file for the MatVecMultExpr base class.
Constraint on the data type.
Header file for the IsResizable type trait.
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
#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.