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>
48 #include <blaze/math/Exception.h>
54 #include <blaze/math/SIMD.h>
66 #include <blaze/system/Inline.h>
68 #include <blaze/util/Assert.h>
72 #include <blaze/util/EnableIf.h>
75 #include <blaze/util/mpl/And.h>
76 #include <blaze/util/mpl/If.h>
77 #include <blaze/util/mpl/Max.h>
78 #include <blaze/util/Types.h>
79 
80 
81 namespace blaze {
82 
83 //=================================================================================================
84 //
85 // CLASS DVECDVECADDEXPR
86 //
87 //=================================================================================================
88 
89 //*************************************************************************************************
96 template< typename VT1 // Type of the left-hand side dense vector
97  , typename VT2 // Type of the right-hand side dense vector
98  , bool TF > // Transpose flag
99 class DVecDVecAddExpr : public DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF >
100  , private VecVecAddExpr
101  , private Computation
102 {
103  private:
104  //**Type definitions****************************************************************************
113  //**********************************************************************************************
114 
115  //**Return type evaluation**********************************************************************
117 
122  enum : bool { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
123 
126  //**********************************************************************************************
127 
128  //**Serial evaluation strategy******************************************************************
130 
136  enum : bool { useAssign = ( RequiresEvaluation<VT1>::value || RequiresEvaluation<VT2>::value || !returnExpr ) };
137 
139  template< typename VT >
141  struct UseAssign {
142  enum : bool { value = useAssign };
143  };
145  //**********************************************************************************************
146 
147  //**Parallel evaluation strategy****************************************************************
149 
155  template< typename VT >
156  struct UseSMPAssign {
157  enum : bool { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
158  };
160  //**********************************************************************************************
161 
162  public:
163  //**Type definitions****************************************************************************
168 
171 
174 
176  typedef If_< IsExpression<VT1>, const VT1, const VT1& > LeftOperand;
177 
179  typedef If_< IsExpression<VT2>, const VT2, const VT2& > RightOperand;
180  //**********************************************************************************************
181 
182  //**ConstIterator class definition**************************************************************
186  {
187  public:
188  //**Type definitions*************************************************************************
189  typedef std::random_access_iterator_tag IteratorCategory;
190  typedef ElementType ValueType;
191  typedef ElementType* PointerType;
192  typedef ElementType& ReferenceType;
194 
195  // STL iterator requirements
196  typedef IteratorCategory iterator_category;
197  typedef ValueType value_type;
198  typedef PointerType pointer;
199  typedef ReferenceType reference;
200  typedef DifferenceType difference_type;
201 
204 
207  //*******************************************************************************************
208 
209  //**Constructor******************************************************************************
215  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
216  : left_ ( left ) // Iterator to the current left-hand side element
217  , right_( right ) // Iterator to the current right-hand side element
218  {}
219  //*******************************************************************************************
220 
221  //**Addition assignment operator*************************************************************
227  inline ConstIterator& operator+=( size_t inc ) {
228  left_ += inc;
229  right_ += inc;
230  return *this;
231  }
232  //*******************************************************************************************
233 
234  //**Subtraction assignment operator**********************************************************
240  inline ConstIterator& operator-=( size_t dec ) {
241  left_ -= dec;
242  right_ -= dec;
243  return *this;
244  }
245  //*******************************************************************************************
246 
247  //**Prefix increment operator****************************************************************
253  ++left_;
254  ++right_;
255  return *this;
256  }
257  //*******************************************************************************************
258 
259  //**Postfix increment operator***************************************************************
264  inline const ConstIterator operator++( int ) {
265  return ConstIterator( left_++, right_++ );
266  }
267  //*******************************************************************************************
268 
269  //**Prefix decrement operator****************************************************************
275  --left_;
276  --right_;
277  return *this;
278  }
279  //*******************************************************************************************
280 
281  //**Postfix decrement operator***************************************************************
286  inline const ConstIterator operator--( int ) {
287  return ConstIterator( left_--, right_-- );
288  }
289  //*******************************************************************************************
290 
291  //**Element access operator******************************************************************
296  inline ReturnType operator*() const {
297  return (*left_) + (*right_);
298  }
299  //*******************************************************************************************
300 
301  //**Load function****************************************************************************
306  inline auto load() const noexcept {
307  return left_.load() + right_.load();
308  }
309  //*******************************************************************************************
310 
311  //**Equality operator************************************************************************
317  inline bool operator==( const ConstIterator& rhs ) const {
318  return left_ == rhs.left_;
319  }
320  //*******************************************************************************************
321 
322  //**Inequality operator**********************************************************************
328  inline bool operator!=( const ConstIterator& rhs ) const {
329  return left_ != rhs.left_;
330  }
331  //*******************************************************************************************
332 
333  //**Less-than operator***********************************************************************
339  inline bool operator<( const ConstIterator& rhs ) const {
340  return left_ < rhs.left_;
341  }
342  //*******************************************************************************************
343 
344  //**Greater-than operator********************************************************************
350  inline bool operator>( const ConstIterator& rhs ) const {
351  return left_ > rhs.left_;
352  }
353  //*******************************************************************************************
354 
355  //**Less-or-equal-than operator**************************************************************
361  inline bool operator<=( const ConstIterator& rhs ) const {
362  return left_ <= rhs.left_;
363  }
364  //*******************************************************************************************
365 
366  //**Greater-or-equal-than operator***********************************************************
372  inline bool operator>=( const ConstIterator& rhs ) const {
373  return left_ >= rhs.left_;
374  }
375  //*******************************************************************************************
376 
377  //**Subtraction operator*********************************************************************
383  inline DifferenceType operator-( const ConstIterator& rhs ) const {
384  return left_ - rhs.left_;
385  }
386  //*******************************************************************************************
387 
388  //**Addition operator************************************************************************
395  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
396  return ConstIterator( it.left_ + inc, it.right_ + inc );
397  }
398  //*******************************************************************************************
399 
400  //**Addition operator************************************************************************
407  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
408  return ConstIterator( it.left_ + inc, it.right_ + inc );
409  }
410  //*******************************************************************************************
411 
412  //**Subtraction operator*********************************************************************
419  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
420  return ConstIterator( it.left_ - dec, it.right_ - dec );
421  }
422  //*******************************************************************************************
423 
424  private:
425  //**Member variables*************************************************************************
426  LeftIteratorType left_;
427  RightIteratorType right_;
428  //*******************************************************************************************
429  };
430  //**********************************************************************************************
431 
432  //**Compilation flags***************************************************************************
434  enum : bool { simdEnabled = VT1::simdEnabled && VT2::simdEnabled &&
436 
438  enum : bool { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
439  //**********************************************************************************************
440 
441  //**SIMD properties*****************************************************************************
443  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
444  //**********************************************************************************************
445 
446  //**Constructor*********************************************************************************
452  explicit inline DVecDVecAddExpr( const VT1& lhs, const VT2& rhs ) noexcept
453  : lhs_( lhs ) // Left-hand side dense vector of the addition expression
454  , rhs_( rhs ) // Right-hand side dense vector of the addition expression
455  {
456  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
457  }
458  //**********************************************************************************************
459 
460  //**Subscript operator**************************************************************************
466  inline ReturnType operator[]( size_t index ) const {
467  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
468  return lhs_[index] + rhs_[index];
469  }
470  //**********************************************************************************************
471 
472  //**At function*********************************************************************************
479  inline ReturnType at( size_t index ) const {
480  if( index >= lhs_.size() ) {
481  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
482  }
483  return (*this)[index];
484  }
485  //**********************************************************************************************
486 
487  //**Load function*******************************************************************************
493  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
494  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
495  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
496  return lhs_.load( index ) + rhs_.load( index );
497  }
498  //**********************************************************************************************
499 
500  //**Begin function******************************************************************************
505  inline ConstIterator begin() const {
506  return ConstIterator( lhs_.begin(), rhs_.begin() );
507  }
508  //**********************************************************************************************
509 
510  //**End function********************************************************************************
515  inline ConstIterator end() const {
516  return ConstIterator( lhs_.end(), rhs_.end() );
517  }
518  //**********************************************************************************************
519 
520  //**Size function*******************************************************************************
525  inline size_t size() const noexcept {
526  return lhs_.size();
527  }
528  //**********************************************************************************************
529 
530  //**Left operand access*************************************************************************
535  inline LeftOperand leftOperand() const noexcept {
536  return lhs_;
537  }
538  //**********************************************************************************************
539 
540  //**Right operand access************************************************************************
545  inline RightOperand rightOperand() const noexcept {
546  return rhs_;
547  }
548  //**********************************************************************************************
549 
550  //**********************************************************************************************
556  template< typename T >
557  inline bool canAlias( const T* alias ) const noexcept {
558  return ( IsExpression<VT1>::value && ( RequiresEvaluation<VT1>::value ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
559  ( IsExpression<VT2>::value && ( RequiresEvaluation<VT2>::value ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
560  }
561  //**********************************************************************************************
562 
563  //**********************************************************************************************
569  template< typename T >
570  inline bool isAliased( const T* alias ) const noexcept {
571  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
572  }
573  //**********************************************************************************************
574 
575  //**********************************************************************************************
580  inline bool isAligned() const noexcept {
581  return lhs_.isAligned() && rhs_.isAligned();
582  }
583  //**********************************************************************************************
584 
585  //**********************************************************************************************
590  inline bool canSMPAssign() const noexcept {
591  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
592  ( size() > SMP_DVECDVECADD_THRESHOLD );
593  }
594  //**********************************************************************************************
595 
596  private:
597  //**Member variables****************************************************************************
598  LeftOperand lhs_;
599  RightOperand rhs_;
600  //**********************************************************************************************
601 
602  //**Assignment to dense vectors*****************************************************************
616  template< typename VT > // Type of the target dense vector
617  friend inline EnableIf_< UseAssign<VT> >
618  assign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
619  {
621 
622  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
623 
624  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
625  addAssign( ~lhs, rhs.rhs_ );
626  }
627  else if( !IsComputation<VT2>::value && isSame( ~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 EnableIf_< UseAssign<VT> >
654  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 EnableIf_< UseAssign<VT> >
686  addAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
687  {
689 
690  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
691 
692  addAssign( ~lhs, rhs.lhs_ );
693  addAssign( ~lhs, rhs.rhs_ );
694  }
696  //**********************************************************************************************
697 
698  //**Addition assignment to sparse vectors*******************************************************
699  // No special implementation for the addition assignment to sparse vectors.
700  //**********************************************************************************************
701 
702  //**Subtraction assignment to dense vectors*****************************************************
716  template< typename VT > // Type of the target dense vector
717  friend inline EnableIf_< UseAssign<VT> >
718  subAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
719  {
721 
722  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
723 
724  subAssign( ~lhs, rhs.lhs_ );
725  subAssign( ~lhs, rhs.rhs_ );
726  }
728  //**********************************************************************************************
729 
730  //**Subtraction assignment to sparse vectors****************************************************
731  // No special implementation for the subtraction assignment to sparse vectors.
732  //**********************************************************************************************
733 
734  //**Multiplication assignment to dense vectors**************************************************
748  template< typename VT > // Type of the target dense vector
749  friend inline EnableIf_< UseAssign<VT> >
750  multAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
751  {
753 
756  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
757 
758  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
759 
760  const ResultType tmp( serial( rhs ) );
761  multAssign( ~lhs, tmp );
762  }
764  //**********************************************************************************************
765 
766  //**Multiplication assignment to sparse vectors*************************************************
767  // No special implementation for the multiplication assignment to sparse vectors.
768  //**********************************************************************************************
769 
770  //**Division assignment to dense vectors********************************************************
784  template< typename VT > // Type of the target dense vector
785  friend inline EnableIf_< UseAssign<VT> >
786  divAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
787  {
789 
792  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
793 
794  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
795 
796  const ResultType tmp( serial( rhs ) );
797  divAssign( ~lhs, tmp );
798  }
800  //**********************************************************************************************
801 
802  //**Division assignment to sparse vectors*******************************************************
803  // No special implementation for the division assignment to sparse vectors.
804  //**********************************************************************************************
805 
806  //**SMP assignment to dense vectors*************************************************************
820  template< typename VT > // Type of the target dense vector
821  friend inline EnableIf_< UseSMPAssign<VT> >
822  smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
823  {
825 
826  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
827 
828  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
829  smpAddAssign( ~lhs, rhs.rhs_ );
830  }
831  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
832  smpAddAssign( ~lhs, rhs.lhs_ );
833  }
834  else {
835  smpAssign ( ~lhs, rhs.lhs_ );
836  smpAddAssign( ~lhs, rhs.rhs_ );
837  }
838  }
840  //**********************************************************************************************
841 
842  //**SMP assignment to sparse vectors************************************************************
856  template< typename VT > // Type of the target sparse vector
857  friend inline EnableIf_< UseSMPAssign<VT> >
858  smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
859  {
861 
864  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
865 
866  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
867 
868  const ResultType tmp( rhs );
869  smpAssign( ~lhs, tmp );
870  }
872  //**********************************************************************************************
873 
874  //**SMP addition assignment to dense vectors****************************************************
888  template< typename VT > // Type of the target dense vector
889  friend inline EnableIf_< UseSMPAssign<VT> >
890  smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
891  {
893 
894  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
895 
896  smpAddAssign( ~lhs, rhs.lhs_ );
897  smpAddAssign( ~lhs, rhs.rhs_ );
898  }
900  //**********************************************************************************************
901 
902  //**SMP addition assignment to sparse vectors***************************************************
903  // No special implementation for the SMP addition assignment to sparse vectors.
904  //**********************************************************************************************
905 
906  //**SMP subtraction assignment to dense vectors*************************************************
920  template< typename VT > // Type of the target dense vector
921  friend inline EnableIf_< UseSMPAssign<VT> >
922  smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
923  {
925 
926  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
927 
928  smpSubAssign( ~lhs, rhs.lhs_ );
929  smpSubAssign( ~lhs, rhs.rhs_ );
930  }
932  //**********************************************************************************************
933 
934  //**SMP subtraction assignment to sparse vectors************************************************
935  // No special implementation for the SMP subtraction assignment to sparse vectors.
936  //**********************************************************************************************
937 
938  //**SMP multiplication assignment to dense vectors**********************************************
952  template< typename VT > // Type of the target dense vector
953  friend inline EnableIf_< UseSMPAssign<VT> >
954  smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
955  {
957 
960  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
961 
962  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
963 
964  const ResultType tmp( rhs );
965  smpMultAssign( ~lhs, tmp );
966  }
968  //**********************************************************************************************
969 
970  //**SMP multiplication assignment to sparse vectors*********************************************
971  // No special implementation for the SMP multiplication assignment to sparse vectors.
972  //**********************************************************************************************
973 
974  //**SMP division assignment to dense vectors****************************************************
988  template< typename VT > // Type of the target dense vector
989  friend inline EnableIf_< UseSMPAssign<VT> >
990  smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
991  {
993 
996  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
997 
998  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
999 
1000  const ResultType tmp( rhs );
1001  smpDivAssign( ~lhs, tmp );
1002  }
1004  //**********************************************************************************************
1005 
1006  //**SMP division assignment to sparse vectors***************************************************
1007  // No special implementation for the SMP division assignment to sparse vectors.
1008  //**********************************************************************************************
1009 
1010  //**Compile time checks*************************************************************************
1018  //**********************************************************************************************
1019 };
1020 //*************************************************************************************************
1021 
1022 
1023 
1024 
1025 //=================================================================================================
1026 //
1027 // GLOBAL BINARY ARITHMETIC OPERATORS
1028 //
1029 //=================================================================================================
1030 
1031 //*************************************************************************************************
1055 template< typename T1 // Type of the left-hand side dense vector
1056  , typename T2 // Type of the right-hand side dense vector
1057  , bool TF > // Transpose flag
1058 inline const DVecDVecAddExpr<T1,T2,TF>
1060 {
1062 
1063  if( (~lhs).size() != (~rhs).size() ) {
1064  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1065  }
1066 
1067  return DVecDVecAddExpr<T1,T2,TF>( ~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 Max< 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 
1126 
1127 
1128 //=================================================================================================
1129 //
1130 // EXPRESSION TRAIT SPECIALIZATIONS
1131 //
1132 //=================================================================================================
1133 
1134 //*************************************************************************************************
1136 template< typename VT1, typename VT2, bool TF, bool AF >
1137 struct SubvectorExprTrait< DVecDVecAddExpr<VT1,VT2,TF>, AF >
1138 {
1139  public:
1140  //**********************************************************************************************
1141  using Type = AddExprTrait_< SubvectorExprTrait_<const VT1,AF>
1142  , SubvectorExprTrait_<const VT2,AF> >;
1143  //**********************************************************************************************
1144 };
1146 //*************************************************************************************************
1147 
1148 } // namespace blaze
1149 
1150 #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:185
Pointer difference type of the Blaze library.
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecAddExpr.h:215
Header file for auxiliary alias declarations.
Header file for the Max class template.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
AddExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecAddExpr.h:125
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecAddExpr.h:383
PointerType pointer
Pointer return type.
Definition: DVecDVecAddExpr.h:198
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecAddExpr.h:166
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:653
Header file for basic type definitions.
IfTrue_< useAssign, const ResultType, const DVecDVecAddExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:173
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:196
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:505
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:190
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
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:317
If_< IsExpression< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:176
Header file for the And class template.
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:162
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:296
Header file for the AddExprTrait class template.
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:112
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
DVecDVecAddExpr< VT1, VT2, TF > This
Type of this DVecDVecAddExpr instance.
Definition: DVecDVecAddExpr.h:164
CompositeType_< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:109
Header file for the Computation base class.
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:108
RightOperand rhs_
Right-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:599
Header file for the RequiresEvaluation type trait.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecAddExpr.h:479
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:189
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
Constraint on the data type.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:240
If_< IsExpression< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:179
ConstIterator_< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:203
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:407
ConstIterator_< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:206
Header file for the IsTemporary type trait class.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecAddExpr.h:193
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:361
typename AddExprTrait< T1, T2 >::Type AddExprTrait_
Auxiliary alias declaration for the AddExprTrait class template.The AddExprTrait_ alias declaration p...
Definition: AddExprTrait.h:219
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.
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecAddExpr.h:274
Header file for the VecVecAddExpr base class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:350
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
#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:109
Header file for the HasSIMDAdd type trait.
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:545
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:170
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:192
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:427
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:452
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
Constraint on the data type.
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:493
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:535
Header file for the exception macros of the math module.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:227
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:65
Header file for the EnableIf class template.
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:110
Header file for the IsPadded type trait.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:525
Constraint on the data type.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecAddExpr.h:286
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:515
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:590
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:372
Header file for run time assertion macros.
ElementType * PointerType
Pointer return type.
Definition: DVecDVecAddExpr.h:191
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:557
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:160
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:570
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:306
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
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:264
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:167
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecAddExpr.h:580
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecAddExpr.h:426
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:598
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:419
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Expression object for dense vector-dense vector additions.The DVecDVecAddExpr class represents the co...
Definition: DVecDVecAddExpr.h:99
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:395
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecAddExpr.h:466
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
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:197
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:328
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecAddExpr.h:252
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecAddExpr.h:200
Header file for the IsComputation type trait class.
ElementType_< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:111
AddTrait_< RE1, RE2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:165
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:339
Header file for the IntegralConstant class template.
Header file for the SubvectorExprTrait class template.
ReturnType_< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:107
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
ResultType_< VT2 > RE2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
Constraint on the data type.
System settings for the inline keywords.
ResultType_< VT1 > RE1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:105
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:245
#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
ReferenceType reference
Reference return type.
Definition: DVecDVecAddExpr.h:199
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:71
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.