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>
74 #include <blaze/math/views/Check.h>
76 #include <blaze/util/Assert.h>
77 #include <blaze/util/DisableIf.h>
78 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/mpl/If.h>
81 #include <blaze/util/Types.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS TSMATDVECMULTEXPR
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
100 template< typename MT // Type of the left-hand side sparse matrix
101  , typename VT > // Type of the right-hand side dense vector
102 class TSMatDVecMultExpr
103  : public MatVecMultExpr< DenseVector< TSMatDVecMultExpr<MT,VT>, false > >
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
112  //**********************************************************************************************
113 
114  //**********************************************************************************************
116  enum : bool { evaluateMatrix = RequiresEvaluation<MT>::value };
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
121  enum : bool { evaluateVector = IsComputation<VT>::value || RequiresEvaluation<VT>::value };
122  //**********************************************************************************************
123 
124  //**********************************************************************************************
126 
130  template< typename T1 >
131  struct UseSMPAssign {
132  enum : bool { value = ( evaluateMatrix || evaluateVector ) };
133  };
135  //**********************************************************************************************
136 
137  public:
138  //**Type definitions****************************************************************************
143  using ReturnType = const ElementType;
144  using CompositeType = const ResultType;
145 
147  using LeftOperand = If_< IsExpression<MT>, const MT, const MT& >;
148 
150  using RightOperand = If_< IsExpression<VT>, const VT, const VT& >;
151 
154 
157  //**********************************************************************************************
158 
159  //**Compilation flags***************************************************************************
161  enum : bool { simdEnabled = false };
162 
164  enum : bool { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
165  !evaluateVector && VT::smpAssignable };
166  //**********************************************************************************************
167 
168  //**Constructor*********************************************************************************
174  explicit inline TSMatDVecMultExpr( const MT& mat, const VT& vec ) noexcept
175  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
176  , vec_( vec ) // Right-hand side dense vector of the multiplication expression
177  {
178  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
179  }
180  //**********************************************************************************************
181 
182  //**Subscript operator**************************************************************************
188  inline ReturnType operator[]( size_t index ) const {
189  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
190 
192  {
193  return mat_(index,index) * vec_[index];
194  }
195  else if( IsLower<MT>::value )
196  {
197  const size_t n( IsStrictlyLower<MT>::value ? index : index+1UL );
198  return subvector( row( mat_, index, unchecked ), 0UL, n, unchecked ) *
199  subvector( vec_, 0UL, n, unchecked );
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, unchecked ), begin, n, unchecked ) *
206  subvector( vec_, begin, n, unchecked );
207  }
208  else
209  {
210  return row( mat_, index, unchecked ) * vec_;
211  }
212  }
213  //**********************************************************************************************
214 
215  //**At function*********************************************************************************
222  inline ReturnType at( size_t index ) const {
223  if( index >= mat_.rows() ) {
224  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
225  }
226  return (*this)[index];
227  }
228  //**********************************************************************************************
229 
230  //**Size function*******************************************************************************
235  inline size_t size() const noexcept {
236  return mat_.rows();
237  }
238  //**********************************************************************************************
239 
240  //**Left operand access*************************************************************************
245  inline LeftOperand leftOperand() const noexcept {
246  return mat_;
247  }
248  //**********************************************************************************************
249 
250  //**Right operand access************************************************************************
255  inline RightOperand rightOperand() const noexcept {
256  return vec_;
257  }
258  //**********************************************************************************************
259 
260  //**********************************************************************************************
266  template< typename T >
267  inline bool canAlias( const T* alias ) const noexcept {
268  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
269  }
270  //**********************************************************************************************
271 
272  //**********************************************************************************************
278  template< typename T >
279  inline bool isAliased( const T* alias ) const noexcept {
280  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
281  }
282  //**********************************************************************************************
283 
284  //**********************************************************************************************
289  inline bool isAligned() const noexcept {
290  return vec_.isAligned();
291  }
292  //**********************************************************************************************
293 
294  //**********************************************************************************************
299  inline bool canSMPAssign() const noexcept {
300  return ( size() > SMP_TSMATDVECMULT_THRESHOLD );
301  }
302  //**********************************************************************************************
303 
304  private:
305  //**Member variables****************************************************************************
308  //**********************************************************************************************
309 
310  //**Assignment to dense vectors*****************************************************************
323  template< typename VT2 > // Type of the target dense vector
324  friend inline void assign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
325  {
327 
328  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
329 
330  reset( ~lhs );
331 
332  if( rhs.mat_.columns() == 0UL ) return;
333 
334  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
335  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
336 
337  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
338  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
339  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
340  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
341 
342  TSMatDVecMultExpr::selectAssignKernel( ~lhs, A, x );
343  }
345  //**********************************************************************************************
346 
347  //**Optimized assignment to dense vectors*******************************************************
361  template< typename VT1 // Type of the left-hand side target vector
362  , typename MT1 // Type of the left-hand side matrix operand
363  , typename VT2 > // Type of the right-hand side vector operand
364  static inline void selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
365  {
367 
368  for( size_t j=0UL; j<A.columns(); ++j )
369  {
370  ConstIterator element( A.begin(j) );
371  const ConstIterator end( A.end(j) );
372 
373  for( ; element!=end; ++element ) {
374  if( IsResizable< ElementType_<VT1> >::value &&
375  isDefault( y[element->index()] ) )
376  y[element->index()] = element->value() * x[j];
377  else
378  y[element->index()] += element->value() * x[j];
379  }
380  }
381  }
383  //**********************************************************************************************
384 
385  //**Assignment to sparse vectors****************************************************************
398  template< typename VT2 > // Type of the target sparse vector
399  friend inline void assign( SparseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
400  {
402 
406 
407  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
408 
409  const ResultType tmp( serial( rhs ) );
410  assign( ~lhs, tmp );
411  }
413  //**********************************************************************************************
414 
415  //**Addition assignment to dense vectors********************************************************
428  template< typename VT2 > // Type of the target dense vector
429  friend inline void addAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
430  {
432 
433  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
434 
435  if( rhs.mat_.columns() == 0UL ) return;
436 
437  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
438  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
439 
440  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
441  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
442  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
443  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
444 
445  TSMatDVecMultExpr::selectAddAssignKernel( ~lhs, A, x );
446  }
448  //**********************************************************************************************
449 
450  //**Optimized addition assignment to dense vectors**********************************************
464  template< typename VT1 // Type of the left-hand side target vector
465  , typename MT1 // Type of the left-hand side matrix operand
466  , typename VT2 > // Type of the right-hand side vector operand
467  static inline void selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
468  {
470 
471  for( size_t j=0UL; j<A.columns(); ++j )
472  {
473  ConstIterator element( A.begin(j) );
474  const ConstIterator end( A.end(j) );
475 
476  for( ; element!=end; ++element ) {
477  y[element->index()] += element->value() * x[j];
478  }
479  }
480  }
482  //**********************************************************************************************
483 
484  //**Addition assignment to sparse vectors*******************************************************
485  // No special implementation for the addition assignment to sparse vectors.
486  //**********************************************************************************************
487 
488  //**Subtraction assignment to dense vectors*****************************************************
501  template< typename VT2 > // Type of the target dense vector
502  friend inline void subAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
503  {
505 
506  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
507 
508  if( rhs.mat_.columns() == 0UL ) return;
509 
510  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
511  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
512 
513  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
514  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
515  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
516  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
517 
518  TSMatDVecMultExpr::selectSubAssignKernel( ~lhs, A, x );
519  }
521  //**********************************************************************************************
522 
523  //**Optimized subtraction assignment to dense vectors*******************************************
537  template< typename VT1 // Type of the left-hand side target vector
538  , typename MT1 // Type of the left-hand side matrix operand
539  , typename VT2 > // Type of the right-hand side vector operand
540  static inline void selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
541  {
543 
544  for( size_t j=0UL; j<A.columns(); ++j )
545  {
546  ConstIterator element( A.begin(j) );
547  const ConstIterator end( A.end(j) );
548 
549  for( ; element!=end; ++element ) {
550  y[element->index()] -= element->value() * x[j];
551  }
552  }
553  }
555  //**********************************************************************************************
556 
557  //**Subtraction assignment to sparse vectors****************************************************
558  // No special implementation for the subtraction assignment to sparse vectors.
559  //**********************************************************************************************
560 
561  //**Multiplication assignment to dense vectors**************************************************
574  template< typename VT2 > // Type of the target dense vector
575  friend inline void multAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
576  {
578 
582 
583  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
584 
585  const ResultType tmp( serial( rhs ) );
586  multAssign( ~lhs, tmp );
587  }
589  //**********************************************************************************************
590 
591  //**Multiplication assignment to sparse vectors*************************************************
592  // No special implementation for the multiplication assignment to sparse vectors.
593  //**********************************************************************************************
594 
595  //**Division assignment to dense vectors********************************************************
608  template< typename VT2 > // Type of the target dense vector
609  friend inline void divAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
610  {
612 
616 
617  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
618 
619  const ResultType tmp( serial( rhs ) );
620  divAssign( ~lhs, tmp );
621  }
623  //**********************************************************************************************
624 
625  //**Division assignment to sparse vectors*******************************************************
626  // No special implementation for the division assignment to sparse vectors.
627  //**********************************************************************************************
628 
629  //**SMP assignment to dense vectors*************************************************************
644  template< typename VT2 > // Type of the target dense vector
645  friend inline EnableIf_< UseSMPAssign<VT2> >
647  {
649 
650  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
651 
652  reset( ~lhs );
653 
654  if( rhs.mat_.columns() == 0UL ) return;
655 
656  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
657  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
658 
659  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
660  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
661  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
662  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
663 
664  smpAssign( ~lhs, A * x );
665  }
667  //**********************************************************************************************
668 
669  //**SMP assignment to sparse vectors************************************************************
684  template< typename VT2 > // Type of the target sparse vector
685  friend inline EnableIf_< UseSMPAssign<VT2> >
687  {
689 
693 
694  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
695 
696  const ResultType tmp( rhs );
697  smpAssign( ~lhs, tmp );
698  }
700  //**********************************************************************************************
701 
702  //**SMP addition assignment to dense vectors****************************************************
717  template< typename VT2 > // Type of the target dense vector
718  friend inline EnableIf_< UseSMPAssign<VT2> >
720  {
722 
723  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
724 
725  if( rhs.mat_.columns() == 0UL ) return;
726 
727  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
728  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
729 
730  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
731  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
732  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
733  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
734 
735  smpAddAssign( ~lhs, A * x );
736  }
738  //**********************************************************************************************
739 
740  //**SMP addition assignment to sparse vectors***************************************************
741  // No special implementation for the SMP addition assignment to sparse vectors.
742  //**********************************************************************************************
743 
744  //**SMP subtraction assignment to dense vectors*************************************************
759  template< typename VT2 > // Type of the target dense vector
760  friend inline EnableIf_< UseSMPAssign<VT2> >
762  {
764 
765  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
766 
767  if( rhs.mat_.columns() == 0UL ) return;
768 
769  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
770  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
771 
772  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
773  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
774  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
775  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
776 
777  smpSubAssign( ~lhs, A * x );
778  }
780  //**********************************************************************************************
781 
782  //**SMP subtraction assignment to sparse vectors************************************************
783  // No special implementation for the SMP subtraction assignment to sparse vectors.
784  //**********************************************************************************************
785 
786  //**SMP multiplication assignment to dense vectors**********************************************
801  template< typename VT2 > // Type of the target dense vector
802  friend inline EnableIf_< UseSMPAssign<VT2> >
804  {
806 
810 
811  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
812 
813  const ResultType tmp( rhs );
814  smpMultAssign( ~lhs, tmp );
815  }
817  //**********************************************************************************************
818 
819  //**SMP multiplication assignment to sparse vectors*********************************************
820  // No special implementation for the SMP multiplication assignment to sparse vectors.
821  //**********************************************************************************************
822 
823  //**SMP division assignment to dense vectors****************************************************
838  template< typename VT2 > // Type of the target dense vector
839  friend inline EnableIf_< UseSMPAssign<VT2> >
841  {
843 
847 
848  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
849 
850  const ResultType tmp( rhs );
851  smpDivAssign( ~lhs, tmp );
852  }
854  //**********************************************************************************************
855 
856  //**SMP division assignment to sparse vectors***************************************************
857  // No special implementation for the SMP division assignment to sparse vectors.
858  //**********************************************************************************************
859 
860  //**Compile time checks*************************************************************************
869  //**********************************************************************************************
870 };
871 //*************************************************************************************************
872 
873 
874 
875 
876 //=================================================================================================
877 //
878 // GLOBAL BINARY ARITHMETIC OPERATORS
879 //
880 //=================================================================================================
881 
882 //*************************************************************************************************
896 template< typename MT // Type of the left-hand side sparse matrix
897  , typename VT // Type of the right-hand side dense vector
898  , typename = DisableIf_< IsSymmetric<MT> > >
899 inline const TSMatDVecMultExpr<MT,VT>
900  tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
901 {
903 
904  BLAZE_INTERNAL_ASSERT( (~mat).columns() == (~vec).size(), "Invalid matrix and vector sizes" );
905 
906  return TSMatDVecMultExpr<MT,VT>( ~mat, ~vec );
907 }
909 //*************************************************************************************************
910 
911 
912 //*************************************************************************************************
926 template< typename MT // Type of the left-hand side sparse matrix
927  , typename VT // Type of the right-hand side dense vector
928  , typename = EnableIf_< IsSymmetric<MT> > >
929 inline decltype(auto)
930  tsmatdvecmult( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
931 {
933 
934  BLAZE_INTERNAL_ASSERT( (~mat).columns() == (~vec).size(), "Invalid matrix and vector sizes" );
935 
936  return trans( ~mat ) * (~vec);
937 }
939 //*************************************************************************************************
940 
941 
942 //*************************************************************************************************
973 template< typename MT // Type of the left-hand side sparse matrix
974  , typename VT > // Type of the right-hand side dense vector
975 inline decltype(auto)
976  operator*( const SparseMatrix<MT,true>& mat, const DenseVector<VT,false>& vec )
977 {
979 
981 
982  if( (~mat).columns() != (~vec).size() ) {
983  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
984  }
985 
986  return tsmatdvecmult( ~mat, ~vec );
987 }
988 //*************************************************************************************************
989 
990 
991 
992 
993 //=================================================================================================
994 //
995 // SIZE SPECIALIZATIONS
996 //
997 //=================================================================================================
998 
999 //*************************************************************************************************
1001 template< typename MT, typename VT >
1002 struct Size< TSMatDVecMultExpr<MT,VT>, 0UL >
1003  : public Size<MT,0UL>
1004 {};
1006 //*************************************************************************************************
1007 
1008 
1009 
1010 
1011 //=================================================================================================
1012 //
1013 // ISALIGNED SPECIALIZATIONS
1014 //
1015 //=================================================================================================
1016 
1017 //*************************************************************************************************
1019 template< typename MT, typename VT >
1020 struct IsAligned< TSMatDVecMultExpr<MT,VT> >
1021  : public IsAligned<VT>
1022 {};
1024 //*************************************************************************************************
1025 
1026 } // namespace blaze
1027 
1028 #endif
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:329
#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:140
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatDVecMultExpr.h:306
Header file for auxiliary alias declarations.
Header file for the blaze::checked and blaze::unchecked instances.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:71
Expression object for transpose sparse matrix-dense vector multiplications.The TSMatDVecMultExpr clas...
Definition: Forward.h:163
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatDVecMultExpr.h:279
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatDVecMultExpr.h:245
Header file for basic type definitions.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSMatDVecMultExpr.h:188
#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:141
Header file for the IsDiagonal type trait.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSMatDVecMultExpr.h:222
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatDVecMultExpr.h:299
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:364
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
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:87
IfTrue_< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side dense vector operand.
Definition: TSMatDVecMultExpr.h:156
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSMatDVecMultExpr.h:235
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
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:87
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:110
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.
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:307
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:71
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:289
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
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:3085
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:76
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:89
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
#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:87
#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:108
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:108
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:430
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:142
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:144
#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:147
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
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
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:255
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:153
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:816
#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:150
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatDVecMultExpr.h:267
TSMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TSMatDVecMultExpr class.
Definition: TSMatDVecMultExpr.h:174
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:789
CompositeType_< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:111
Header file for the IsComputation type trait class.
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
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:143
ResultType_< VT > VRT
Result type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:109
Constraint on the data type.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
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.