TSMatSVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATSVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATSVECMULTEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
52 #include <blaze/math/Exception.h>
58 #include <blaze/math/shims/Reset.h>
71 #include <blaze/math/views/Check.h>
73 #include <blaze/util/Assert.h>
74 #include <blaze/util/DisableIf.h>
75 #include <blaze/util/EnableIf.h>
77 #include <blaze/util/mpl/If.h>
78 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS SMATDVECMULTEXPR
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
97 template< typename MT // Type of the left-hand side sparse matrix
98  , typename VT > // Type of the right-hand side sparse vector
99 class TSMatSVecMultExpr
100  : public MatVecMultExpr< SparseVector< TSMatSVecMultExpr<MT,VT>, false > >
101  , private Computation
102 {
103  private:
104  //**Type definitions****************************************************************************
109  //**********************************************************************************************
110 
111  //**********************************************************************************************
113  enum : bool { evaluateMatrix = RequiresEvaluation<MT>::value };
114  //**********************************************************************************************
115 
116  //**********************************************************************************************
118  enum : bool { evaluateVector = RequiresEvaluation<VT>::value || IsComputation<VT>::value };
119  //**********************************************************************************************
120 
121  //**********************************************************************************************
123 
127  template< typename T1 >
128  struct UseSMPAssign {
129  enum : bool { value = ( evaluateMatrix || evaluateVector ) };
130  };
132  //**********************************************************************************************
133 
134  public:
135  //**Type definitions****************************************************************************
140  using ReturnType = const ElementType;
141 
143  using CompositeType = const ResultType;
144 
146  using LeftOperand = If_< IsExpression<MT>, const MT, const MT& >;
147 
149  using RightOperand = If_< IsExpression<VT>, const VT, const VT& >;
150 
153 
156  //**********************************************************************************************
157 
158  //**Compilation flags***************************************************************************
160  enum : bool { smpAssignable = !evaluateMatrix && MT::smpAssignable &&
161  !evaluateVector && VT::smpAssignable };
162  //**********************************************************************************************
163 
164  //**Constructor*********************************************************************************
170  explicit inline TSMatSVecMultExpr( const MT& mat, const VT& vec ) noexcept
171  : mat_( mat ) // Left-hand side sparse matrix of the multiplication expression
172  , vec_( vec ) // Right-hand side sparse vector of the multiplication expression
173  {
174  BLAZE_INTERNAL_ASSERT( mat_.columns() == vec_.size(), "Invalid matrix and vector sizes" );
175  }
176  //**********************************************************************************************
177 
178  //**Subscript operator**************************************************************************
184  inline ReturnType operator[]( size_t index ) const {
185  BLAZE_INTERNAL_ASSERT( index < mat_.rows(), "Invalid vector access index" );
186 
188  {
189  return mat_(index,index) * vec_[index];
190  }
191  else if( IsLower<MT>::value )
192  {
193  const size_t n( IsStrictlyLower<MT>::value ? index : index+1UL );
194  return subvector( row( mat_, index, unchecked ), 0UL, n, unchecked ) *
195  subvector( vec_, 0UL, n, unchecked );
196  }
197  else if( IsUpper<MT>::value )
198  {
199  const size_t begin( IsStrictlyUpper<MT>::value ? index+1UL : index );
200  const size_t n ( mat_.columns() - begin );
201  return subvector( row( mat_, index, unchecked ), begin, n, unchecked ) *
202  subvector( vec_, begin, n, unchecked );
203  }
204  else
205  {
206  return row( mat_, index, unchecked ) * vec_;
207  }
208  }
209  //**********************************************************************************************
210 
211  //**At function*********************************************************************************
218  inline ReturnType at( size_t index ) const {
219  if( index >= mat_.rows() ) {
220  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
221  }
222  return (*this)[index];
223  }
224  //**********************************************************************************************
225 
226  //**Size function*******************************************************************************
231  inline size_t size() const noexcept {
232  return mat_.rows();
233  }
234  //**********************************************************************************************
235 
236  //**NonZeros function***************************************************************************
241  inline size_t nonZeros() const {
242  return mat_.rows();
243  }
244  //**********************************************************************************************
245 
246  //**Left operand access*************************************************************************
251  inline LeftOperand leftOperand() const noexcept {
252  return mat_;
253  }
254  //**********************************************************************************************
255 
256  //**Right operand function**********************************************************************
261  inline RightOperand rightOperand() const noexcept {
262  return vec_;
263  }
264  //**********************************************************************************************
265 
266  //**********************************************************************************************
272  template< typename T >
273  inline bool canAlias( const T* alias ) const noexcept {
274  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
275  }
276  //**********************************************************************************************
277 
278  //**********************************************************************************************
284  template< typename T >
285  inline bool isAliased( const T* alias ) const noexcept {
286  return ( mat_.isAliased( alias ) || vec_.isAliased( alias ) );
287  }
288  //**********************************************************************************************
289 
290  //**********************************************************************************************
295  inline bool canSMPAssign() const noexcept {
296  return ( size() > SMP_SMATSVECMULT_THRESHOLD );
297  }
298  //**********************************************************************************************
299 
300  private:
301  //**Member variables****************************************************************************
304  //**********************************************************************************************
305 
306  //**Assignment to dense vectors*****************************************************************
319  template< typename VT1 > // Type of the target dense vector
320  friend inline void assign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
321  {
323 
324  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
325 
326  // Resetting the left-hand side target dense vector
327  reset( ~lhs );
328 
329  // Evaluation of the right-hand side sparse vector operand
330  RT x( serial( rhs.vec_ ) );
331  if( x.nonZeros() == 0UL ) return;
332 
333  // Evaluation of the left-hand side sparse matrix operand
334  LT A( serial( rhs.mat_ ) );
335 
336  // Checking the evaluated operators
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  // Performing the transpose sparse matrix-sparse vector multiplication
343  TSMatSVecMultExpr::selectAssignKernel( ~lhs, A, x );
344  }
346  //**********************************************************************************************
347 
348  //**Default assignment to dense vectors*********************************************************
362  template< typename VT1 // Type of the left-hand side target vector
363  , typename MT1 // Type of the left-hand side matrix operand
364  , typename VT2 > // Type of the right-hand side vector operand
365  static inline void selectAssignKernel( VT1& y, const MT1& A, const VT2& x )
366  {
367  using MatrixIterator = ConstIterator_< RemoveReference_<MT1> >;
368  using VectorIterator = ConstIterator_< RemoveReference_<VT2> >;
369 
370  const VectorIterator vend ( x.end() );
371  VectorIterator velem( x.begin() );
372 
373  for( ; velem!=vend; ++velem )
374  {
375  const MatrixIterator mend ( A.end ( velem->index() ) );
376  MatrixIterator melem( A.begin( velem->index() ) );
377 
378  for( ; melem!=mend; ++melem ) {
379  if( IsResizable< ElementType_<VT1> >::value &&
380  isDefault( y[melem->index()] ) )
381  y[melem->index()] = melem->value() * velem->value();
382  else
383  y[melem->index()] += melem->value() * velem->value();
384  }
385  }
386  }
388  //**********************************************************************************************
389 
390  //**Assignment to sparse vectors****************************************************************
402  template< typename VT1 > // Type of the target sparse vector
403  friend inline void assign( SparseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
404  {
406 
407  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
408 
409  const DynamicVector<ElementType_<VT1>,false> tmp( serial( rhs ) );
410  assign( ~lhs, tmp );
411  }
413  //**********************************************************************************************
414 
415  //**Addition assignment to dense vectors********************************************************
428  template< typename VT1 > // Type of the target dense vector
429  friend inline void addAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
430  {
432 
433  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
434 
435  // Evaluation of the right-hand side sparse vector operand
436  RT x( serial( rhs.vec_ ) );
437  if( x.nonZeros() == 0UL ) return;
438 
439  // Evaluation of the left-hand side sparse matrix operand
440  LT A( serial( rhs.mat_ ) );
441 
442  // Checking the evaluated operators
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  // Performing the transpose sparse matrix-sparse vector multiplication
449  TSMatSVecMultExpr::selectAddAssignKernel( ~lhs, A, x );
450  }
452  //**********************************************************************************************
453 
454  //**Default addition assignment to dense vectors************************************************
468  template< typename VT1 // Type of the left-hand side target vector
469  , typename MT1 // Type of the left-hand side matrix operand
470  , typename VT2 > // Type of the right-hand side vector operand
471  static inline void selectAddAssignKernel( VT1& y, const MT1& A, const VT2& x )
472  {
473  using MatrixIterator = ConstIterator_< RemoveReference_<MT1> >;
474  using VectorIterator = ConstIterator_< RemoveReference_<VT2> >;
475 
476  const VectorIterator vend ( x.end() );
477  VectorIterator velem( x.begin() );
478 
479  for( ; velem!=vend; ++velem )
480  {
481  const MatrixIterator mend ( A.end ( velem->index() ) );
482  MatrixIterator melem( A.begin( velem->index() ) );
483 
484  for( ; melem!=mend; ++melem ) {
485  y[melem->index()] += melem->value() * velem->value();
486  }
487  }
488  }
490  //**********************************************************************************************
491 
492  //**Addition assignment to sparse vectors*******************************************************
493  // No special implementation for the addition assignment to sparse vectors.
494  //**********************************************************************************************
495 
496  //**Subtraction assignment to dense vectors*****************************************************
509  template< typename VT1 > // Type of the target dense vector
510  friend inline void subAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
511  {
513 
514  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
515 
516  // Evaluation of the right-hand side sparse vector operand
517  RT x( serial( rhs.vec_ ) );
518  if( x.nonZeros() == 0UL ) return;
519 
520  // Evaluation of the left-hand side sparse matrix operand
521  LT A( serial( rhs.mat_ ) );
522 
523  // Checking the evaluated operators
524  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
525  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
526  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
527  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
528 
529  // Performing the transpose sparse matrix-sparse vector multiplication
530  TSMatSVecMultExpr::selectSubAssignKernel( ~lhs, A, x );
531  }
533  //**********************************************************************************************
534 
535  //**Default subtraction assignment to dense vectors*********************************************
549  template< typename VT1 // Type of the left-hand side target vector
550  , typename MT1 // Type of the left-hand side matrix operand
551  , typename VT2 > // Type of the right-hand side vector operand
552  static inline void selectSubAssignKernel( VT1& y, const MT1& A, const VT2& x )
553  {
554  using MatrixIterator = ConstIterator_< RemoveReference_<MT1> >;
555  using VectorIterator = ConstIterator_< RemoveReference_<VT2> >;
556 
557  const VectorIterator vend ( x.end() );
558  VectorIterator velem( x.begin() );
559 
560  for( ; velem!=vend; ++velem )
561  {
562  const MatrixIterator mend ( A.end ( velem->index() ) );
563  MatrixIterator melem( A.begin( velem->index() ) );
564 
565  for( ; melem!=mend; ++melem ) {
566  y[melem->index()] -= melem->value() * velem->value();
567  }
568  }
569  }
571  //**********************************************************************************************
572 
573  //**Subtraction assignment to sparse vectors****************************************************
574  // No special implementation for the subtraction assignment to sparse vectors.
575  //**********************************************************************************************
576 
577  //**Multiplication assignment to dense vectors**************************************************
590  template< typename VT1 > // Type of the target dense vector
591  friend inline void multAssign( DenseVector<VT1,false>& lhs, const TSMatSVecMultExpr& rhs )
592  {
594 
598 
599  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
600 
601  const ResultType tmp( serial( rhs ) );
602  multAssign( ~lhs, tmp );
603  }
605  //**********************************************************************************************
606 
607  //**Multiplication assignment to sparse vectors*************************************************
608  // No special implementation for the multiplication assignment to sparse vectors.
609  //**********************************************************************************************
610 
611  //**SMP assignment to dense vectors*************************************************************
626  template< typename VT1 > // Type of the target dense vector
627  friend inline EnableIf_< UseSMPAssign<VT1> >
629  {
631 
632  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
633 
634  // Resetting the left-hand side target dense vector
635  reset( ~lhs );
636 
637  // Evaluation of the right-hand side sparse vector operand
638  RT x( rhs.vec_ );
639  if( x.nonZeros() == 0UL ) return;
640 
641  // Evaluation of the left-hand side sparse matrix operand
642  LT A( rhs.mat_ );
643 
644  // Checking the evaluated operators
645  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
646  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
647  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
648  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
649 
650  // Performing the transpose sparse matrix-sparse vector multiplication
651  smpAssign( ~lhs, A * x );
652  }
654  //**********************************************************************************************
655 
656  //**SMP assignment to sparse vectors************************************************************
657  // No special implementation for the SMP assignment to sparse vectors.
658  //**********************************************************************************************
659 
660  //**SMP addition assignment to dense vectors****************************************************
675  template< typename VT1 > // Type of the target dense vector
676  friend inline EnableIf_< UseSMPAssign<VT1> >
678  {
680 
681  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
682 
683  // Evaluation of the right-hand side sparse vector operand
684  RT x( rhs.vec_ );
685  if( x.nonZeros() == 0UL ) return;
686 
687  // Evaluation of the left-hand side sparse matrix operand
688  LT A( rhs.mat_ );
689 
690  // Checking the evaluated operators
691  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
692  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
693  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
694  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
695 
696  // Performing the transpose sparse matrix-sparse vector multiplication
697  smpAddAssign( ~lhs, A * x );
698  }
700  //**********************************************************************************************
701 
702  //**SMP addition assignment to sparse vectors***************************************************
703  // No special implementation for the SMP addition assignment to sparse vectors.
704  //**********************************************************************************************
705 
706  //**SMP subtraction assignment to dense vectors*************************************************
721  template< typename VT1 > // Type of the target dense vector
722  friend inline EnableIf_< UseSMPAssign<VT1> >
724  {
726 
727  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
728 
729  // Evaluation of the right-hand side sparse vector operand
730  RT x( rhs.vec_ );
731  if( x.nonZeros() == 0UL ) return;
732 
733  // Evaluation of the left-hand side sparse matrix operand
734  LT A( rhs.mat_ );
735 
736  // Checking the evaluated operators
737  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
738  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
739  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
740  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).size() , "Invalid vector size" );
741 
742  // Performing the transpose sparse matrix-sparse vector multiplication
743  smpSubAssign( ~lhs, A * x );
744  }
746  //**********************************************************************************************
747 
748  //**SMP subtraction assignment to sparse vectors************************************************
749  // No special implementation for the SMP subtraction assignment to sparse vectors.
750  //**********************************************************************************************
751 
752  //**SMP multiplication assignment to dense vectors**********************************************
767  template< typename VT1 > // Type of the target dense vector
768  friend inline EnableIf_< UseSMPAssign<VT1> >
770  {
772 
776 
777  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
778 
779  const ResultType tmp( rhs );
780  smpMultAssign( ~lhs, tmp );
781  }
783  //**********************************************************************************************
784 
785  //**SMP multiplication assignment to sparse vectors*********************************************
786  // No special implementation for the SMP multiplication assignment to sparse vectors.
787  //**********************************************************************************************
788 
789  //**Compile time checks*************************************************************************
797  //**********************************************************************************************
798 };
799 //*************************************************************************************************
800 
801 
802 
803 
804 //=================================================================================================
805 //
806 // GLOBAL BINARY ARITHMETIC OPERATORS
807 //
808 //=================================================================================================
809 
810 //*************************************************************************************************
841 template< typename MT // Type of the left-hand side sparse matrix
842  , typename VT > // Type of the right-hand side sparse vector
843 inline decltype(auto)
844  operator*( const SparseMatrix<MT,true>& mat, const SparseVector<VT,false>& vec )
845 {
847 
849 
850  if( (~mat).columns() != (~vec).size() ) {
851  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
852  }
853 
854  using ReturnType = const TSMatSVecMultExpr<MT,VT>;
855  return ReturnType( ~mat, ~vec );
856 }
857 //*************************************************************************************************
858 
859 
860 
861 
862 //=================================================================================================
863 //
864 // SIZE SPECIALIZATIONS
865 //
866 //=================================================================================================
867 
868 //*************************************************************************************************
870 template< typename MT, typename VT >
871 struct Size< TSMatSVecMultExpr<MT,VT>, 0UL >
872  : public Size<MT,0UL>
873 {};
875 //*************************************************************************************************
876 
877 } // namespace blaze
878 
879 #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
ResultType_< MT > MRT
Result type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:105
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
Header file for basic type definitions.
Header file for the SparseVector base class.
#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.
Header file for the IsDiagonal type trait.
LeftOperand leftOperand() const noexcept
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatSVecMultExpr.h:251
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
size_t nonZeros() const
Returns an estimation for the number of non-zero elements in the sparse vector.
Definition: TSMatSVecMultExpr.h:241
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TSMatSVecMultExpr.h:231
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
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
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
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:185
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
Header file for the implementation of an arbitrarily sized vector.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:140
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.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:138
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TSMatSVecMultExpr.h:218
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
MultTrait_< MRT, VRT > ResultType
Result type for expression template evaluations.
Definition: TSMatSVecMultExpr.h:137
ElementType_< ResultType > ElementType
Resulting element type.
Definition: TSMatSVecMultExpr.h:139
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Expression object for sparse matrix-sparse vector multiplications.The TSMatSVecMultExpr class represe...
Definition: Forward.h:167
IfTrue_< evaluateVector, const VRT, VCT > RT
Type for the assignment of the right-hand side sparse vector operand.
Definition: TSMatSVecMultExpr.h:155
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
If_< IsExpression< VT >, const VT, const VT &> RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:149
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
RightOperand vec_
Right-hand side sparse vector of the multiplication expression.
Definition: TSMatSVecMultExpr.h:303
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TSMatSVecMultExpr.h:295
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
CompositeType_< VT > VCT
Composite type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:108
Header file for the IsLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
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
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse vector operand.
Definition: TSMatSVecMultExpr.h:261
IfTrue_< evaluateMatrix, const MRT, MCT > LT
Type for the assignment of the left-hand side sparse matrix operand.
Definition: TSMatSVecMultExpr.h:152
Header file for the exception macros of the math module.
CompositeType_< MT > MCT
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:107
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatSVecMultExpr.h:285
If_< IsExpression< MT >, const MT, const MT &> LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatSVecMultExpr.h:146
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatSVecMultExpr.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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatSVecMultExpr.h:273
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TSMatSVecMultExpr.h:184
ResultType_< VT > VRT
Result type of the right-hand side sparse vector expression.
Definition: TSMatSVecMultExpr.h:106
LeftOperand mat_
Left-hand side sparse matrix of the multiplication expression.
Definition: TSMatSVecMultExpr.h:302
Header file for run time assertion macros.
TSMatSVecMultExpr(const MT &mat, const VT &vec) noexcept
Constructor for the TSMatSVecMultExpr class.
Definition: TSMatSVecMultExpr.h:170
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
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
Header file for the isDefault shim.
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
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
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
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.