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 <stdexcept>
51 #include <blaze/math/Intrinsics.h>
61 #include <blaze/system/Inline.h>
63 #include <blaze/util/Assert.h>
67 #include <blaze/util/EnableIf.h>
69 #include <blaze/util/mpl/Max.h>
70 #include <blaze/util/SelectType.h>
71 #include <blaze/util/Types.h>
73 
74 
75 namespace blaze {
76 
77 //=================================================================================================
78 //
79 // CLASS DVECDVECADDEXPR
80 //
81 //=================================================================================================
82 
83 //*************************************************************************************************
90 template< typename VT1 // Type of the left-hand side dense vector
91  , typename VT2 // Type of the right-hand side dense vector
92  , bool TF > // Transpose flag
93 class DVecDVecAddExpr : public DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF >
94  , private VecVecAddExpr
95  , private Computation
96 {
97  private:
98  //**Type definitions****************************************************************************
99  typedef typename VT1::ResultType RE1;
100  typedef typename VT2::ResultType RE2;
101  typedef typename VT1::ReturnType RN1;
102  typedef typename VT2::ReturnType RN2;
103  typedef typename VT1::CompositeType CT1;
104  typedef typename VT2::CompositeType CT2;
105  typedef typename VT1::ElementType ET1;
106  typedef typename VT2::ElementType ET2;
107  //**********************************************************************************************
108 
109  //**Return type evaluation**********************************************************************
111 
116  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
117 
120  //**********************************************************************************************
121 
122  //**Serial evaluation strategy******************************************************************
124 
130  enum { useAssign = ( RequiresEvaluation<VT1>::value || RequiresEvaluation<VT2>::value || !returnExpr ) };
131 
133  template< typename VT >
135  struct UseAssign {
136  enum { value = useAssign };
137  };
139  //**********************************************************************************************
140 
141  //**Parallel evaluation strategy****************************************************************
143 
149  template< typename VT >
150  struct UseSMPAssign {
151  enum { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
152  };
154  //**********************************************************************************************
155 
156  public:
157  //**Type definitions****************************************************************************
163 
166 
169 
171  typedef typename SelectType< IsExpression<VT1>::value, const VT1, const VT1& >::Type LeftOperand;
172 
174  typedef typename SelectType< IsExpression<VT2>::value, const VT2, const VT2& >::Type RightOperand;
175  //**********************************************************************************************
176 
177  //**ConstIterator class definition**************************************************************
181  {
182  public:
183  //**Type definitions*************************************************************************
184  typedef std::random_access_iterator_tag IteratorCategory;
185  typedef ElementType ValueType;
186  typedef ElementType* PointerType;
187  typedef ElementType& ReferenceType;
189 
190  // STL iterator requirements
191  typedef IteratorCategory iterator_category;
192  typedef ValueType value_type;
193  typedef PointerType pointer;
194  typedef ReferenceType reference;
195  typedef DifferenceType difference_type;
196 
199 
202  //*******************************************************************************************
203 
204  //**Constructor******************************************************************************
210  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
211  : left_ ( left ) // Iterator to the current left-hand side element
212  , right_( right ) // Iterator to the current right-hand side element
213  {}
214  //*******************************************************************************************
215 
216  //**Addition assignment operator*************************************************************
222  inline ConstIterator& operator+=( size_t inc ) {
223  left_ += inc;
224  right_ += inc;
225  return *this;
226  }
227  //*******************************************************************************************
228 
229  //**Subtraction assignment operator**********************************************************
235  inline ConstIterator& operator-=( size_t dec ) {
236  left_ -= dec;
237  right_ -= dec;
238  return *this;
239  }
240  //*******************************************************************************************
241 
242  //**Prefix increment operator****************************************************************
248  ++left_;
249  ++right_;
250  return *this;
251  }
252  //*******************************************************************************************
253 
254  //**Postfix increment operator***************************************************************
259  inline const ConstIterator operator++( int ) {
260  return ConstIterator( left_++, right_++ );
261  }
262  //*******************************************************************************************
263 
264  //**Prefix decrement operator****************************************************************
270  --left_;
271  --right_;
272  return *this;
273  }
274  //*******************************************************************************************
275 
276  //**Postfix decrement operator***************************************************************
281  inline const ConstIterator operator--( int ) {
282  return ConstIterator( left_--, right_-- );
283  }
284  //*******************************************************************************************
285 
286  //**Element access operator******************************************************************
291  inline ReturnType operator*() const {
292  return (*left_) + (*right_);
293  }
294  //*******************************************************************************************
295 
296  //**Load function****************************************************************************
301  inline IntrinsicType load() const {
302  return left_.load() + right_.load();
303  }
304  //*******************************************************************************************
305 
306  //**Equality operator************************************************************************
312  inline bool operator==( const ConstIterator& rhs ) const {
313  return left_ == rhs.left_;
314  }
315  //*******************************************************************************************
316 
317  //**Inequality operator**********************************************************************
323  inline bool operator!=( const ConstIterator& rhs ) const {
324  return left_ != rhs.left_;
325  }
326  //*******************************************************************************************
327 
328  //**Less-than operator***********************************************************************
334  inline bool operator<( const ConstIterator& rhs ) const {
335  return left_ < rhs.left_;
336  }
337  //*******************************************************************************************
338 
339  //**Greater-than operator********************************************************************
345  inline bool operator>( const ConstIterator& rhs ) const {
346  return left_ > rhs.left_;
347  }
348  //*******************************************************************************************
349 
350  //**Less-or-equal-than operator**************************************************************
356  inline bool operator<=( const ConstIterator& rhs ) const {
357  return left_ <= rhs.left_;
358  }
359  //*******************************************************************************************
360 
361  //**Greater-or-equal-than operator***********************************************************
367  inline bool operator>=( const ConstIterator& rhs ) const {
368  return left_ >= rhs.left_;
369  }
370  //*******************************************************************************************
371 
372  //**Subtraction operator*********************************************************************
378  inline DifferenceType operator-( const ConstIterator& rhs ) const {
379  return left_ - rhs.left_;
380  }
381  //*******************************************************************************************
382 
383  //**Addition operator************************************************************************
390  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
391  return ConstIterator( it.left_ + inc, it.right_ + inc );
392  }
393  //*******************************************************************************************
394 
395  //**Addition operator************************************************************************
402  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
403  return ConstIterator( it.left_ + inc, it.right_ + inc );
404  }
405  //*******************************************************************************************
406 
407  //**Subtraction operator*********************************************************************
414  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
415  return ConstIterator( it.left_ - dec, it.right_ - dec );
416  }
417  //*******************************************************************************************
418 
419  private:
420  //**Member variables*************************************************************************
421  LeftIteratorType left_;
422  RightIteratorType right_;
423  //*******************************************************************************************
424  };
425  //**********************************************************************************************
426 
427  //**Compilation flags***************************************************************************
429  enum { vectorizable = VT1::vectorizable && VT2::vectorizable &&
432 
434  enum { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
435  //**********************************************************************************************
436 
437  //**Constructor*********************************************************************************
443  explicit inline DVecDVecAddExpr( const VT1& lhs, const VT2& rhs )
444  : lhs_( lhs ) // Left-hand side dense vector of the addition expression
445  , rhs_( rhs ) // Right-hand side dense vector of the addition expression
446  {
447  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
448  }
449  //**********************************************************************************************
450 
451  //**Subscript operator**************************************************************************
457  inline ReturnType operator[]( size_t index ) const {
458  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
459  return lhs_[index] + rhs_[index];
460  }
461  //**********************************************************************************************
462 
463  //**Load function*******************************************************************************
469  BLAZE_ALWAYS_INLINE IntrinsicType load( size_t index ) const {
470  typedef IntrinsicTrait<ElementType> IT;
471  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
472  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
473  const IntrinsicType xmm1( lhs_.load( index ) );
474  const IntrinsicType xmm2( rhs_.load( index ) );
475  return xmm1 + xmm2;
476  }
477  //**********************************************************************************************
478 
479  //**Begin function******************************************************************************
484  inline ConstIterator begin() const {
485  return ConstIterator( lhs_.begin(), rhs_.begin() );
486  }
487  //**********************************************************************************************
488 
489  //**End function********************************************************************************
494  inline ConstIterator end() const {
495  return ConstIterator( lhs_.end(), rhs_.end() );
496  }
497  //**********************************************************************************************
498 
499  //**Size function*******************************************************************************
504  inline size_t size() const {
505  return lhs_.size();
506  }
507  //**********************************************************************************************
508 
509  //**Left operand access*************************************************************************
514  inline LeftOperand leftOperand() const {
515  return lhs_;
516  }
517  //**********************************************************************************************
518 
519  //**Right operand access************************************************************************
524  inline RightOperand rightOperand() const {
525  return rhs_;
526  }
527  //**********************************************************************************************
528 
529  //**********************************************************************************************
535  template< typename T >
536  inline bool canAlias( const T* alias ) const {
537  return ( IsExpression<VT1>::value && ( RequiresEvaluation<VT1>::value ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
538  ( IsExpression<VT2>::value && ( RequiresEvaluation<VT2>::value ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
539  }
540  //**********************************************************************************************
541 
542  //**********************************************************************************************
548  template< typename T >
549  inline bool isAliased( const T* alias ) const {
550  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
551  }
552  //**********************************************************************************************
553 
554  //**********************************************************************************************
559  inline bool isAligned() const {
560  return lhs_.isAligned() && rhs_.isAligned();
561  }
562  //**********************************************************************************************
563 
564  //**********************************************************************************************
569  inline bool canSMPAssign() const {
570  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
572  }
573  //**********************************************************************************************
574 
575  private:
576  //**Member variables****************************************************************************
577  LeftOperand lhs_;
578  RightOperand rhs_;
579  //**********************************************************************************************
580 
581  //**Assignment to dense vectors*****************************************************************
595  template< typename VT > // Type of the target dense vector
596  friend inline typename EnableIf< UseAssign<VT> >::Type
597  assign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
598  {
600 
601  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
602 
603  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
604  addAssign( ~lhs, rhs.rhs_ );
605  }
606  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
607  addAssign( ~lhs, rhs.lhs_ );
608  }
609  else {
610  assign ( ~lhs, rhs.lhs_ );
611  addAssign( ~lhs, rhs.rhs_ );
612  }
613  }
615  //**********************************************************************************************
616 
617  //**Assignment to sparse vectors****************************************************************
631  template< typename VT > // Type of the target sparse vector
632  friend inline typename EnableIf< UseAssign<VT> >::Type
633  assign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
634  {
636 
640 
641  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
642 
643  const ResultType tmp( serial( rhs ) );
644  assign( ~lhs, tmp );
645  }
647  //**********************************************************************************************
648 
649  //**Addition assignment to dense vectors********************************************************
663  template< typename VT > // Type of the target dense vector
664  friend inline typename EnableIf< UseAssign<VT> >::Type
665  addAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
666  {
668 
669  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
670 
671  addAssign( ~lhs, rhs.lhs_ );
672  addAssign( ~lhs, rhs.rhs_ );
673  }
675  //**********************************************************************************************
676 
677  //**Addition assignment to sparse vectors*******************************************************
678  // No special implementation for the addition assignment to sparse vectors.
679  //**********************************************************************************************
680 
681  //**Subtraction assignment to dense vectors*****************************************************
695  template< typename VT > // Type of the target dense vector
696  friend inline typename EnableIf< UseAssign<VT> >::Type
697  subAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
698  {
700 
701  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
702 
703  subAssign( ~lhs, rhs.lhs_ );
704  subAssign( ~lhs, rhs.rhs_ );
705  }
707  //**********************************************************************************************
708 
709  //**Subtraction assignment to sparse vectors****************************************************
710  // No special implementation for the subtraction assignment to sparse vectors.
711  //**********************************************************************************************
712 
713  //**Multiplication assignment to dense vectors**************************************************
727  template< typename VT > // Type of the target dense vector
728  friend inline typename EnableIf< UseAssign<VT> >::Type
729  multAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
730  {
732 
736 
737  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
738 
739  const ResultType tmp( serial( rhs ) );
740  multAssign( ~lhs, tmp );
741  }
743  //**********************************************************************************************
744 
745  //**Multiplication assignment to sparse vectors*************************************************
746  // No special implementation for the multiplication assignment to sparse vectors.
747  //**********************************************************************************************
748 
749  //**SMP assignment to dense vectors*************************************************************
763  template< typename VT > // Type of the target dense vector
764  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
765  smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
766  {
768 
769  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
770 
771  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
772  smpAddAssign( ~lhs, rhs.rhs_ );
773  }
774  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
775  smpAddAssign( ~lhs, rhs.lhs_ );
776  }
777  else {
778  smpAssign ( ~lhs, rhs.lhs_ );
779  smpAddAssign( ~lhs, rhs.rhs_ );
780  }
781  }
783  //**********************************************************************************************
784 
785  //**SMP assignment to sparse vectors************************************************************
799  template< typename VT > // Type of the target sparse vector
800  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
801  smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
802  {
804 
808 
809  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
810 
811  const ResultType tmp( rhs );
812  smpAssign( ~lhs, tmp );
813  }
815  //**********************************************************************************************
816 
817  //**SMP addition assignment to dense vectors****************************************************
831  template< typename VT > // Type of the target dense vector
832  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
833  smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
834  {
836 
837  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
838 
839  smpAddAssign( ~lhs, rhs.lhs_ );
840  smpAddAssign( ~lhs, rhs.rhs_ );
841  }
843  //**********************************************************************************************
844 
845  //**SMP addition assignment to sparse vectors***************************************************
846  // No special implementation for the SMP addition assignment to sparse vectors.
847  //**********************************************************************************************
848 
849  //**SMP subtraction assignment to dense vectors*************************************************
863  template< typename VT > // Type of the target dense vector
864  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
865  smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
866  {
868 
869  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
870 
871  smpSubAssign( ~lhs, rhs.lhs_ );
872  smpSubAssign( ~lhs, rhs.rhs_ );
873  }
875  //**********************************************************************************************
876 
877  //**SMP subtraction assignment to sparse vectors************************************************
878  // No special implementation for the SMP subtraction assignment to sparse vectors.
879  //**********************************************************************************************
880 
881  //**SMP multiplication assignment to dense vectors**********************************************
895  template< typename VT > // Type of the target dense vector
896  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
897  smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
898  {
900 
904 
905  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
906 
907  const ResultType tmp( rhs );
908  smpMultAssign( ~lhs, tmp );
909  }
911  //**********************************************************************************************
912 
913  //**SMP multiplication assignment to sparse vectors*********************************************
914  // No special implementation for the SMP multiplication assignment to sparse vectors.
915  //**********************************************************************************************
916 
917  //**Compile time checks*************************************************************************
925  //**********************************************************************************************
926 };
927 //*************************************************************************************************
928 
929 
930 
931 
932 //=================================================================================================
933 //
934 // GLOBAL BINARY ARITHMETIC OPERATORS
935 //
936 //=================================================================================================
937 
938 //*************************************************************************************************
962 template< typename T1 // Type of the left-hand side dense vector
963  , typename T2 // Type of the right-hand side dense vector
964  , bool TF > // Transpose flag
965 inline const DVecDVecAddExpr<T1,T2,TF>
967 {
969 
970  if( (~lhs).size() != (~rhs).size() )
971  throw std::invalid_argument( "Vector sizes do not match" );
972 
973  return DVecDVecAddExpr<T1,T2,TF>( ~lhs, ~rhs );
974 }
975 //*************************************************************************************************
976 
977 
978 
979 
980 //=================================================================================================
981 //
982 // SIZE SPECIALIZATIONS
983 //
984 //=================================================================================================
985 
986 //*************************************************************************************************
988 template< typename VT1, typename VT2, bool TF >
989 struct Size< DVecDVecAddExpr<VT1,VT2,TF> >
990  : public Max< Size<VT1>, Size<VT2> >::Type
991 {};
993 //*************************************************************************************************
994 
995 
996 
997 
998 //=================================================================================================
999 //
1000 // EXPRESSION TRAIT SPECIALIZATIONS
1001 //
1002 //=================================================================================================
1003 
1004 //*************************************************************************************************
1006 template< typename VT1, typename VT2, bool TF, bool AF >
1007 struct SubvectorExprTrait< DVecDVecAddExpr<VT1,VT2,TF>, AF >
1008 {
1009  public:
1010  //**********************************************************************************************
1011  typedef typename AddExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
1012  , typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
1013  //**********************************************************************************************
1014 };
1016 //*************************************************************************************************
1017 
1018 } // namespace blaze
1019 
1020 #endif
VT1::ReturnType RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:101
Iterator over the elements of the dense vector.
Definition: DVecDVecAddExpr.h:180
Pointer difference type of the Blaze library.
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecAddExpr.h:210
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
BLAZE_ALWAYS_INLINE void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:879
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:378
PointerType pointer
Pointer return type.
Definition: DVecDVecAddExpr.h:193
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:536
Header file for basic type definitions.
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:191
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
VT2::ResultType RE2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:100
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:484
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:946
Header file for the IsSame and IsStrictlySame type traits.
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:504
VT1::ConstIterator LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:198
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:185
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:261
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:312
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:171
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:291
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:699
DVecDVecAddExpr< VT1, VT2, TF > This
Type of this DVecDVecAddExpr instance.
Definition: DVecDVecAddExpr.h:158
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:578
Header file for the RequiresEvaluation type trait.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:184
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecDVecAddExpr.h:162
Constraint on the data type.
SelectType< useAssign, const ResultType, const DVecDVecAddExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:168
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:514
Constraint on the data type.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:235
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:569
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:263
AddTrait< RE1, RE2 >::Type ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:159
VT1::ResultType RE1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:99
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecAddExpr.h:402
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:188
VT1::CompositeType CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:103
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:356
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:269
Header file for the VecVecAddExpr base class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:345
#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
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
VT2::ElementType ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:165
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecAddExpr.h:559
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:187
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
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:422
const size_t SMP_DVECDVECADD_THRESHOLD
SMP dense vector/dense vector addition threshold.This threshold specifies when a dense vector/dense v...
Definition: Thresholds.h:230
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:119
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:222
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
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:201
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.
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Access to the intrinsic elements of the vector.
Definition: DVecDVecAddExpr.h:469
Header file for the serial shim.
Constraint on the data type.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecAddExpr.h:281
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:494
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:367
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:150
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:186
Header file for the addition trait.
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
RightOperand rightOperand() const
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:524
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:105
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:174
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:259
VT2::ReturnType RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:102
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecAddExpr.h:421
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:577
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:414
Expression object for dense vector-dense vector additions.The DVecDVecAddExpr class represents the co...
Definition: DVecDVecAddExpr.h:93
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:390
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:457
#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:192
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:323
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecAddExpr.h:247
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecAddExpr.h:195
VT2::CompositeType CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:104
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:443
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
#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:160
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:549
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:334
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
Header file for the SubvectorExprTrait class template.
IntrinsicType load() const
Access to the intrinsic elements of the vector.
Definition: DVecDVecAddExpr.h:301
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:238
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:194
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.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:161