Blaze  3.6
DVecDVecAddExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECADDEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECDVECADDEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
56 #include <blaze/math/SIMD.h>
66 #include <blaze/system/Inline.h>
68 #include <blaze/util/Assert.h>
71 #include <blaze/util/EnableIf.h>
74 #include <blaze/util/mpl/If.h>
75 #include <blaze/util/Types.h>
76 
77 
78 namespace blaze {
79 
80 //=================================================================================================
81 //
82 // CLASS DVECDVECADDEXPR
83 //
84 //=================================================================================================
85 
86 //*************************************************************************************************
93 template< typename VT1 // Type of the left-hand side dense vector
94  , typename VT2 // Type of the right-hand side dense vector
95  , bool TF > // Transpose flag
97  : public VecVecAddExpr< DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF > >
98  , private Computation
99 {
100  private:
101  //**Type definitions****************************************************************************
110  //**********************************************************************************************
111 
112  //**Return type evaluation**********************************************************************
114 
119  static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
120 
122  using ExprReturnType = decltype( std::declval<RN1>() + std::declval<RN2>() );
123  //**********************************************************************************************
124 
125  //**Serial evaluation strategy******************************************************************
127 
133  static constexpr bool useAssign =
134  ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !returnExpr );
135 
137  template< typename VT >
139  static constexpr bool UseAssign_v = useAssign;
141  //**********************************************************************************************
142 
143  //**Parallel evaluation strategy****************************************************************
145 
151  template< typename VT >
152  static constexpr bool UseSMPAssign_v =
153  ( ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign );
155  //**********************************************************************************************
156 
157  public:
158  //**Type definitions****************************************************************************
164 
167 
170 
172  using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
173 
175  using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
176  //**********************************************************************************************
177 
178  //**ConstIterator class definition**************************************************************
182  {
183  public:
184  //**Type definitions*************************************************************************
185  using IteratorCategory = std::random_access_iterator_tag;
190 
191  // STL iterator requirements
197 
200 
203  //*******************************************************************************************
204 
205  //**Constructor******************************************************************************
212  : left_ ( left ) // Iterator to the current left-hand side element
213  , right_( right ) // Iterator to the current right-hand side element
214  {}
215  //*******************************************************************************************
216 
217  //**Addition assignment operator*************************************************************
224  left_ += inc;
225  right_ += inc;
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Subtraction assignment operator**********************************************************
237  left_ -= dec;
238  right_ -= dec;
239  return *this;
240  }
241  //*******************************************************************************************
242 
243  //**Prefix increment operator****************************************************************
249  ++left_;
250  ++right_;
251  return *this;
252  }
253  //*******************************************************************************************
254 
255  //**Postfix increment operator***************************************************************
261  return ConstIterator( left_++, right_++ );
262  }
263  //*******************************************************************************************
264 
265  //**Prefix decrement operator****************************************************************
271  --left_;
272  --right_;
273  return *this;
274  }
275  //*******************************************************************************************
276 
277  //**Postfix decrement operator***************************************************************
283  return ConstIterator( left_--, right_-- );
284  }
285  //*******************************************************************************************
286 
287  //**Element access operator******************************************************************
293  return (*left_) + (*right_);
294  }
295  //*******************************************************************************************
296 
297  //**Load function****************************************************************************
302  inline auto load() const noexcept {
303  return left_.load() + right_.load();
304  }
305  //*******************************************************************************************
306 
307  //**Equality operator************************************************************************
313  inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
314  return left_ == rhs.left_;
315  }
316  //*******************************************************************************************
317 
318  //**Inequality operator**********************************************************************
324  inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
325  return left_ != rhs.left_;
326  }
327  //*******************************************************************************************
328 
329  //**Less-than operator***********************************************************************
335  inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
336  return left_ < rhs.left_;
337  }
338  //*******************************************************************************************
339 
340  //**Greater-than operator********************************************************************
346  inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
347  return left_ > rhs.left_;
348  }
349  //*******************************************************************************************
350 
351  //**Less-or-equal-than operator**************************************************************
357  inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
358  return left_ <= rhs.left_;
359  }
360  //*******************************************************************************************
361 
362  //**Greater-or-equal-than operator***********************************************************
368  inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
369  return left_ >= rhs.left_;
370  }
371  //*******************************************************************************************
372 
373  //**Subtraction operator*********************************************************************
380  return left_ - rhs.left_;
381  }
382  //*******************************************************************************************
383 
384  //**Addition operator************************************************************************
391  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
392  return ConstIterator( it.left_ + inc, it.right_ + inc );
393  }
394  //*******************************************************************************************
395 
396  //**Addition operator************************************************************************
403  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
404  return ConstIterator( it.left_ + inc, it.right_ + inc );
405  }
406  //*******************************************************************************************
407 
408  //**Subtraction operator*********************************************************************
415  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
416  return ConstIterator( it.left_ - dec, it.right_ - dec );
417  }
418  //*******************************************************************************************
419 
420  private:
421  //**Member variables*************************************************************************
424  //*******************************************************************************************
425  };
426  //**********************************************************************************************
427 
428  //**Compilation flags***************************************************************************
430  static constexpr bool simdEnabled =
431  ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDAdd_v<ET1,ET2> );
432 
434  static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
435  //**********************************************************************************************
436 
437  //**SIMD properties*****************************************************************************
439  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
440  //**********************************************************************************************
441 
442  //**Constructor*********************************************************************************
448  explicit inline DVecDVecAddExpr( const VT1& lhs, const VT2& rhs ) noexcept
449  : lhs_( lhs ) // Left-hand side dense vector of the addition expression
450  , rhs_( rhs ) // Right-hand side dense vector of the addition expression
451  {
452  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
453  }
454  //**********************************************************************************************
455 
456  //**Subscript operator**************************************************************************
462  inline ReturnType operator[]( size_t index ) const {
463  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
464  return lhs_[index] + rhs_[index];
465  }
466  //**********************************************************************************************
467 
468  //**At function*********************************************************************************
475  inline ReturnType at( size_t index ) const {
476  if( index >= lhs_.size() ) {
477  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
478  }
479  return (*this)[index];
480  }
481  //**********************************************************************************************
482 
483  //**Load function*******************************************************************************
489  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
490  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
491  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
492  return lhs_.load( index ) + rhs_.load( index );
493  }
494  //**********************************************************************************************
495 
496  //**Begin function******************************************************************************
501  inline ConstIterator begin() const {
502  return ConstIterator( lhs_.begin(), rhs_.begin() );
503  }
504  //**********************************************************************************************
505 
506  //**End function********************************************************************************
511  inline ConstIterator end() const {
512  return ConstIterator( lhs_.end(), rhs_.end() );
513  }
514  //**********************************************************************************************
515 
516  //**Size function*******************************************************************************
521  inline size_t size() const noexcept {
522  return lhs_.size();
523  }
524  //**********************************************************************************************
525 
526  //**Left operand access*************************************************************************
531  inline LeftOperand leftOperand() const noexcept {
532  return lhs_;
533  }
534  //**********************************************************************************************
535 
536  //**Right operand access************************************************************************
541  inline RightOperand rightOperand() const noexcept {
542  return rhs_;
543  }
544  //**********************************************************************************************
545 
546  //**********************************************************************************************
552  template< typename T >
553  inline bool canAlias( const T* alias ) const noexcept {
554  return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
555  ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
556  }
557  //**********************************************************************************************
558 
559  //**********************************************************************************************
565  template< typename T >
566  inline bool isAliased( const T* alias ) const noexcept {
567  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
568  }
569  //**********************************************************************************************
570 
571  //**********************************************************************************************
576  inline bool isAligned() const noexcept {
577  return lhs_.isAligned() && rhs_.isAligned();
578  }
579  //**********************************************************************************************
580 
581  //**********************************************************************************************
586  inline bool canSMPAssign() const noexcept {
587  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
588  ( size() > SMP_DVECDVECADD_THRESHOLD );
589  }
590  //**********************************************************************************************
591 
592  private:
593  //**Member variables****************************************************************************
596  //**********************************************************************************************
597 
598  //**Assignment to dense vectors*****************************************************************
612  template< typename VT > // Type of the target dense vector
613  friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
615  {
617 
618  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
619 
620  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
621  addAssign( ~lhs, rhs.rhs_ );
622  }
623  else if( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) {
624  addAssign( ~lhs, rhs.lhs_ );
625  }
626  else if( !RequiresEvaluation_v<VT2> ) {
627  assign ( ~lhs, rhs.rhs_ );
628  addAssign( ~lhs, rhs.lhs_ );
629  }
630  else {
631  assign ( ~lhs, rhs.lhs_ );
632  addAssign( ~lhs, rhs.rhs_ );
633  }
634  }
636  //**********************************************************************************************
637 
638  //**Assignment to sparse vectors****************************************************************
652  template< typename VT > // Type of the target sparse vector
653  friend inline auto assign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
655  {
657 
661 
662  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
663 
664  const ResultType tmp( serial( rhs ) );
665  assign( ~lhs, tmp );
666  }
668  //**********************************************************************************************
669 
670  //**Addition assignment to dense vectors********************************************************
684  template< typename VT > // Type of the target dense vector
685  friend inline auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
686  -> EnableIf_t< UseAssign_v<VT> >
687  {
689 
690  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
691 
692  if( !RequiresEvaluation_v<VT2> ) {
693  addAssign( ~lhs, rhs.rhs_ );
694  addAssign( ~lhs, rhs.lhs_ );
695  }
696  else {
697  addAssign( ~lhs, rhs.lhs_ );
698  addAssign( ~lhs, rhs.rhs_ );
699  }
700  }
702  //**********************************************************************************************
703 
704  //**Addition assignment to sparse vectors*******************************************************
705  // No special implementation for the addition assignment to sparse vectors.
706  //**********************************************************************************************
707 
708  //**Subtraction assignment to dense vectors*****************************************************
722  template< typename VT > // Type of the target dense vector
723  friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
724  -> EnableIf_t< UseAssign_v<VT> >
725  {
727 
728  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
729 
730  if( !RequiresEvaluation_v<VT2> ) {
731  subAssign( ~lhs, rhs.rhs_ );
732  subAssign( ~lhs, rhs.lhs_ );
733  }
734  else {
735  subAssign( ~lhs, rhs.lhs_ );
736  subAssign( ~lhs, rhs.rhs_ );
737  }
738  }
740  //**********************************************************************************************
741 
742  //**Subtraction assignment to sparse vectors****************************************************
743  // No special implementation for the subtraction assignment to sparse vectors.
744  //**********************************************************************************************
745 
746  //**Multiplication assignment to dense vectors**************************************************
760  template< typename VT > // Type of the target dense vector
761  friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
762  -> EnableIf_t< UseAssign_v<VT> >
763  {
765 
769 
770  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
771 
772  const ResultType tmp( serial( rhs ) );
773  multAssign( ~lhs, tmp );
774  }
776  //**********************************************************************************************
777 
778  //**Multiplication assignment to sparse vectors*************************************************
779  // No special implementation for the multiplication assignment to sparse vectors.
780  //**********************************************************************************************
781 
782  //**Division assignment to dense vectors********************************************************
796  template< typename VT > // Type of the target dense vector
797  friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
798  -> EnableIf_t< UseAssign_v<VT> >
799  {
801 
805 
806  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
807 
808  const ResultType tmp( serial( rhs ) );
809  divAssign( ~lhs, tmp );
810  }
812  //**********************************************************************************************
813 
814  //**Division assignment to sparse vectors*******************************************************
815  // No special implementation for the division assignment to sparse vectors.
816  //**********************************************************************************************
817 
818  //**SMP assignment to dense vectors*************************************************************
832  template< typename VT > // Type of the target dense vector
833  friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
834  -> EnableIf_t< UseSMPAssign_v<VT> >
835  {
837 
838  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
839 
840  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
841  smpAddAssign( ~lhs, rhs.rhs_ );
842  }
843  else if( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) {
844  smpAddAssign( ~lhs, rhs.lhs_ );
845  }
846  else if( !RequiresEvaluation_v<VT2> ) {
847  smpAssign ( ~lhs, rhs.rhs_ );
848  smpAddAssign( ~lhs, rhs.lhs_ );
849  }
850  else {
851  smpAssign ( ~lhs, rhs.lhs_ );
852  smpAddAssign( ~lhs, rhs.rhs_ );
853  }
854  }
856  //**********************************************************************************************
857 
858  //**SMP assignment to sparse vectors************************************************************
872  template< typename VT > // Type of the target sparse vector
873  friend inline auto smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
874  -> EnableIf_t< UseSMPAssign_v<VT> >
875  {
877 
881 
882  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
883 
884  const ResultType tmp( rhs );
885  smpAssign( ~lhs, tmp );
886  }
888  //**********************************************************************************************
889 
890  //**SMP addition assignment to dense vectors****************************************************
904  template< typename VT > // Type of the target dense vector
905  friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
906  -> EnableIf_t< UseSMPAssign_v<VT> >
907  {
909 
910  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
911 
912  if( !RequiresEvaluation_v<VT2> ) {
913  smpAddAssign( ~lhs, rhs.rhs_ );
914  smpAddAssign( ~lhs, rhs.lhs_ );
915  }
916  else {
917  smpAddAssign( ~lhs, rhs.lhs_ );
918  smpAddAssign( ~lhs, rhs.rhs_ );
919  }
920  }
922  //**********************************************************************************************
923 
924  //**SMP addition assignment to sparse vectors***************************************************
925  // No special implementation for the SMP addition assignment to sparse vectors.
926  //**********************************************************************************************
927 
928  //**SMP subtraction assignment to dense vectors*************************************************
942  template< typename VT > // Type of the target dense vector
943  friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
944  -> EnableIf_t< UseSMPAssign_v<VT> >
945  {
947 
948  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
949 
950  if( !RequiresEvaluation_v<VT2> ) {
951  smpSubAssign( ~lhs, rhs.rhs_ );
952  smpSubAssign( ~lhs, rhs.lhs_ );
953  }
954  else {
955  smpSubAssign( ~lhs, rhs.lhs_ );
956  smpSubAssign( ~lhs, rhs.rhs_ );
957  }
958  }
960  //**********************************************************************************************
961 
962  //**SMP subtraction assignment to sparse vectors************************************************
963  // No special implementation for the SMP subtraction assignment to sparse vectors.
964  //**********************************************************************************************
965 
966  //**SMP multiplication assignment to dense vectors**********************************************
980  template< typename VT > // Type of the target dense vector
981  friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
982  -> EnableIf_t< UseSMPAssign_v<VT> >
983  {
985 
989 
990  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
991 
992  const ResultType tmp( rhs );
993  smpMultAssign( ~lhs, tmp );
994  }
996  //**********************************************************************************************
997 
998  //**SMP multiplication assignment to sparse vectors*********************************************
999  // No special implementation for the SMP multiplication assignment to sparse vectors.
1000  //**********************************************************************************************
1001 
1002  //**SMP division assignment to dense vectors****************************************************
1016  template< typename VT > // Type of the target dense vector
1017  friend inline auto smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
1018  -> EnableIf_t< UseSMPAssign_v<VT> >
1019  {
1021 
1025 
1026  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1027 
1028  const ResultType tmp( rhs );
1029  smpDivAssign( ~lhs, tmp );
1030  }
1032  //**********************************************************************************************
1033 
1034  //**SMP division assignment to sparse vectors***************************************************
1035  // No special implementation for the SMP division assignment to sparse vectors.
1036  //**********************************************************************************************
1037 
1038  //**Compile time checks*************************************************************************
1046  //**********************************************************************************************
1047 };
1048 //*************************************************************************************************
1049 
1050 
1051 
1052 
1053 //=================================================================================================
1054 //
1055 // GLOBAL BINARY ARITHMETIC OPERATORS
1056 //
1057 //=================================================================================================
1058 
1059 //*************************************************************************************************
1083 template< typename VT1 // Type of the left-hand side dense vector
1084  , typename VT2 // Type of the right-hand side dense vector
1085  , bool TF > // Transpose flag
1086 inline decltype(auto)
1087  operator+( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1088 {
1090 
1091  if( (~lhs).size() != (~rhs).size() ) {
1092  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1093  }
1094 
1095  using ReturnType = const DVecDVecAddExpr<VT1,VT2,TF>;
1096  return ReturnType( ~lhs, ~rhs );
1097 }
1098 //*************************************************************************************************
1099 
1100 
1101 
1102 
1103 //=================================================================================================
1104 //
1105 // ISALIGNED SPECIALIZATIONS
1106 //
1107 //=================================================================================================
1108 
1109 //*************************************************************************************************
1111 template< typename VT1, typename VT2, bool TF >
1112 struct IsAligned< DVecDVecAddExpr<VT1,VT2,TF> >
1113  : public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
1114 {};
1116 //*************************************************************************************************
1117 
1118 
1119 
1120 
1121 //=================================================================================================
1122 //
1123 // ISPADDED SPECIALIZATIONS
1124 //
1125 //=================================================================================================
1126 
1127 //*************************************************************************************************
1129 template< typename VT1, typename VT2, bool TF >
1130 struct IsPadded< DVecDVecAddExpr<VT1,VT2,TF> >
1131  : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1132 {};
1134 //*************************************************************************************************
1135 
1136 } // namespace blaze
1137 
1138 #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
Iterator over the elements of the dense vector.
Definition: DVecDVecAddExpr.h:181
Pointer difference type of the Blaze library.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecAddExpr.h:162
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:185
Header file for auxiliary alias declarations.
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:992
Header file for basic type definitions.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecAddExpr.h:576
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecAddExpr.h:248
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:108
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
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:188
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:175
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.
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:391
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:521
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecAddExpr.h:211
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:511
Header file for the DenseVector base class.
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecAddExpr.h:119
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:566
Header file for the Computation base class.
RightOperand rhs_
Right-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:595
Header file for the RequiresEvaluation type trait.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecAddExpr.h:189
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:357
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecAddExpr.h:434
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecAddExpr.h:270
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:368
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecAddExpr.h:439
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecAddExpr.h:475
Constraint on the data type.
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:223
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
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:163
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the addition expression.
Definition: DVecDVecAddExpr.h:133
Header file for the IsTemporary type trait class.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:531
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:166
Header file for the VecVecAddExpr base class.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:193
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:172
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecAddExpr.h:282
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:302
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:586
#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
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECADDEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecAddExpr.h:104
Header file for the HasSIMDAdd type trait.
Header file for all SIMD functionality.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecAddExpr.h:423
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:346
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:236
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.The AddTrait_t alias declaration provides...
Definition: AddTrait.h:238
Header file for the IsAligned type trait.
Constraint on the data type.
DVecDVecAddExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecAddExpr class.
Definition: DVecDVecAddExpr.h:448
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:553
ReferenceType reference
Reference return type.
Definition: DVecDVecAddExpr.h:195
Constraint on the data type.
ElementType * PointerType
Pointer return type.
Definition: DVecDVecAddExpr.h:187
If_t< useAssign, const ResultType, const DVecDVecAddExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:169
Header file for the exception macros of the math module.
Constraint on the data type.
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:415
Base class for all vector/vector addition expression templates.The VecVecAddExpr class serves as a ta...
Definition: VecVecAddExpr.h:66
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:489
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
Constraint on the data type.
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecAddExpr.h:403
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:324
PointerType pointer
Pointer return type.
Definition: DVecDVecAddExpr.h:194
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecAddExpr.h:379
AddTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:161
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:541
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecAddExpr.h:462
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
BLAZE_DEVICE_CALLABLE ReturnType operator *() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:292
Header file for the addition trait.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:335
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#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.
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:102
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:199
#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
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecAddExpr.h:422
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:594
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:104
Expression object for dense vector-dense vector additions.The DVecDVecAddExpr class represents the co...
Definition: DVecDVecAddExpr.h:96
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:202
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:105
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecAddExpr.h:430
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:186
#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
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:109
Macro for CUDA compatibility.
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:260
Header file for the IsComputation type trait class.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:107
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
Header file for the IntegralConstant class template.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:501
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
decltype(std::declval< RN1 >()+std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecAddExpr.h:122
Constraint on the data type.
System settings for the inline keywords.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
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
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:192
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition: DenseVector.h:191
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:313
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:103