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 <blaze/math/Aliases.h>
49 #include <blaze/math/Exception.h>
55 #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/And.h>
75 #include <blaze/util/mpl/If.h>
76 #include <blaze/util/mpl/Maximum.h>
77 #include <blaze/util/Types.h>
78 
79 
80 namespace blaze {
81 
82 //=================================================================================================
83 //
84 // CLASS DVECDVECADDEXPR
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
95 template< typename VT1 // Type of the left-hand side dense vector
96  , typename VT2 // Type of the right-hand side dense vector
97  , bool TF > // Transpose flag
99  : public VecVecAddExpr< DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF > >
100  , private Computation
101 {
102  private:
103  //**Type definitions****************************************************************************
112  //**********************************************************************************************
113 
114  //**Return type evaluation**********************************************************************
116 
121  enum : bool { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
122 
125  //**********************************************************************************************
126 
127  //**Serial evaluation strategy******************************************************************
129 
135  enum : bool { useAssign = ( RequiresEvaluation<VT1>::value || RequiresEvaluation<VT2>::value || !returnExpr ) };
136 
138  template< typename VT >
140  struct UseAssign {
141  enum : bool { value = useAssign };
142  };
144  //**********************************************************************************************
145 
146  //**Parallel evaluation strategy****************************************************************
148 
154  template< typename VT >
155  struct UseSMPAssign {
156  enum : bool { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
157  };
159  //**********************************************************************************************
160 
161  public:
162  //**Type definitions****************************************************************************
167 
170 
173 
175  using LeftOperand = If_< IsExpression<VT1>, const VT1, const VT1& >;
176 
178  using RightOperand = If_< IsExpression<VT2>, const VT2, const VT2& >;
179  //**********************************************************************************************
180 
181  //**ConstIterator class definition**************************************************************
185  {
186  public:
187  //**Type definitions*************************************************************************
188  using IteratorCategory = std::random_access_iterator_tag;
193 
194  // STL iterator requirements
200 
203 
206  //*******************************************************************************************
207 
208  //**Constructor******************************************************************************
214  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
215  : left_ ( left ) // Iterator to the current left-hand side element
216  , right_( right ) // Iterator to the current right-hand side element
217  {}
218  //*******************************************************************************************
219 
220  //**Addition assignment operator*************************************************************
226  inline ConstIterator& operator+=( size_t inc ) {
227  left_ += inc;
228  right_ += inc;
229  return *this;
230  }
231  //*******************************************************************************************
232 
233  //**Subtraction assignment operator**********************************************************
239  inline ConstIterator& operator-=( size_t dec ) {
240  left_ -= dec;
241  right_ -= dec;
242  return *this;
243  }
244  //*******************************************************************************************
245 
246  //**Prefix increment operator****************************************************************
252  ++left_;
253  ++right_;
254  return *this;
255  }
256  //*******************************************************************************************
257 
258  //**Postfix increment operator***************************************************************
263  inline const ConstIterator operator++( int ) {
264  return ConstIterator( left_++, right_++ );
265  }
266  //*******************************************************************************************
267 
268  //**Prefix decrement operator****************************************************************
274  --left_;
275  --right_;
276  return *this;
277  }
278  //*******************************************************************************************
279 
280  //**Postfix decrement operator***************************************************************
285  inline const ConstIterator operator--( int ) {
286  return ConstIterator( left_--, right_-- );
287  }
288  //*******************************************************************************************
289 
290  //**Element access operator******************************************************************
295  inline ReturnType operator*() const {
296  return (*left_) + (*right_);
297  }
298  //*******************************************************************************************
299 
300  //**Load function****************************************************************************
305  inline auto load() const noexcept {
306  return left_.load() + right_.load();
307  }
308  //*******************************************************************************************
309 
310  //**Equality operator************************************************************************
316  inline bool operator==( const ConstIterator& rhs ) const {
317  return left_ == rhs.left_;
318  }
319  //*******************************************************************************************
320 
321  //**Inequality operator**********************************************************************
327  inline bool operator!=( const ConstIterator& rhs ) const {
328  return left_ != rhs.left_;
329  }
330  //*******************************************************************************************
331 
332  //**Less-than operator***********************************************************************
338  inline bool operator<( const ConstIterator& rhs ) const {
339  return left_ < rhs.left_;
340  }
341  //*******************************************************************************************
342 
343  //**Greater-than operator********************************************************************
349  inline bool operator>( const ConstIterator& rhs ) const {
350  return left_ > rhs.left_;
351  }
352  //*******************************************************************************************
353 
354  //**Less-or-equal-than operator**************************************************************
360  inline bool operator<=( const ConstIterator& rhs ) const {
361  return left_ <= rhs.left_;
362  }
363  //*******************************************************************************************
364 
365  //**Greater-or-equal-than operator***********************************************************
371  inline bool operator>=( const ConstIterator& rhs ) const {
372  return left_ >= rhs.left_;
373  }
374  //*******************************************************************************************
375 
376  //**Subtraction operator*********************************************************************
382  inline DifferenceType operator-( const ConstIterator& rhs ) const {
383  return left_ - rhs.left_;
384  }
385  //*******************************************************************************************
386 
387  //**Addition operator************************************************************************
394  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
395  return ConstIterator( it.left_ + inc, it.right_ + inc );
396  }
397  //*******************************************************************************************
398 
399  //**Addition operator************************************************************************
406  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
407  return ConstIterator( it.left_ + inc, it.right_ + inc );
408  }
409  //*******************************************************************************************
410 
411  //**Subtraction operator*********************************************************************
418  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
419  return ConstIterator( it.left_ - dec, it.right_ - dec );
420  }
421  //*******************************************************************************************
422 
423  private:
424  //**Member variables*************************************************************************
427  //*******************************************************************************************
428  };
429  //**********************************************************************************************
430 
431  //**Compilation flags***************************************************************************
433  enum : bool { simdEnabled = VT1::simdEnabled && VT2::simdEnabled &&
435 
437  enum : bool { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
438  //**********************************************************************************************
439 
440  //**SIMD properties*****************************************************************************
442  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
443  //**********************************************************************************************
444 
445  //**Constructor*********************************************************************************
451  explicit inline DVecDVecAddExpr( const VT1& lhs, const VT2& rhs ) noexcept
452  : lhs_( lhs ) // Left-hand side dense vector of the addition expression
453  , rhs_( rhs ) // Right-hand side dense vector of the addition expression
454  {
455  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
456  }
457  //**********************************************************************************************
458 
459  //**Subscript operator**************************************************************************
465  inline ReturnType operator[]( size_t index ) const {
466  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
467  return lhs_[index] + rhs_[index];
468  }
469  //**********************************************************************************************
470 
471  //**At function*********************************************************************************
478  inline ReturnType at( size_t index ) const {
479  if( index >= lhs_.size() ) {
480  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
481  }
482  return (*this)[index];
483  }
484  //**********************************************************************************************
485 
486  //**Load function*******************************************************************************
492  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
493  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
494  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
495  return lhs_.load( index ) + rhs_.load( index );
496  }
497  //**********************************************************************************************
498 
499  //**Begin function******************************************************************************
504  inline ConstIterator begin() const {
505  return ConstIterator( lhs_.begin(), rhs_.begin() );
506  }
507  //**********************************************************************************************
508 
509  //**End function********************************************************************************
514  inline ConstIterator end() const {
515  return ConstIterator( lhs_.end(), rhs_.end() );
516  }
517  //**********************************************************************************************
518 
519  //**Size function*******************************************************************************
524  inline size_t size() const noexcept {
525  return lhs_.size();
526  }
527  //**********************************************************************************************
528 
529  //**Left operand access*************************************************************************
534  inline LeftOperand leftOperand() const noexcept {
535  return lhs_;
536  }
537  //**********************************************************************************************
538 
539  //**Right operand access************************************************************************
544  inline RightOperand rightOperand() const noexcept {
545  return rhs_;
546  }
547  //**********************************************************************************************
548 
549  //**********************************************************************************************
555  template< typename T >
556  inline bool canAlias( const T* alias ) const noexcept {
557  return ( IsExpression<VT1>::value && ( RequiresEvaluation<VT1>::value ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
558  ( IsExpression<VT2>::value && ( RequiresEvaluation<VT2>::value ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
559  }
560  //**********************************************************************************************
561 
562  //**********************************************************************************************
568  template< typename T >
569  inline bool isAliased( const T* alias ) const noexcept {
570  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
571  }
572  //**********************************************************************************************
573 
574  //**********************************************************************************************
579  inline bool isAligned() const noexcept {
580  return lhs_.isAligned() && rhs_.isAligned();
581  }
582  //**********************************************************************************************
583 
584  //**********************************************************************************************
589  inline bool canSMPAssign() const noexcept {
590  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
591  ( size() > SMP_DVECDVECADD_THRESHOLD );
592  }
593  //**********************************************************************************************
594 
595  private:
596  //**Member variables****************************************************************************
599  //**********************************************************************************************
600 
601  //**Assignment to dense vectors*****************************************************************
615  template< typename VT > // Type of the target dense vector
616  friend inline EnableIf_< UseAssign<VT> >
617  assign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
618  {
620 
621  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
622 
623  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
624  addAssign( ~lhs, rhs.rhs_ );
625  }
626  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
627  addAssign( ~lhs, rhs.lhs_ );
628  }
629  else {
630  assign ( ~lhs, rhs.lhs_ );
631  addAssign( ~lhs, rhs.rhs_ );
632  }
633  }
635  //**********************************************************************************************
636 
637  //**Assignment to sparse vectors****************************************************************
651  template< typename VT > // Type of the target sparse vector
652  friend inline EnableIf_< UseAssign<VT> >
653  assign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
654  {
656 
660 
661  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
662 
663  const ResultType tmp( serial( rhs ) );
664  assign( ~lhs, tmp );
665  }
667  //**********************************************************************************************
668 
669  //**Addition assignment to dense vectors********************************************************
683  template< typename VT > // Type of the target dense vector
684  friend inline EnableIf_< UseAssign<VT> >
685  addAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
686  {
688 
689  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
690 
691  addAssign( ~lhs, rhs.lhs_ );
692  addAssign( ~lhs, rhs.rhs_ );
693  }
695  //**********************************************************************************************
696 
697  //**Addition assignment to sparse vectors*******************************************************
698  // No special implementation for the addition assignment to sparse vectors.
699  //**********************************************************************************************
700 
701  //**Subtraction assignment to dense vectors*****************************************************
715  template< typename VT > // Type of the target dense vector
716  friend inline EnableIf_< UseAssign<VT> >
717  subAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
718  {
720 
721  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
722 
723  subAssign( ~lhs, rhs.lhs_ );
724  subAssign( ~lhs, rhs.rhs_ );
725  }
727  //**********************************************************************************************
728 
729  //**Subtraction assignment to sparse vectors****************************************************
730  // No special implementation for the subtraction assignment to sparse vectors.
731  //**********************************************************************************************
732 
733  //**Multiplication assignment to dense vectors**************************************************
747  template< typename VT > // Type of the target dense vector
748  friend inline EnableIf_< UseAssign<VT> >
749  multAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
750  {
752 
756 
757  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
758 
759  const ResultType tmp( serial( rhs ) );
760  multAssign( ~lhs, tmp );
761  }
763  //**********************************************************************************************
764 
765  //**Multiplication assignment to sparse vectors*************************************************
766  // No special implementation for the multiplication assignment to sparse vectors.
767  //**********************************************************************************************
768 
769  //**Division assignment to dense vectors********************************************************
783  template< typename VT > // Type of the target dense vector
784  friend inline EnableIf_< UseAssign<VT> >
785  divAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
786  {
788 
792 
793  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
794 
795  const ResultType tmp( serial( rhs ) );
796  divAssign( ~lhs, tmp );
797  }
799  //**********************************************************************************************
800 
801  //**Division assignment to sparse vectors*******************************************************
802  // No special implementation for the division assignment to sparse vectors.
803  //**********************************************************************************************
804 
805  //**SMP assignment to dense vectors*************************************************************
819  template< typename VT > // Type of the target dense vector
820  friend inline EnableIf_< UseSMPAssign<VT> >
821  smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
822  {
824 
825  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
826 
827  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
828  smpAddAssign( ~lhs, rhs.rhs_ );
829  }
830  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
831  smpAddAssign( ~lhs, rhs.lhs_ );
832  }
833  else {
834  smpAssign ( ~lhs, rhs.lhs_ );
835  smpAddAssign( ~lhs, rhs.rhs_ );
836  }
837  }
839  //**********************************************************************************************
840 
841  //**SMP assignment to sparse vectors************************************************************
855  template< typename VT > // Type of the target sparse vector
856  friend inline EnableIf_< UseSMPAssign<VT> >
857  smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
858  {
860 
864 
865  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
866 
867  const ResultType tmp( rhs );
868  smpAssign( ~lhs, tmp );
869  }
871  //**********************************************************************************************
872 
873  //**SMP addition assignment to dense vectors****************************************************
887  template< typename VT > // Type of the target dense vector
888  friend inline EnableIf_< UseSMPAssign<VT> >
890  {
892 
893  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
894 
895  smpAddAssign( ~lhs, rhs.lhs_ );
896  smpAddAssign( ~lhs, rhs.rhs_ );
897  }
899  //**********************************************************************************************
900 
901  //**SMP addition assignment to sparse vectors***************************************************
902  // No special implementation for the SMP addition assignment to sparse vectors.
903  //**********************************************************************************************
904 
905  //**SMP subtraction assignment to dense vectors*************************************************
919  template< typename VT > // Type of the target dense vector
920  friend inline EnableIf_< UseSMPAssign<VT> >
922  {
924 
925  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
926 
927  smpSubAssign( ~lhs, rhs.lhs_ );
928  smpSubAssign( ~lhs, rhs.rhs_ );
929  }
931  //**********************************************************************************************
932 
933  //**SMP subtraction assignment to sparse vectors************************************************
934  // No special implementation for the SMP subtraction assignment to sparse vectors.
935  //**********************************************************************************************
936 
937  //**SMP multiplication assignment to dense vectors**********************************************
951  template< typename VT > // Type of the target dense vector
952  friend inline EnableIf_< UseSMPAssign<VT> >
954  {
956 
960 
961  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
962 
963  const ResultType tmp( rhs );
964  smpMultAssign( ~lhs, tmp );
965  }
967  //**********************************************************************************************
968 
969  //**SMP multiplication assignment to sparse vectors*********************************************
970  // No special implementation for the SMP multiplication assignment to sparse vectors.
971  //**********************************************************************************************
972 
973  //**SMP division assignment to dense vectors****************************************************
987  template< typename VT > // Type of the target dense vector
988  friend inline EnableIf_< UseSMPAssign<VT> >
990  {
992 
996 
997  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
998 
999  const ResultType tmp( rhs );
1000  smpDivAssign( ~lhs, tmp );
1001  }
1003  //**********************************************************************************************
1004 
1005  //**SMP division assignment to sparse vectors***************************************************
1006  // No special implementation for the SMP division assignment to sparse vectors.
1007  //**********************************************************************************************
1008 
1009  //**Compile time checks*************************************************************************
1017  //**********************************************************************************************
1018 };
1019 //*************************************************************************************************
1020 
1021 
1022 
1023 
1024 //=================================================================================================
1025 //
1026 // GLOBAL BINARY ARITHMETIC OPERATORS
1027 //
1028 //=================================================================================================
1029 
1030 //*************************************************************************************************
1054 template< typename VT1 // Type of the left-hand side dense vector
1055  , typename VT2 // Type of the right-hand side dense vector
1056  , bool TF > // Transpose flag
1057 inline decltype(auto)
1058  operator+( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1059 {
1061 
1062  if( (~lhs).size() != (~rhs).size() ) {
1063  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1064  }
1065 
1067  return ReturnType( ~lhs, ~rhs );
1068 }
1069 //*************************************************************************************************
1070 
1071 
1072 
1073 
1074 //=================================================================================================
1075 //
1076 // SIZE SPECIALIZATIONS
1077 //
1078 //=================================================================================================
1079 
1080 //*************************************************************************************************
1082 template< typename VT1, typename VT2, bool TF >
1083 struct Size< DVecDVecAddExpr<VT1,VT2,TF> >
1084  : public Maximum< Size<VT1>, Size<VT2> >
1085 {};
1087 //*************************************************************************************************
1088 
1089 
1090 
1091 
1092 //=================================================================================================
1093 //
1094 // ISALIGNED SPECIALIZATIONS
1095 //
1096 //=================================================================================================
1097 
1098 //*************************************************************************************************
1100 template< typename VT1, typename VT2, bool TF >
1101 struct IsAligned< DVecDVecAddExpr<VT1,VT2,TF> >
1102  : public BoolConstant< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1103 {};
1105 //*************************************************************************************************
1106 
1107 
1108 
1109 
1110 //=================================================================================================
1111 //
1112 // ISPADDED SPECIALIZATIONS
1113 //
1114 //=================================================================================================
1115 
1116 //*************************************************************************************************
1118 template< typename VT1, typename VT2, bool TF >
1119 struct IsPadded< DVecDVecAddExpr<VT1,VT2,TF> >
1120  : public BoolConstant< And< IsPadded<VT1>, IsPadded<VT2> >::value >
1121 {};
1123 //*************************************************************************************************
1124 
1125 } // namespace blaze
1126 
1127 #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:184
Pointer difference type of the Blaze library.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:188
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecAddExpr.h:214
Header file for auxiliary alias declarations.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:349
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
BLAZE_ALWAYS_INLINE 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:786
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:579
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:166
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecAddExpr.h:382
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:191
AddTrait_< RE1, RE2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:164
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.
IfTrue_< useAssign, const ResultType, const DVecDVecAddExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:172
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:327
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:524
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
If_< IsExpression< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:175
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
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:514
Header file for the And class template.
Compile time value evaluation.The Maximum alias declaration selects the larger of the two given templ...
Definition: Maximum.h:73
Header file for the DenseVector base class.
Availability of a SIMD addition for the given data types.Depending on the available instruction set (...
Definition: HasSIMDAdd.h:171
Header file for the AddExprTrait class template.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:569
ConstIterator_< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:205
Header file for the Computation base class.
RightOperand rhs_
Right-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:598
Header file for the RequiresEvaluation type trait.
ResultType_< VT1 > RE1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:104
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
ElementType_< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:110
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
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecAddExpr.h:478
Constraint on the data type.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:239
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
Header file for the Maximum class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecAddExpr.h:406
ReturnType_< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
Header file for the IsTemporary type trait class.
typename AddExprTrait< T1, T2 >::Type AddExprTrait_
Auxiliary alias declaration for the AddExprTrait class template.The AddExprTrait_ alias declaration p...
Definition: AddExprTrait.h:112
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#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:534
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecAddExpr.h:273
Header file for the VecVecAddExpr base class.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:196
If_< IsExpression< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:178
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
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
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:305
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:589
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:371
#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:108
Header file for the HasSIMDAdd type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
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:70
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecAddExpr.h:426
Header file for the IsAligned type trait.
Constraint on the data type.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:360
DVecDVecAddExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecAddExpr class.
Definition: DVecDVecAddExpr.h:451
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:556
ReferenceType reference
Reference return type.
Definition: DVecDVecAddExpr.h:198
Constraint on the data type.
ElementType * PointerType
Pointer return type.
Definition: DVecDVecAddExpr.h:190
Header file for the exception macros of the math module.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:226
Constraint on the data type.
Header file for all forward declarations for expression class templates.
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:492
Header file for the EnableIf class template.
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:107
Header file for the IsPadded type trait.
Constraint on the data type.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecAddExpr.h:285
PointerType pointer
Pointer return type.
Definition: DVecDVecAddExpr.h:197
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:544
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:169
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecAddExpr.h:465
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:295
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:338
Header file for run time assertion macros.
ResultType_< VT2 > RE2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:105
Header file for the addition trait.
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
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
#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
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:263
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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:425
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:597
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:418
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Expression object for dense vector-dense vector additions.The DVecDVecAddExpr class represents the co...
Definition: DVecDVecAddExpr.h:98
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:394
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:189
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:316
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecAddExpr.h:251
Header file for the IsComputation type trait class.
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:74
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecAddExpr.h:165
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
Header file for the IntegralConstant class template.
ConstIterator_< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:202
CompositeType_< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:108
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:504
AddExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecAddExpr.h:124
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:111
Constraint on the data type.
System settings for the inline keywords.
Header file for the Size type trait.
#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.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:250
#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
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:195
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:95
Header file for the IsExpression type trait class.
Header file for the function trace functionality.