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>
51 #include <blaze/math/Intrinsics.h>
63 #include <blaze/system/Inline.h>
65 #include <blaze/util/Assert.h>
69 #include <blaze/util/EnableIf.h>
70 #include <blaze/util/Exception.h>
72 #include <blaze/util/mpl/And.h>
73 #include <blaze/util/mpl/Max.h>
74 #include <blaze/util/SelectType.h>
75 #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
98 class DVecDVecAddExpr : public DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF >
99  , private VecVecAddExpr
100  , private Computation
101 {
102  private:
103  //**Type definitions****************************************************************************
104  typedef typename VT1::ResultType RE1;
105  typedef typename VT2::ResultType RE2;
106  typedef typename VT1::ReturnType RN1;
107  typedef typename VT2::ReturnType RN2;
108  typedef typename VT1::CompositeType CT1;
109  typedef typename VT2::CompositeType CT2;
110  typedef typename VT1::ElementType ET1;
111  typedef typename VT2::ElementType ET2;
112  //**********************************************************************************************
113 
114  //**Return type evaluation**********************************************************************
116 
121  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
122 
125  //**********************************************************************************************
126 
127  //**Serial evaluation strategy******************************************************************
129 
135  enum { useAssign = ( RequiresEvaluation<VT1>::value || RequiresEvaluation<VT2>::value || !returnExpr ) };
136 
138  template< typename VT >
140  struct UseAssign {
141  enum { value = useAssign };
142  };
144  //**********************************************************************************************
145 
146  //**Parallel evaluation strategy****************************************************************
148 
154  template< typename VT >
155  struct UseSMPAssign {
156  enum { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
157  };
159  //**********************************************************************************************
160 
161  public:
162  //**Type definitions****************************************************************************
168 
171 
174 
176  typedef typename SelectType< IsExpression<VT1>::value, const VT1, const VT1& >::Type LeftOperand;
177 
179  typedef typename SelectType< IsExpression<VT2>::value, const VT2, const VT2& >::Type 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 IntrinsicType load() const {
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 { vectorizable = VT1::vectorizable && VT2::vectorizable &&
437 
439  enum { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
440  //**********************************************************************************************
441 
442  //**Constructor*********************************************************************************
448  explicit inline DVecDVecAddExpr( const VT1& lhs, const VT2& rhs )
449  : lhs_( lhs ) // Left-hand side dense vector of the addition expression
450  , rhs_( rhs ) // Right-hand side dense vector of the addition expression
451  {
452  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
453  }
454  //**********************************************************************************************
455 
456  //**Subscript operator**************************************************************************
462  inline ReturnType operator[]( size_t index ) const {
463  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
464  return lhs_[index] + rhs_[index];
465  }
466  //**********************************************************************************************
467 
468  //**At function*********************************************************************************
475  inline ReturnType at( size_t index ) const {
476  if( index >= lhs_.size() ) {
477  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
478  }
479  return (*this)[index];
480  }
481  //**********************************************************************************************
482 
483  //**Load function*******************************************************************************
489  BLAZE_ALWAYS_INLINE IntrinsicType load( size_t index ) const {
490  typedef IntrinsicTrait<ElementType> IT;
491  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
492  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
493  const IntrinsicType xmm1( lhs_.load( index ) );
494  const IntrinsicType xmm2( rhs_.load( index ) );
495  return xmm1 + xmm2;
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 {
525  return lhs_.size();
526  }
527  //**********************************************************************************************
528 
529  //**Left operand access*************************************************************************
534  inline LeftOperand leftOperand() const {
535  return lhs_;
536  }
537  //**********************************************************************************************
538 
539  //**Right operand access************************************************************************
544  inline RightOperand rightOperand() const {
545  return rhs_;
546  }
547  //**********************************************************************************************
548 
549  //**********************************************************************************************
555  template< typename T >
556  inline bool canAlias( const T* alias ) const {
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 {
570  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
571  }
572  //**********************************************************************************************
573 
574  //**********************************************************************************************
579  inline bool isAligned() const {
580  return lhs_.isAligned() && rhs_.isAligned();
581  }
582  //**********************************************************************************************
583 
584  //**********************************************************************************************
589  inline bool canSMPAssign() const {
590  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
591  ( size() > SMP_DVECDVECADD_THRESHOLD );
592  }
593  //**********************************************************************************************
594 
595  private:
596  //**Member variables****************************************************************************
597  LeftOperand lhs_;
598  RightOperand rhs_;
599  //**********************************************************************************************
600 
601  //**Assignment to dense vectors*****************************************************************
615  template< typename VT > // Type of the target dense vector
616  friend inline typename EnableIf< UseAssign<VT> >::Type
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 typename EnableIf< UseAssign<VT> >::Type
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 typename EnableIf< UseAssign<VT> >::Type
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 typename EnableIf< UseAssign<VT> >::Type
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 typename EnableIf< UseAssign<VT> >::Type
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  //**SMP assignment to dense vectors*************************************************************
783  template< typename VT > // Type of the target dense vector
784  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
785  smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
786  {
788 
789  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
790 
791  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
792  smpAddAssign( ~lhs, rhs.rhs_ );
793  }
794  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
795  smpAddAssign( ~lhs, rhs.lhs_ );
796  }
797  else {
798  smpAssign ( ~lhs, rhs.lhs_ );
799  smpAddAssign( ~lhs, rhs.rhs_ );
800  }
801  }
803  //**********************************************************************************************
804 
805  //**SMP assignment to sparse vectors************************************************************
819  template< typename VT > // Type of the target sparse vector
820  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
821  smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
822  {
824 
828 
829  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
830 
831  const ResultType tmp( rhs );
832  smpAssign( ~lhs, tmp );
833  }
835  //**********************************************************************************************
836 
837  //**SMP addition assignment to dense vectors****************************************************
851  template< typename VT > // Type of the target dense vector
852  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
853  smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
854  {
856 
857  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
858 
859  smpAddAssign( ~lhs, rhs.lhs_ );
860  smpAddAssign( ~lhs, rhs.rhs_ );
861  }
863  //**********************************************************************************************
864 
865  //**SMP addition assignment to sparse vectors***************************************************
866  // No special implementation for the SMP addition assignment to sparse vectors.
867  //**********************************************************************************************
868 
869  //**SMP subtraction assignment to dense vectors*************************************************
883  template< typename VT > // Type of the target dense vector
884  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
885  smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
886  {
888 
889  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
890 
891  smpSubAssign( ~lhs, rhs.lhs_ );
892  smpSubAssign( ~lhs, rhs.rhs_ );
893  }
895  //**********************************************************************************************
896 
897  //**SMP subtraction assignment to sparse vectors************************************************
898  // No special implementation for the SMP subtraction assignment to sparse vectors.
899  //**********************************************************************************************
900 
901  //**SMP multiplication assignment to dense vectors**********************************************
915  template< typename VT > // Type of the target dense vector
916  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
917  smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
918  {
920 
924 
925  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
926 
927  const ResultType tmp( rhs );
928  smpMultAssign( ~lhs, tmp );
929  }
931  //**********************************************************************************************
932 
933  //**SMP multiplication assignment to sparse vectors*********************************************
934  // No special implementation for the SMP multiplication assignment to sparse vectors.
935  //**********************************************************************************************
936 
937  //**Compile time checks*************************************************************************
945  //**********************************************************************************************
946 };
947 //*************************************************************************************************
948 
949 
950 
951 
952 //=================================================================================================
953 //
954 // GLOBAL BINARY ARITHMETIC OPERATORS
955 //
956 //=================================================================================================
957 
958 //*************************************************************************************************
982 template< typename T1 // Type of the left-hand side dense vector
983  , typename T2 // Type of the right-hand side dense vector
984  , bool TF > // Transpose flag
985 inline const DVecDVecAddExpr<T1,T2,TF>
987 {
989 
990  if( (~lhs).size() != (~rhs).size() ) {
991  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
992  }
993 
994  return DVecDVecAddExpr<T1,T2,TF>( ~lhs, ~rhs );
995 }
996 //*************************************************************************************************
997 
998 
999 
1000 
1001 //=================================================================================================
1002 //
1003 // SIZE SPECIALIZATIONS
1004 //
1005 //=================================================================================================
1006 
1007 //*************************************************************************************************
1009 template< typename VT1, typename VT2, bool TF >
1010 struct Size< DVecDVecAddExpr<VT1,VT2,TF> >
1011  : public Max< Size<VT1>, Size<VT2> >
1012 {};
1014 //*************************************************************************************************
1015 
1016 
1017 
1018 
1019 //=================================================================================================
1020 //
1021 // ISALIGNED SPECIALIZATIONS
1022 //
1023 //=================================================================================================
1024 
1025 //*************************************************************************************************
1027 template< typename VT1, typename VT2, bool TF >
1028 struct IsAligned< DVecDVecAddExpr<VT1,VT2,TF> >
1029  : public IsTrue< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1030 {};
1032 //*************************************************************************************************
1033 
1034 
1035 
1036 
1037 //=================================================================================================
1038 //
1039 // ISPADDED SPECIALIZATIONS
1040 //
1041 //=================================================================================================
1042 
1043 //*************************************************************************************************
1045 template< typename VT1, typename VT2, bool TF >
1046 struct IsPadded< DVecDVecAddExpr<VT1,VT2,TF> >
1047  : public IsTrue< And< IsPadded<VT1>, IsPadded<VT2> >::value >
1048 {};
1050 //*************************************************************************************************
1051 
1052 
1053 
1054 
1055 //=================================================================================================
1056 //
1057 // EXPRESSION TRAIT SPECIALIZATIONS
1058 //
1059 //=================================================================================================
1060 
1061 //*************************************************************************************************
1063 template< typename VT1, typename VT2, bool TF, bool AF >
1064 struct SubvectorExprTrait< DVecDVecAddExpr<VT1,VT2,TF>, AF >
1065 {
1066  public:
1067  //**********************************************************************************************
1068  typedef typename AddExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
1069  , typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
1070  //**********************************************************************************************
1071 };
1073 //*************************************************************************************************
1074 
1075 } // namespace blaze
1076 
1077 #endif
VT1::ReturnType RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
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 the Max class template.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
Evaluation of the return type of an addition expression.Via this type trait it is possible to evaluat...
Definition: AddExprTrait.h:104
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
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
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:556
Header file for basic type definitions.
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:196
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
VT2::ResultType RE2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:105
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:504
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:647
Header file for the IsSame and IsStrictlySame type traits.
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:524
VT1::ConstIterator LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:203
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:190
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:317
Header file for the And class template.
Header file for the DenseVector base class.
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:176
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:296
Header file for the AddExprTrait class template.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
DVecDVecAddExpr< VT1, VT2, TF > This
Type of this DVecDVecAddExpr instance.
Definition: DVecDVecAddExpr.h:163
Header file for the Computation base class.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:158
RightOperand rhs_
Right-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:598
Header file for the RequiresEvaluation type trait.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecAddExpr.h:475
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:189
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecDVecAddExpr.h:167
Constraint on the data type.
SelectType< useAssign, const ResultType, const DVecDVecAddExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:173
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:534
Constraint on the data type.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:240
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:589
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:261
AddTrait< RE1, RE2 >::Type ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:164
VT1::ResultType RE1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:104
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecAddExpr.h:407
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecAddExpr.h:193
VT1::CompositeType CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:108
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:361
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
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:2592
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:350
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:610
#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:165
VT2::ElementType ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:111
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:170
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecAddExpr.h:579
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:192
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.
#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:78
Constraint on the data type.
AddExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecAddExpr.h:124
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:227
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
VT2::ConstIterator RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:206
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.
Header file for the IsPadded type trait.
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Access to the intrinsic elements of the vector.
Definition: DVecDVecAddExpr.h:489
Header file for the serial shim.
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:514
EnableIf< IsDenseMatrix< MT1 > >::Type 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
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:372
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:138
EnableIf< IsDenseMatrix< MT1 > >::Type 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
ElementType * PointerType
Pointer return type.
Definition: DVecDVecAddExpr.h:191
Header file for the addition trait.
RightOperand rightOperand() const
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:544
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
VT1::ElementType ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:110
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:179
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:264
VT2::ReturnType RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:107
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecAddExpr.h:426
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:419
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:395
Header file for all intrinsic functionality.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecAddExpr.h:462
#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:79
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
VT2::CompositeType CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:109
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:59
EnableIf< IsDenseMatrix< MT1 > >::Type 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
DVecDVecAddExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the DVecDVecAddExpr class.
Definition: DVecDVecAddExpr.h:448
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#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
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecAddExpr.h:165
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:569
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:339
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
Header file for the SubvectorExprTrait class template.
Header file for exception macros.
IntrinsicType load() const
Access to the intrinsic elements of the vector.
Definition: DVecDVecAddExpr.h:306
Constraint on the data type.
System settings for the inline keywords.
EnableIf< IsDenseVector< VT1 > >::Type 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:189
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:81
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, 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:87
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:166