Blaze  3.6
TDVecSMatMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TDVECSMATMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TDVECSMATMULTEXPR_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>
75 #include <blaze/math/views/Check.h>
77 #include <blaze/util/Assert.h>
78 #include <blaze/util/DisableIf.h>
79 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/MaybeUnused.h>
82 #include <blaze/util/mpl/If.h>
83 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS TDVECSMATMULTEXPR
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
101 template< typename VT // Type of the left-hand side dense vector
102  , typename MT > // Type of the right-hand side sparse matrix
103 class TDVecSMatMultExpr
104  : public TVecMatMultExpr< DenseVector< TDVecSMatMultExpr<VT,MT>, true > >
105  , private Computation
106 {
107  private:
108  //**Type definitions****************************************************************************
113  //**********************************************************************************************
114 
115  //**********************************************************************************************
117  static constexpr bool evaluateVector = ( IsComputation_v<VT> || RequiresEvaluation_v<VT> );
118  //**********************************************************************************************
119 
120  //**********************************************************************************************
122  static constexpr bool evaluateMatrix = RequiresEvaluation_v<MT>;
123  //**********************************************************************************************
124 
125  //**********************************************************************************************
127 
131  template< typename T1 >
132  static constexpr bool UseSMPAssign_v = ( evaluateVector || evaluateMatrix );
134  //**********************************************************************************************
135 
136  public:
137  //**Type definitions****************************************************************************
143  using ReturnType = const ElementType;
144  using CompositeType = const ResultType;
145 
147  using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
148 
150  using RightOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
151 
154 
157  //**********************************************************************************************
158 
159  //**Compilation flags***************************************************************************
161  static constexpr bool simdEnabled = false;
162 
164  static constexpr bool smpAssignable =
165  ( !evaluateVector && VT::smpAssignable && !evaluateMatrix && MT::smpAssignable );
166  //**********************************************************************************************
167 
168  //**Constructor*********************************************************************************
171  explicit inline TDVecSMatMultExpr( const VT& vec, const MT& mat ) noexcept
172  : vec_( vec ) // Left-hand side dense vector of the multiplication expression
173  , mat_( mat ) // Right-hand side sparse matrix of the multiplication expression
174  {
175  BLAZE_INTERNAL_ASSERT( vec_.size() == mat_.rows(), "Invalid vector and matrix sizes" );
176  }
177  //**********************************************************************************************
178 
179  //**Subscript operator**************************************************************************
185  inline ReturnType operator[]( size_t index ) const {
186  BLAZE_INTERNAL_ASSERT( index < mat_.columns(), "Invalid vector access index" );
187 
188  if( IsDiagonal_v<MT> )
189  {
190  return vec_[index] * mat_(index,index);
191  }
192  else if( IsLower_v<MT> )
193  {
194  const size_t begin( IsStrictlyLower_v<MT> ? index+1UL : index );
195  const size_t n ( mat_.rows() - begin );
196  return subvector( vec_, begin, n, unchecked ) *
197  subvector( column( mat_, index, unchecked ), begin, n, unchecked );
198  }
199  else if( IsUpper_v<MT> )
200  {
201  const size_t n( IsStrictlyUpper_v<MT> ? index : index+1UL );
202  return subvector( vec_, 0UL, n, unchecked ) *
203  subvector( column( mat_, index, unchecked ), 0UL, n, unchecked );
204  }
205  else
206  {
207  return vec_ * column( mat_, index, unchecked );
208  }
209  }
210  //**********************************************************************************************
211 
212  //**At function*********************************************************************************
219  inline ReturnType at( size_t index ) const {
220  if( index >= mat_.columns() ) {
221  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
222  }
223  return (*this)[index];
224  }
225  //**********************************************************************************************
226 
227  //**Size function*******************************************************************************
232  inline size_t size() const noexcept {
233  return mat_.columns();
234  }
235  //**********************************************************************************************
236 
237  //**Left operand access*************************************************************************
242  inline LeftOperand leftOperand() const noexcept {
243  return vec_;
244  }
245  //**********************************************************************************************
246 
247  //**Right operand access************************************************************************
252  inline RightOperand rightOperand() const noexcept {
253  return mat_;
254  }
255  //**********************************************************************************************
256 
257  //**********************************************************************************************
263  template< typename T >
264  inline bool canAlias( const T* alias ) const noexcept {
265  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
266  }
267  //**********************************************************************************************
268 
269  //**********************************************************************************************
275  template< typename T >
276  inline bool isAliased( const T* alias ) const noexcept {
277  return ( vec_.isAliased( alias ) || mat_.isAliased( alias ) );
278  }
279  //**********************************************************************************************
280 
281  //**********************************************************************************************
286  inline bool isAligned() const noexcept {
287  return vec_.isAligned();
288  }
289  //**********************************************************************************************
290 
291  //**********************************************************************************************
296  inline bool canSMPAssign() const noexcept {
297  return ( size() > SMP_TDVECSMATMULT_THRESHOLD );
298  }
299  //**********************************************************************************************
300 
301  private:
302  //**Member variables****************************************************************************
305  //**********************************************************************************************
306 
307  //**Assignment to dense vectors*****************************************************************
319  template< typename VT2 > // Type of the target dense vector
320  friend inline void assign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
321  {
323 
324  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
325 
326  reset( ~lhs );
327 
328  if( rhs.mat_.rows() == 0UL ) return;
329 
330  LT x( serial( rhs.vec_ ) ); // Evaluation of the left-hand side dense vector operator
331  RT A( serial( rhs.mat_ ) ); // Evaluation of the right-hand side sparse matrix operator
332 
333  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
334  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
335  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
336  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
337 
338  TDVecSMatMultExpr::selectAssignKernel( ~lhs, x, A );
339  }
340  //**********************************************************************************************
341 
342  //**Optimized assignment to dense vectors*******************************************************
356  template< typename VT1 // Type of the left-hand side target vector
357  , typename VT2 // Type of the left-hand side vector operand
358  , typename MT1 > // Type of the right-hand side matrix operand
359  static inline void selectAssignKernel( VT1& y, const VT2& x, const MT1& A )
360  {
361  for( size_t i=0UL; i<x.size(); ++i )
362  {
363  const auto end( A.end(i) );
364  auto element( A.begin(i) );
365 
366  for( ; element!=end; ++element ) {
368  isDefault( y[element->index()] ) )
369  y[element->index()] = x[i] * element->value();
370  else
371  y[element->index()] += x[i] * element->value();
372  }
373  }
374  }
376  //**********************************************************************************************
377 
378  //**Assignment to sparse vectors****************************************************************
390  template< typename VT2 > // Type of the target sparse vector
391  friend inline void assign( SparseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
392  {
394 
398 
399  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
400 
401  const ResultType tmp( serial( rhs ) );
402  assign( ~lhs, tmp );
403  }
404  //**********************************************************************************************
405 
406  //**Addition assignment to dense vectors********************************************************
418  template< typename VT2 > // Type of the target dense vector
419  friend inline void addAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
420  {
422 
423  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
424 
425  if( rhs.mat_.rows() == 0UL ) {
426  return;
427  }
428 
429  LT x( serial( rhs.vec_ ) ); // Evaluation of the left-hand side dense vector operator
430  RT A( serial( rhs.mat_ ) ); // Evaluation of the right-hand side sparse matrix operator
431 
432  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
433  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
434  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
435  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
436 
437  TDVecSMatMultExpr::selectAddAssignKernel( ~lhs, x, A );
438  }
439  //**********************************************************************************************
440 
441  //**Optimized addition assignment to dense vectors*************************************************
455  template< typename VT1 // Type of the left-hand side target vector
456  , typename VT2 // Type of the left-hand side vector operand
457  , typename MT1 > // Type of the right-hand side matrix operand
458  static inline void selectAddAssignKernel( VT1& y, const VT2& x, const MT1& A )
459  {
460  for( size_t i=0UL; i<x.size(); ++i )
461  {
462  const auto end( A.end(i) );
463  auto element( A.begin(i) );
464 
465  for( ; element!=end; ++element ) {
466  y[element->index()] += x[i] * element->value();
467  }
468  }
469  }
471  //**********************************************************************************************
472 
473  //**Addition assignment to sparse vectors*******************************************************
474  // No special implementation for the addition assignment to sparse vectors.
475  //**********************************************************************************************
476 
477  //**Subtraction assignment to dense vectors*****************************************************
489  template< typename VT2 > // Type of the target dense vector
490  friend inline void subAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
491  {
493 
494  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
495 
496  if( rhs.mat_.rows() == 0UL ) {
497  return;
498  }
499 
500  LT x( serial( rhs.vec_ ) ); // Evaluation of the left-hand side dense vector operator
501  RT A( serial( rhs.mat_ ) ); // Evaluation of the right-hand side sparse matrix operator
502 
503  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
504  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
505  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
506  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
507 
508  TDVecSMatMultExpr::selectSubAssignKernel( ~lhs, x, A );
509  }
510  //**********************************************************************************************
511 
512  //**Optimized subtraction assignment to dense vectors**********************************************
526  template< typename VT1 // Type of the left-hand side target vector
527  , typename VT2 // Type of the left-hand side vector operand
528  , typename MT1 > // Type of the right-hand side matrix operand
529  static inline void selectSubAssignKernel( VT1& y, const VT2& x, const MT1& A )
530  {
531  for( size_t i=0UL; i<x.size(); ++i )
532  {
533  const auto end( A.end(i) );
534  auto element( A.begin(i) );
535 
536  for( ; element!=end; ++element ) {
537  y[element->index()] -= x[i] * element->value();
538  }
539  }
540  }
542  //**********************************************************************************************
543 
544  //**Subtraction assignment to sparse vectors****************************************************
545  // No special implementation for the subtraction assignment to sparse vectors.
546  //**********************************************************************************************
547 
548  //**Multiplication assignment to dense vectors**************************************************
560  template< typename VT2 > // Type of the target dense vector
561  friend inline void multAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
562  {
564 
568 
569  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
570 
571  const ResultType tmp( serial( rhs ) );
572  multAssign( ~lhs, tmp );
573  }
574  //**********************************************************************************************
575 
576  //**Multiplication assignment to sparse vectors*************************************************
577  // No special implementation for the multiplication assignment to sparse vectors.
578  //**********************************************************************************************
579 
580  //**Division assignment to dense vectors********************************************************
592  template< typename VT2 > // Type of the target dense vector
593  friend inline void divAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
594  {
596 
600 
601  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
602 
603  const ResultType tmp( serial( rhs ) );
604  divAssign( ~lhs, tmp );
605  }
606  //**********************************************************************************************
607 
608  //**Division assignment to sparse vectors*******************************************************
609  // No special implementation for the division assignment to sparse vectors.
610  //**********************************************************************************************
611 
612  //**SMP assignment to dense vectors*************************************************************
626  template< typename VT2 > // Type of the target dense vector
627  friend inline auto smpAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
629  {
631 
632  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
633 
634  reset( ~lhs );
635 
636  if( rhs.mat_.rows() == 0UL ) return;
637 
638  LT x( rhs.vec_ ); // Evaluation of the left-hand side dense vector operator
639  RT A( rhs.mat_ ); // Evaluation of the right-hand side sparse matrix operator
640 
641  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
642  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
643  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
644  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
645 
646  smpAssign( ~lhs, x * A );
647  }
648  //**********************************************************************************************
649 
650  //**SMP assignment to sparse vectors************************************************************
664  template< typename VT2 > // Type of the target sparse vector
665  friend inline auto smpAssign( SparseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
667  {
669 
673 
674  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
675 
676  const ResultType tmp( rhs );
677  smpAssign( ~lhs, tmp );
678  }
679  //**********************************************************************************************
680 
681  //**SMP addition assignment to dense vectors****************************************************
695  template< typename VT2 > // Type of the target dense vector
696  friend inline auto smpAddAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
698  {
700 
701  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
702 
703  if( rhs.mat_.rows() == 0UL ) {
704  return;
705  }
706 
707  LT x( rhs.vec_ ); // Evaluation of the left-hand side dense vector operator
708  RT A( rhs.mat_ ); // Evaluation of the right-hand side sparse matrix operator
709 
710  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
711  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
712  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
713  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
714 
715  smpAddAssign( ~lhs, x * A );
716  }
717  //**********************************************************************************************
718 
719  //**SMP addition assignment to sparse vectors***************************************************
720  // No special implementation for the SMP addition assignment to sparse vectors.
721  //**********************************************************************************************
722 
723  //**SMP subtraction assignment to dense vectors*************************************************
737  template< typename VT2 > // Type of the target dense vector
738  friend inline auto smpSubAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
740  {
742 
743  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
744 
745  if( rhs.mat_.rows() == 0UL ) {
746  return;
747  }
748 
749  LT x( rhs.vec_ ); // Evaluation of the left-hand side dense vector operator
750  RT A( rhs.mat_ ); // Evaluation of the right-hand side sparse matrix operator
751 
752  BLAZE_INTERNAL_ASSERT( x.size() == rhs.vec_.size() , "Invalid vector size" );
753  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.mat_.rows() , "Invalid number of rows" );
754  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.mat_.columns(), "Invalid number of columns" );
755  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).size() , "Invalid vector size" );
756 
757  smpSubAssign( ~lhs, x * A );
758  }
759  //**********************************************************************************************
760 
761  //**SMP subtraction assignment to sparse vectors************************************************
762  // No special implementation for the SMP subtraction assignment to sparse vectors.
763  //**********************************************************************************************
764 
765  //**SMP multiplication assignment to dense vectors**********************************************
779  template< typename VT2 > // Type of the target dense vector
780  friend inline auto smpMultAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
782  {
784 
788 
789  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
790 
791  const ResultType tmp( rhs );
792  smpMultAssign( ~lhs, tmp );
793  }
794  //**********************************************************************************************
795 
796  //**SMP multiplication assignment to sparse vectors*********************************************
797  // No special implementation for the SMP multiplication assignment to sparse vectors.
798  //**********************************************************************************************
799 
800  //**SMP division assignment to dense vectors****************************************************
814  template< typename VT2 > // Type of the target dense vector
815  friend inline auto smpDivAssign( DenseVector<VT2,true>& lhs, const TDVecSMatMultExpr& rhs )
817  {
819 
823 
824  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
825 
826  const ResultType tmp( rhs );
827  smpDivAssign( ~lhs, tmp );
828  }
829  //**********************************************************************************************
830 
831  //**SMP division assignment to sparse vectors***************************************************
832  // No special implementation for the SMP division assignment to sparse vectors.
833  //**********************************************************************************************
834 
835  //**Compile time checks*************************************************************************
845  //**********************************************************************************************
846 };
847 //*************************************************************************************************
848 
849 
850 
851 
852 //=================================================================================================
853 //
854 // GLOBAL BINARY ARITHMETIC OPERATORS
855 //
856 //=================================================================================================
857 
858 //*************************************************************************************************
871 template< typename VT // Type of the left-hand side dense vector
872  , typename MT // Type of the right-hand side sparse matrix
873  , DisableIf_t< IsSymmetric_v<MT> ||
874  ( IsIdentity_v<MT> &&
875  IsSame_v< ElementType_t<VT>, ElementType_t<MT> > ) ||
876  IsZero_v<MT> >* = nullptr >
877 inline const TDVecSMatMultExpr<VT,MT>
878  tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
879 {
881 
882  BLAZE_INTERNAL_ASSERT( (~vec).size() == (~mat).rows(), "Invalid vector and matrix sizes" );
883 
884  return TDVecSMatMultExpr<VT,MT>( ~vec, ~mat );
885 }
887 //*************************************************************************************************
888 
889 
890 //*************************************************************************************************
904 template< typename VT // Type of the left-hand side dense vector
905  , typename MT // Type of the right-hand side sparse matrix
906  , EnableIf_t< IsSymmetric_v<MT> &&
907  !( IsIdentity_v<MT> &&
908  IsSame_v< ElementType_t<VT>, ElementType_t<MT> > ) &&
909  !IsZero_v<MT> >* = nullptr >
910 inline decltype(auto)
911  tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
912 {
914 
915  BLAZE_INTERNAL_ASSERT( (~vec).size() == (~mat).rows(), "Invalid vector and matrix sizes" );
916 
917  return (~vec) * trans( ~mat );
918 }
920 //*************************************************************************************************
921 
922 
923 //*************************************************************************************************
937 template< typename VT // Type of the left-hand side dense vector
938  , typename MT // Type of the right-hand side sparse matrix
939  , EnableIf_t< IsIdentity_v<MT> &&
940  IsSame_v< ElementType_t<VT>, ElementType_t<MT> > >* = nullptr >
941 inline const VT&
942  tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
943 {
945 
946  MAYBE_UNUSED( mat );
947 
948  BLAZE_INTERNAL_ASSERT( (~vec).size() == (~mat).rows(), "Invalid vector and matrix sizes" );
949 
950  return (~vec);
951 }
953 //*************************************************************************************************
954 
955 
956 //*************************************************************************************************
969 template< typename VT // Type of the left-hand side dense vector
970  , typename MT // Type of the right-hand side sparse matrix
971  , EnableIf_t< IsZero_v<MT> >* = nullptr >
972 inline decltype(auto)
973  tdvecsmatmult( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
974 {
976 
977  MAYBE_UNUSED( vec );
978 
979  BLAZE_INTERNAL_ASSERT( (~vec).size() == (~mat).rows(), "Invalid vector and matrix sizes" );
980 
981  using ReturnType = const MultTrait_t< ResultType_t<VT>, ResultType_t<MT> >;
982 
985 
986  return ReturnType( (~mat).columns() );
987 }
989 //*************************************************************************************************
990 
991 
992 //*************************************************************************************************
1023 template< typename VT // Type of the left-hand side dense vector
1024  , typename MT > // Type of the right-hand side sparse matrix
1025 inline decltype(auto)
1026  operator*( const DenseVector<VT,true>& vec, const SparseMatrix<MT,false>& mat )
1027 {
1029 
1031 
1032  if( (~vec).size() != (~mat).rows() ) {
1033  BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
1034  }
1035 
1036  return tdvecsmatmult( ~vec, ~mat );
1037 }
1038 //*************************************************************************************************
1039 
1040 
1041 
1042 
1043 //=================================================================================================
1044 //
1045 // ISALIGNED SPECIALIZATIONS
1046 //
1047 //=================================================================================================
1048 
1049 //*************************************************************************************************
1051 template< typename VT, typename MT >
1052 struct IsAligned< TDVecSMatMultExpr<VT,MT> >
1053  : public IsAligned<VT>
1054 {};
1056 //*************************************************************************************************
1057 
1058 } // namespace blaze
1059 
1060 #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
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
friend auto smpSubAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP subtraction assignment of a transpose dense vector-sparse matrix multiplication to a dense vector...
Definition: TDVecSMatMultExpr.h:738
Header file for basic type definitions.
Expression object for transpose dense vector-sparse matrix multiplications.The TDVecSMatMultExpr clas...
Definition: Forward.h:176
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
CompositeType_t< VT > VCT
Composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:111
friend auto smpMultAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP multiplication assignment of a transpose dense vector-sparse matrix multiplication to a dense vec...
Definition: TDVecSMatMultExpr.h:780
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
Header file for the IsDiagonal type trait.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
static constexpr bool evaluateMatrix
Compilation switch for the composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:122
CompositeType_t< MT > MCT
Composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:112
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Constraint on the data type.
Header file for the DenseVector base class.
TDVecSMatMultExpr(const VT &vec, const MT &mat) noexcept
Constructor for the TDVecSMatMultExpr class.
Definition: TDVecSMatMultExpr.h:171
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:154
Header file for the MAYBE_UNUSED function template.
Header file for the IsIdentity type trait.
Header file for the Computation base class.
friend auto smpAssign(SparseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP assignment of a transpose dense vector-sparse matrix multiplication to a sparse vector ( ).
Definition: TDVecSMatMultExpr.h:665
Header file for the reset shim.
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TDVecSMatMultExpr.h:252
friend void assign(SparseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Assignment of a transpose dense vector-sparse matrix multiplication to a sparse vector ( ).
Definition: TDVecSMatMultExpr.h:391
friend void divAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Division assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:593
RightOperand mat_
Right-hand side sparse matrix of the multiplication expression.
Definition: TDVecSMatMultExpr.h:304
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes....
Definition: Forward.h:145
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
LeftOperand vec_
Left-hand side dense vector of the multiplication expression.
Definition: TDVecSMatMultExpr.h:303
MultTrait_t< VRT, MRT > ResultType
Result type for expression template evaluations.
Definition: TDVecSMatMultExpr.h:140
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: TDVecSMatMultExpr.h:286
constexpr bool IsResizable_v
Auxiliary variable template for the IsResizable type trait.The IsResizable_v variable template provid...
Definition: IsResizable.h:133
Header file for the DisableIf class template.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: TDVecSMatMultExpr.h:185
friend void subAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Subtraction assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( )...
Definition: TDVecSMatMultExpr.h:490
If_t< IsExpression_v< MT >, const MT, const MT & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:150
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:58
If_t< evaluateVector, const VRT, VCT > LT
Composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:153
Header file for the If class template.
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is not a zero vector or matrix type,...
Definition: Zero.h:61
friend void multAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Multiplication assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ...
Definition: TDVecSMatMultExpr.h:561
ResultType_t< VT > VRT
Result type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:109
#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
friend auto smpDivAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP division assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ...
Definition: TDVecSMatMultExpr.h:815
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TDVecSMatMultExpr.h:164
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
const ResultType CompositeType
Data type for composite expression templates.
Definition: TDVecSMatMultExpr.h:144
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a matrix/matrix multiplication expressio...
Definition: MatMatMultExpr.h:83
Constraint on the data type.
Header file for the exception macros of the math module.
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:438
Constraint on the data type.
const ElementType ReturnType
Return type for expression template evaluations.
Definition: TDVecSMatMultExpr.h:143
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
ResultType_t< MT > MRT
Result type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:110
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
#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,...
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TDVecSMatMultExpr.h:142
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
friend auto smpAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
SMP assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:627
static constexpr bool evaluateVector
Compilation switch for the composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:117
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: TDVecSMatMultExpr.h:242
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: TDVecSMatMultExpr.h:161
Header file for the IsZero type trait.
Constraint on the data type.
#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 all forward declarations for expression class templates.
Header file for the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Header file for the TVecMatMultExpr base class.
Constraint on the data type.
friend void addAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Addition assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:419
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: TDVecSMatMultExpr.h:232
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TDVecSMatMultExpr.h:264
friend void assign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs)
Assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:320
#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
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_TVECMATMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/matrix ...
Definition: TVecMatMultExpr.h:104
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: TDVecSMatMultExpr.h:147
Header file for the IsComputation type trait class.
friend auto smpAddAssign(DenseVector< VT2, true > &lhs, const TDVecSMatMultExpr &rhs) -> EnableIf_t< UseSMPAssign_v< VT2 > >
Addition assignment of a transpose dense vector-sparse matrix multiplication to a dense vector ( ).
Definition: TDVecSMatMultExpr.h:696
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: TDVecSMatMultExpr.h:219
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: TDVecSMatMultExpr.h:296
Header file for the IsUpper type trait.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TDVecSMatMultExpr.h:141
Constraint on the data type.
If_t< evaluateMatrix, const MRT, MCT > RT
Composite type of the right-hand side sparse matrix expression.
Definition: TDVecSMatMultExpr.h:156
Header file for the IsResizable type trait.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TDVecSMatMultExpr.h:276
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is a zero vector or matrix type,...
Definition: Zero.h:81
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
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
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Header file for the function trace functionality.