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>
51 #include <blaze/math/Exception.h>
57 #include <blaze/math/shims/Reset.h>
78 #include <blaze/util/Assert.h>
80 #include <blaze/util/DisableIf.h>
81 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/mpl/Or.h>
85 #include <blaze/util/mpl/If.h>
86 #include <blaze/util/Types.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // CLASS TSMATDVECMULTEXPR
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
105 template< typename MT // Type of the left-hand side sparse matrix
106  , typename VT > // Type of the right-hand side dense vector
107 class TSMatDVecMultExpr : public DenseVector< TSMatDVecMultExpr<MT,VT>, false >
108  , private MatVecMultExpr
109  , private Computation
110 {
111  private:
112  //**Type definitions****************************************************************************
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
121  enum : bool { evaluateMatrix = RequiresEvaluation<MT>::value };
122  //**********************************************************************************************
123 
124  //**********************************************************************************************
126  enum : bool { evaluateVector = IsComputation<VT>::value || RequiresEvaluation<VT>::value };
127  //**********************************************************************************************
128 
129  //**********************************************************************************************
131 
135  template< typename T1 >
136  struct UseSMPAssign {
137  enum : bool { value = ( evaluateMatrix || evaluateVector ) };
138  };
140  //**********************************************************************************************
141 
142  public:
143  //**Type definitions****************************************************************************
148  typedef const ElementType ReturnType;
149  typedef const ResultType CompositeType;
150 
152  typedef If_< IsExpression<MT>, const MT, const MT& > LeftOperand;
153 
155  typedef If_< IsExpression<VT>, const VT, const VT& > RightOperand;
156 
159 
162  //**********************************************************************************************
163 
164  //**Compilation flags***************************************************************************
166  enum : bool { simdEnabled = false };
167 
169  enum : bool { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
170  !evaluateVector && VT::smpAssignable };
171  //**********************************************************************************************
172 
173  //**Constructor*********************************************************************************
179  explicit inline TSMatDVecMultExpr( const MT& mat, const VT& vec ) noexcept
180  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
181  , vec_( vec ) // Right-hand side dense vector of the multiplication expression
182  {
183  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
184  }
185  //**********************************************************************************************
186 
187  //**Subscript operator**************************************************************************
193  inline ReturnType operator[]( size_t index ) const {
194  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
195 
197  {
198  return mat_(index,index) * vec_[index];
199  }
200  else if( IsLower<MT>::value )
201  {
202  const size_t n( IsStrictlyLower<MT>::value ? index : index+1UL );
203  return subvector( row( mat_, index ), 0UL, n ) * subvector( vec_, 0UL, n );
204  }
205  else if( IsUpper<MT>::value )
206  {
207  const size_t begin( IsStrictlyUpper<MT>::value ? index+1UL : index );
208  const size_t n ( mat_.columns() - begin );
209  return subvector( row( mat_, index ), begin, n ) * subvector( vec_, begin, n );
210  }
211  else
212  {
213  return row( mat_, index ) * vec_;
214  }
215  }
216  //**********************************************************************************************
217 
218  //**At function*********************************************************************************
225  inline ReturnType at( size_t index ) const {
226  if( index >= mat_.rows() ) {
227  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
228  }
229  return (*this)[index];
230  }
231  //**********************************************************************************************
232 
233  //**Size function*******************************************************************************
238  inline size_t size() const noexcept {
239  return mat_.rows();
240  }
241  //**********************************************************************************************
242 
243  //**Left operand access*************************************************************************
248  inline LeftOperand leftOperand() const noexcept {
249  return mat_;
250  }
251  //**********************************************************************************************
252 
253  //**Right operand access************************************************************************
258  inline RightOperand rightOperand() const noexcept {
259  return vec_;
260  }
261  //**********************************************************************************************
262 
263  //**********************************************************************************************
269  template< typename T >
270  inline bool canAlias( const T* alias ) const noexcept {
271  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
272  }
273  //**********************************************************************************************
274 
275  //**********************************************************************************************
281  template< typename T >
282  inline bool isAliased( const T* alias ) const noexcept {
283  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
284  }
285  //**********************************************************************************************
286 
287  //**********************************************************************************************
292  inline bool isAligned() const noexcept {
293  return vec_.isAligned();
294  }
295  //**********************************************************************************************
296 
297  //**********************************************************************************************
302  inline bool canSMPAssign() const noexcept {
303  return ( size() > SMP_TSMATDVECMULT_THRESHOLD );
304  }
305  //**********************************************************************************************
306 
307  private:
308  //**Member variables****************************************************************************
309  LeftOperand mat_;
310  RightOperand vec_;
311  //**********************************************************************************************
312 
313  //**Assignment to dense vectors*****************************************************************
326  template< typename VT2 > // Type of the target dense vector
327  friend inline void assign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
328  {
330 
331  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
332 
333  reset( ~lhs );
334 
335  if( rhs.mat_.columns() == 0UL ) return;
336 
337  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
338  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
339 
340  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
341  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
342  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
343  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
344 
345  TSMatDVecMultExpr::selectAssignKernel( ~lhs, A, x );
346  }
348  //**********************************************************************************************
349 
350  //**Optimized assignment to dense vectors*******************************************************
364  template< typename VT1 // Type of the left-hand side target vector
365  , typename MT1 // Type of the left-hand side matrix operand
366  , typename VT2 > // Type of the right-hand side vector operand
367  static inline void selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
368  {
370 
371  for( size_t j=0UL; j<A.columns(); ++j )
372  {
373  ConstIterator element( A.begin(j) );
374  const ConstIterator end( A.end(j) );
375 
376  for( ; element!=end; ++element ) {
377  if( IsResizable< ElementType_<VT1> >::value &&
378  isDefault( y[element->index()] ) )
379  y[element->index()] = element->value() * x[j];
380  else
381  y[element->index()] += element->value() * x[j];
382  }
383  }
384  }
386  //**********************************************************************************************
387 
388  //**Assignment to sparse vectors****************************************************************
401  template< typename VT2 > // Type of the target sparse vector
402  friend inline void assign( SparseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
403  {
405 
408  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
409 
410  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
411 
412  const ResultType tmp( serial( rhs ) );
413  assign( ~lhs, tmp );
414  }
416  //**********************************************************************************************
417 
418  //**Addition assignment to dense vectors********************************************************
431  template< typename VT2 > // Type of the target dense vector
432  friend inline void addAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
433  {
435 
436  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
437 
438  if( rhs.mat_.columns() == 0UL ) return;
439 
440  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
441  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
442 
443  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
444  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
445  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
446  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
447 
448  TSMatDVecMultExpr::selectAddAssignKernel( ~lhs, A, x );
449  }
451  //**********************************************************************************************
452 
453  //**Optimized addition assignment to dense vectors**********************************************
467  template< typename VT1 // Type of the left-hand side target vector
468  , typename MT1 // Type of the left-hand side matrix operand
469  , typename VT2 > // Type of the right-hand side vector operand
470  static inline void selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
471  {
472  typedef ConstIterator_< RemoveReference_<MT1> > ConstIterator;
473 
474  for( size_t j=0UL; j<A.columns(); ++j )
475  {
476  ConstIterator element( A.begin(j) );
477  const ConstIterator end( A.end(j) );
478 
479  for( ; element!=end; ++element ) {
480  y[element->index()] += element->value() * x[j];
481  }
482  }
483  }
485  //**********************************************************************************************
486 
487  //**Addition assignment to sparse vectors*******************************************************
488  // No special implementation for the addition assignment to sparse vectors.
489  //**********************************************************************************************
490 
491  //**Subtraction assignment to dense vectors*****************************************************
504  template< typename VT2 > // Type of the target dense vector
505  friend inline void subAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
506  {
508 
509  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
510 
511  if( rhs.mat_.columns() == 0UL ) return;
512 
513  LT A( serial( rhs.mat_ ) ); // Evaluation of the left-hand side sparse matrix operand
514  RT x( serial( rhs.vec_ ) ); // Evaluation of the right-hand side dense vector operand
515 
516  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
517  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
518  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
519  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
520 
521  TSMatDVecMultExpr::selectSubAssignKernel( ~lhs, A, x );
522  }
524  //**********************************************************************************************
525 
526  //**Optimized subtraction assignment to dense vectors*******************************************
540  template< typename VT1 // Type of the left-hand side target vector
541  , typename MT1 // Type of the left-hand side matrix operand
542  , typename VT2 > // Type of the right-hand side vector operand
543  static inline void selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
544  {
545  typedef ConstIterator_< RemoveReference_<MT1> > ConstIterator;
546 
547  for( size_t j=0UL; j<A.columns(); ++j )
548  {
549  ConstIterator element( A.begin(j) );
550  const ConstIterator end( A.end(j) );
551 
552  for( ; element!=end; ++element ) {
553  y[element->index()] -= element->value() * x[j];
554  }
555  }
556  }
558  //**********************************************************************************************
559 
560  //**Subtraction assignment to sparse vectors****************************************************
561  // No special implementation for the subtraction assignment to sparse vectors.
562  //**********************************************************************************************
563 
564  //**Multiplication assignment to dense vectors**************************************************
577  template< typename VT2 > // Type of the target dense vector
578  friend inline void multAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
579  {
581 
584  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
585 
586  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
587 
588  const ResultType tmp( serial( rhs ) );
589  multAssign( ~lhs, tmp );
590  }
592  //**********************************************************************************************
593 
594  //**Multiplication assignment to sparse vectors*************************************************
595  // No special implementation for the multiplication assignment to sparse vectors.
596  //**********************************************************************************************
597 
598  //**Division assignment to dense vectors********************************************************
611  template< typename VT2 > // Type of the target dense vector
612  friend inline void divAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
613  {
615 
618  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
619 
620  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
621 
622  const ResultType tmp( serial( rhs ) );
623  divAssign( ~lhs, tmp );
624  }
626  //**********************************************************************************************
627 
628  //**Division assignment to sparse vectors*******************************************************
629  // No special implementation for the division assignment to sparse vectors.
630  //**********************************************************************************************
631 
632  //**SMP assignment to dense vectors*************************************************************
647  template< typename VT2 > // Type of the target dense vector
648  friend inline EnableIf_< UseSMPAssign<VT2> >
649  smpAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
650  {
652 
653  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
654 
655  reset( ~lhs );
656 
657  if( rhs.mat_.columns() == 0UL ) return;
658 
659  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
660  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
661 
662  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
663  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
664  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
665  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
666 
667  smpAssign( ~lhs, A * x );
668  }
670  //**********************************************************************************************
671 
672  //**SMP assignment to sparse vectors************************************************************
687  template< typename VT2 > // Type of the target sparse vector
688  friend inline EnableIf_< UseSMPAssign<VT2> >
689  smpAssign( SparseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
690  {
692 
695  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
696 
697  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
698 
699  const ResultType tmp( rhs );
700  smpAssign( ~lhs, tmp );
701  }
703  //**********************************************************************************************
704 
705  //**SMP addition assignment to dense vectors****************************************************
720  template< typename VT2 > // Type of the target dense vector
721  friend inline EnableIf_< UseSMPAssign<VT2> >
722  smpAddAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
723  {
725 
726  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
727 
728  if( rhs.mat_.columns() == 0UL ) return;
729 
730  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
731  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
732 
733  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
734  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
735  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
736  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
737 
738  smpAddAssign( ~lhs, A * x );
739  }
741  //**********************************************************************************************
742 
743  //**SMP addition assignment to sparse vectors***************************************************
744  // No special implementation for the SMP addition assignment to sparse vectors.
745  //**********************************************************************************************
746 
747  //**SMP subtraction assignment to dense vectors*************************************************
762  template< typename VT2 > // Type of the target dense vector
763  friend inline EnableIf_< UseSMPAssign<VT2> >
764  smpSubAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
765  {
767 
768  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
769 
770  if( rhs.mat_.columns() == 0UL ) return;
771 
772  LT A( rhs.mat_ ); // Evaluation of the left-hand side sparse matrix operand
773  RT x( rhs.vec_ ); // Evaluation of the right-hand side dense vector operand
774 
775  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
776  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
777  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
778  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
779 
780  smpSubAssign( ~lhs, A * x );
781  }
783  //**********************************************************************************************
784 
785  //**SMP subtraction assignment to sparse vectors************************************************
786  // No special implementation for the SMP subtraction assignment to sparse vectors.
787  //**********************************************************************************************
788 
789  //**SMP multiplication assignment to dense vectors**********************************************
804  template< typename VT2 > // Type of the target dense vector
805  friend inline EnableIf_< UseSMPAssign<VT2> >
806  smpMultAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
807  {
809 
812  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
813 
814  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
815 
816  const ResultType tmp( rhs );
817  smpMultAssign( ~lhs, tmp );
818  }
820  //**********************************************************************************************
821 
822  //**SMP multiplication assignment to sparse vectors*********************************************
823  // No special implementation for the SMP multiplication assignment to sparse vectors.
824  //**********************************************************************************************
825 
826  //**SMP division assignment to dense vectors****************************************************
841  template< typename VT2 > // Type of the target dense vector
842  friend inline EnableIf_< UseSMPAssign<VT2> >
843  smpDivAssign( DenseVector<VT2,false>& lhs, const TSMatDVecMultExpr& rhs )
844  {
846 
849  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
850 
851  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
852 
853  const ResultType tmp( rhs );
854  smpDivAssign( ~lhs, tmp );
855  }
857  //**********************************************************************************************
858 
859  //**SMP division assignment to sparse vectors***************************************************
860  // No special implementation for the SMP division assignment to sparse vectors.
861  //**********************************************************************************************
862 
863  //**Compile time checks*************************************************************************
872  //**********************************************************************************************
873 };
874 //*************************************************************************************************
875 
876 
877 
878 
879 //=================================================================================================
880 //
881 // GLOBAL BINARY ARITHMETIC OPERATORS
882 //
883 //=================================================================================================
884 
885 //*************************************************************************************************
916 template< typename T1 // Type of the left-hand side sparse matrix
917  , typename T2 > // Type of the right-hand side dense vector
918 inline const DisableIf_< Or< IsSymmetric<T1>, IsMatMatMultExpr<T1> >, TSMatDVecMultExpr<T1,T2> >
920 {
922 
923  if( (~mat).columns() != (~vec).size() ) {
924  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
925  }
926 
927  return TSMatDVecMultExpr<T1,T2>( ~mat, ~vec );
928 }
929 //*************************************************************************************************
930 
931 
932 
933 
934 //=================================================================================================
935 //
936 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
937 //
938 //=================================================================================================
939 
940 //*************************************************************************************************
955 template< typename T1 // Type of the left-hand side sparse matrix
956  , typename T2 > // Type of the right-hand side dense vector
957 inline const EnableIf_< IsSymmetric<T1>, MultExprTrait_<T1,T2> >
958  operator*( const SparseMatrix<T1,true>& mat, const DenseVector<T2,false>& vec )
959 {
961 
963 
964  if( (~mat).columns() != (~vec).size() ) {
965  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
966  }
967 
968  return trans( ~mat ) * (~vec);
969 }
971 //*************************************************************************************************
972 
973 
974 
975 
976 //=================================================================================================
977 //
978 // SIZE SPECIALIZATIONS
979 //
980 //=================================================================================================
981 
982 //*************************************************************************************************
984 template< typename MT, typename VT >
985 struct Size< TSMatDVecMultExpr<MT,VT> > : public Rows<MT>
986 {};
988 //*************************************************************************************************
989 
990 
991 
992 
993 //=================================================================================================
994 //
995 // ISALIGNED SPECIALIZATIONS
996 //
997 //=================================================================================================
998 
999 //*************************************************************************************************
1001 template< typename MT, typename VT >
1002 struct IsAligned< TSMatDVecMultExpr<MT,VT> >
1003  : public BoolConstant< IsAligned<VT>::value >
1004 {};
1006 //*************************************************************************************************
1007 
1008 
1009 
1010 
1011 //=================================================================================================
1012 //
1013 // EXPRESSION TRAIT SPECIALIZATIONS
1014 //
1015 //=================================================================================================
1016 
1017 //*************************************************************************************************
1019 template< typename MT, typename VT, bool AF >
1020 struct SubvectorExprTrait< TSMatDVecMultExpr<MT,VT>, AF >
1021 {
1022  public:
1023  //**********************************************************************************************
1024  using Type = MultExprTrait_< SubmatrixExprTrait_<const MT,AF>
1025  , SubvectorExprTrait_<const VT,AF> >;
1026  //**********************************************************************************************
1027 };
1029 //*************************************************************************************************
1030 
1031 } // namespace blaze
1032 
1033 #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
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatDVecMultExpr.h:309
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:142
Header file for the Rows type trait.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
Header file for basic type definitions.
ResultType_< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:113
#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:160
Header file for the serial shim.
Header file for the IsDiagonal type trait.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatDVecMultExpr.h:149
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatDVecMultExpr.h:282
TSMatDVecMultExpr< MT, VT > This
Type of this TSMatDVecMultExpr instance.
Definition: TSMatDVecMultExpr.h:144
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:188
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
If_< IsExpression< MT >, const MT, const MT & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:152
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
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:161
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
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:323
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:129
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSMatDVecMultExpr.h:193
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
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
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: TSMatDVecMultExpr.h:258
Constraint on the transpose flag of vector types.
Constraint on the data type.
RightOperand vec_
Right-hand side dense vector of the multiplication expression.
Definition: TSMatDVecMultExpr.h:310
Constraint on the data type.
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
SubvectorExprTrait_< VT, unaligned > 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:152
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ElementType_< ResultType > ElementType
Resulting element type.
Definition: TSMatDVecMultExpr.h:147
Header file for the DisableIf class template.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TSMatDVecMultExpr.h:292
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
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:98
Header file for the Or class template.
Header file for the IsMatMatMultExpr type trait class.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
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:330
#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:89
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatDVecMultExpr.h:302
#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:110
Constraint on the data type.
Header file for the exception macros of the math module.
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:254
ResultType_< VT > VRT
Result type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:114
Header file for all forward declarations for expression class templates.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatDVecMultExpr.h:270
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
#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
Header file for the SubmatrixExprTrait class template.
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:160
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
IfTrue_< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: TSMatDVecMultExpr.h:158
CompositeType_< VT > VCT
Composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:116
Header file for the reset shim.
Header file for the isDefault shim.
Constraints on the storage order of matrix types.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSMatDVecMultExpr.h:238
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSMatDVecMultExpr.h:225
Header file for the RemoveReference type trait.
TSMatDVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TSMatDVecMultExpr class.
Definition: TSMatDVecMultExpr.h:179
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
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatDVecMultExpr.h:248
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:146
If_< IsExpression< VT >, const VT, const VT & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: TSMatDVecMultExpr.h:155
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:148
Header file for the IsComputation type trait class.
MultTrait_< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: TSMatDVecMultExpr.h:145
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
Header file for the IntegralConstant class template.
Header file for the SubvectorExprTrait class template.
Constraint on the data type.
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
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 FunctionTrace class.
CompositeType_< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatDVecMultExpr.h:115