DVecDVecAddExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECADDEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECDVECADDEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
56 #include <blaze/math/SIMD.h>
65 #include <blaze/system/Inline.h>
67 #include <blaze/util/Assert.h>
70 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/mpl/If.h>
74 #include <blaze/util/Types.h>
75 
76 
77 namespace blaze {
78 
79 //=================================================================================================
80 //
81 // CLASS DVECDVECADDEXPR
82 //
83 //=================================================================================================
84 
85 //*************************************************************************************************
92 template< typename VT1 // Type of the left-hand side dense vector
93  , typename VT2 // Type of the right-hand side dense vector
94  , bool TF > // Transpose flag
96  : public VecVecAddExpr< DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF > >
97  , private Computation
98 {
99  private:
100  //**Type definitions****************************************************************************
109  //**********************************************************************************************
110 
111  //**Return type evaluation**********************************************************************
113 
118  static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
119 
121  using ExprReturnType = decltype( std::declval<RN1>() + std::declval<RN2>() );
122  //**********************************************************************************************
123 
124  //**Serial evaluation strategy******************************************************************
126 
132  static constexpr bool useAssign =
133  ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !returnExpr );
134 
136  template< typename VT >
138  static constexpr bool UseAssign_v = useAssign;
140  //**********************************************************************************************
141 
142  //**Parallel evaluation strategy****************************************************************
144 
150  template< typename VT >
151  static constexpr bool UseSMPAssign_v =
154  //**********************************************************************************************
155 
156  public:
157  //**Type definitions****************************************************************************
163 
166 
169 
171  using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
172 
174  using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
175  //**********************************************************************************************
176 
177  //**ConstIterator class definition**************************************************************
181  {
182  public:
183  //**Type definitions*************************************************************************
184  using IteratorCategory = std::random_access_iterator_tag;
189 
190  // STL iterator requirements
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 auto load() const noexcept {
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*************************************************************************
423  //*******************************************************************************************
424  };
425  //**********************************************************************************************
426 
427  //**Compilation flags***************************************************************************
429  static constexpr bool simdEnabled =
430  ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDAdd_v<ET1,ET2> );
431 
433  static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
434  //**********************************************************************************************
435 
436  //**SIMD properties*****************************************************************************
438  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
439  //**********************************************************************************************
440 
441  //**Constructor*********************************************************************************
447  explicit inline DVecDVecAddExpr( const VT1& lhs, const VT2& rhs ) noexcept
448  : lhs_( lhs ) // Left-hand side dense vector of the addition expression
449  , rhs_( rhs ) // Right-hand side dense vector of the addition expression
450  {
451  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
452  }
453  //**********************************************************************************************
454 
455  //**Subscript operator**************************************************************************
461  inline ReturnType operator[]( size_t index ) const {
462  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
463  return lhs_[index] + rhs_[index];
464  }
465  //**********************************************************************************************
466 
467  //**At function*********************************************************************************
474  inline ReturnType at( size_t index ) const {
475  if( index >= lhs_.size() ) {
476  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
477  }
478  return (*this)[index];
479  }
480  //**********************************************************************************************
481 
482  //**Load function*******************************************************************************
488  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
489  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
490  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
491  return lhs_.load( index ) + rhs_.load( index );
492  }
493  //**********************************************************************************************
494 
495  //**Begin function******************************************************************************
500  inline ConstIterator begin() const {
501  return ConstIterator( lhs_.begin(), rhs_.begin() );
502  }
503  //**********************************************************************************************
504 
505  //**End function********************************************************************************
510  inline ConstIterator end() const {
511  return ConstIterator( lhs_.end(), rhs_.end() );
512  }
513  //**********************************************************************************************
514 
515  //**Size function*******************************************************************************
520  inline size_t size() const noexcept {
521  return lhs_.size();
522  }
523  //**********************************************************************************************
524 
525  //**Left operand access*************************************************************************
530  inline LeftOperand leftOperand() const noexcept {
531  return lhs_;
532  }
533  //**********************************************************************************************
534 
535  //**Right operand access************************************************************************
540  inline RightOperand rightOperand() const noexcept {
541  return rhs_;
542  }
543  //**********************************************************************************************
544 
545  //**********************************************************************************************
551  template< typename T >
552  inline bool canAlias( const T* alias ) const noexcept {
553  return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
554  ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
555  }
556  //**********************************************************************************************
557 
558  //**********************************************************************************************
564  template< typename T >
565  inline bool isAliased( const T* alias ) const noexcept {
566  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
567  }
568  //**********************************************************************************************
569 
570  //**********************************************************************************************
575  inline bool isAligned() const noexcept {
576  return lhs_.isAligned() && rhs_.isAligned();
577  }
578  //**********************************************************************************************
579 
580  //**********************************************************************************************
585  inline bool canSMPAssign() const noexcept {
586  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
587  ( size() > SMP_DVECDVECADD_THRESHOLD );
588  }
589  //**********************************************************************************************
590 
591  private:
592  //**Member variables****************************************************************************
595  //**********************************************************************************************
596 
597  //**Assignment to dense vectors*****************************************************************
611  template< typename VT > // Type of the target dense vector
612  friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
614  {
616 
617  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
618 
619  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
620  addAssign( ~lhs, rhs.rhs_ );
621  }
622  else if( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) {
623  addAssign( ~lhs, rhs.lhs_ );
624  }
625  else if( !RequiresEvaluation_v<VT2> ) {
626  assign ( ~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 auto 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 auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
685  -> EnableIf_t< UseAssign_v<VT> >
686  {
688 
689  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
690 
691  if( !RequiresEvaluation_v<VT2> ) {
692  addAssign( ~lhs, rhs.rhs_ );
693  addAssign( ~lhs, rhs.lhs_ );
694  }
695  else {
696  addAssign( ~lhs, rhs.lhs_ );
697  addAssign( ~lhs, rhs.rhs_ );
698  }
699  }
701  //**********************************************************************************************
702 
703  //**Addition assignment to sparse vectors*******************************************************
704  // No special implementation for the addition assignment to sparse vectors.
705  //**********************************************************************************************
706 
707  //**Subtraction assignment to dense vectors*****************************************************
721  template< typename VT > // Type of the target dense vector
722  friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
723  -> EnableIf_t< UseAssign_v<VT> >
724  {
726 
727  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
728 
729  if( !RequiresEvaluation_v<VT2> ) {
730  subAssign( ~lhs, rhs.rhs_ );
731  subAssign( ~lhs, rhs.lhs_ );
732  }
733  else {
734  subAssign( ~lhs, rhs.lhs_ );
735  subAssign( ~lhs, rhs.rhs_ );
736  }
737  }
739  //**********************************************************************************************
740 
741  //**Subtraction assignment to sparse vectors****************************************************
742  // No special implementation for the subtraction assignment to sparse vectors.
743  //**********************************************************************************************
744 
745  //**Multiplication assignment to dense vectors**************************************************
759  template< typename VT > // Type of the target dense vector
760  friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
761  -> EnableIf_t< UseAssign_v<VT> >
762  {
764 
768 
769  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
770 
771  const ResultType tmp( serial( rhs ) );
772  multAssign( ~lhs, tmp );
773  }
775  //**********************************************************************************************
776 
777  //**Multiplication assignment to sparse vectors*************************************************
778  // No special implementation for the multiplication assignment to sparse vectors.
779  //**********************************************************************************************
780 
781  //**Division assignment to dense vectors********************************************************
795  template< typename VT > // Type of the target dense vector
796  friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
797  -> EnableIf_t< UseAssign_v<VT> >
798  {
800 
804 
805  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
806 
807  const ResultType tmp( serial( rhs ) );
808  divAssign( ~lhs, tmp );
809  }
811  //**********************************************************************************************
812 
813  //**Division assignment to sparse vectors*******************************************************
814  // No special implementation for the division assignment to sparse vectors.
815  //**********************************************************************************************
816 
817  //**SMP assignment to dense vectors*************************************************************
831  template< typename VT > // Type of the target dense vector
832  friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
833  -> EnableIf_t< UseSMPAssign_v<VT> >
834  {
836 
837  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
838 
839  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
840  smpAddAssign( ~lhs, rhs.rhs_ );
841  }
842  else if( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) {
843  smpAddAssign( ~lhs, rhs.lhs_ );
844  }
845  else if( !RequiresEvaluation_v<VT2> ) {
846  smpAssign ( ~lhs, rhs.rhs_ );
847  smpAddAssign( ~lhs, rhs.lhs_ );
848  }
849  else {
850  smpAssign ( ~lhs, rhs.lhs_ );
851  smpAddAssign( ~lhs, rhs.rhs_ );
852  }
853  }
855  //**********************************************************************************************
856 
857  //**SMP assignment to sparse vectors************************************************************
871  template< typename VT > // Type of the target sparse vector
872  friend inline auto smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
873  -> EnableIf_t< UseSMPAssign_v<VT> >
874  {
876 
880 
881  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
882 
883  const ResultType tmp( rhs );
884  smpAssign( ~lhs, tmp );
885  }
887  //**********************************************************************************************
888 
889  //**SMP addition assignment to dense vectors****************************************************
903  template< typename VT > // Type of the target dense vector
904  friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
905  -> EnableIf_t< UseSMPAssign_v<VT> >
906  {
908 
909  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
910 
911  if( !RequiresEvaluation_v<VT2> ) {
912  smpAddAssign( ~lhs, rhs.rhs_ );
913  smpAddAssign( ~lhs, rhs.lhs_ );
914  }
915  else {
916  smpAddAssign( ~lhs, rhs.lhs_ );
917  smpAddAssign( ~lhs, rhs.rhs_ );
918  }
919  }
921  //**********************************************************************************************
922 
923  //**SMP addition assignment to sparse vectors***************************************************
924  // No special implementation for the SMP addition assignment to sparse vectors.
925  //**********************************************************************************************
926 
927  //**SMP subtraction assignment to dense vectors*************************************************
941  template< typename VT > // Type of the target dense vector
942  friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
943  -> EnableIf_t< UseSMPAssign_v<VT> >
944  {
946 
947  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
948 
949  if( !RequiresEvaluation_v<VT2> ) {
950  smpSubAssign( ~lhs, rhs.rhs_ );
951  smpSubAssign( ~lhs, rhs.lhs_ );
952  }
953  else {
954  smpSubAssign( ~lhs, rhs.lhs_ );
955  smpSubAssign( ~lhs, rhs.rhs_ );
956  }
957  }
959  //**********************************************************************************************
960 
961  //**SMP subtraction assignment to sparse vectors************************************************
962  // No special implementation for the SMP subtraction assignment to sparse vectors.
963  //**********************************************************************************************
964 
965  //**SMP multiplication assignment to dense vectors**********************************************
979  template< typename VT > // Type of the target dense vector
980  friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
981  -> EnableIf_t< UseSMPAssign_v<VT> >
982  {
984 
988 
989  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
990 
991  const ResultType tmp( rhs );
992  smpMultAssign( ~lhs, tmp );
993  }
995  //**********************************************************************************************
996 
997  //**SMP multiplication assignment to sparse vectors*********************************************
998  // No special implementation for the SMP multiplication assignment to sparse vectors.
999  //**********************************************************************************************
1000 
1001  //**SMP division assignment to dense vectors****************************************************
1015  template< typename VT > // Type of the target dense vector
1016  friend inline auto smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
1017  -> EnableIf_t< UseSMPAssign_v<VT> >
1018  {
1020 
1024 
1025  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1026 
1027  const ResultType tmp( rhs );
1028  smpDivAssign( ~lhs, tmp );
1029  }
1031  //**********************************************************************************************
1032 
1033  //**SMP division assignment to sparse vectors***************************************************
1034  // No special implementation for the SMP division assignment to sparse vectors.
1035  //**********************************************************************************************
1036 
1037  //**Compile time checks*************************************************************************
1045  //**********************************************************************************************
1046 };
1047 //*************************************************************************************************
1048 
1049 
1050 
1051 
1052 //=================================================================================================
1053 //
1054 // GLOBAL BINARY ARITHMETIC OPERATORS
1055 //
1056 //=================================================================================================
1057 
1058 //*************************************************************************************************
1082 template< typename VT1 // Type of the left-hand side dense vector
1083  , typename VT2 // Type of the right-hand side dense vector
1084  , bool TF > // Transpose flag
1085 inline decltype(auto)
1086  operator+( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1087 {
1089 
1090  if( (~lhs).size() != (~rhs).size() ) {
1091  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1092  }
1093 
1095  return ReturnType( ~lhs, ~rhs );
1096 }
1097 //*************************************************************************************************
1098 
1099 
1100 
1101 
1102 //=================================================================================================
1103 //
1104 // ISALIGNED SPECIALIZATIONS
1105 //
1106 //=================================================================================================
1107 
1108 //*************************************************************************************************
1110 template< typename VT1, typename VT2, bool TF >
1111 struct IsAligned< DVecDVecAddExpr<VT1,VT2,TF> >
1112  : public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
1113 {};
1115 //*************************************************************************************************
1116 
1117 
1118 
1119 
1120 //=================================================================================================
1121 //
1122 // ISPADDED SPECIALIZATIONS
1123 //
1124 //=================================================================================================
1125 
1126 //*************************************************************************************************
1128 template< typename VT1, typename VT2, bool TF >
1129 struct IsPadded< DVecDVecAddExpr<VT1,VT2,TF> >
1130  : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1131 {};
1133 //*************************************************************************************************
1134 
1135 } // namespace blaze
1136 
1137 #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:180
Pointer difference type of the Blaze library.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecAddExpr.h:161
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:184
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecAddExpr.h:210
Header file for auxiliary alias declarations.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:345
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:992
Header file for basic type definitions.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecAddExpr.h:575
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:107
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecAddExpr.h:378
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:187
If_t< IsExpression_v< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:174
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:323
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:224
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:520
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:510
Header file for the DenseVector base class.
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecAddExpr.h:118
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:565
Header file for the Computation base class.
RightOperand rhs_
Right-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:594
Header file for the RequiresEvaluation type trait.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecAddExpr.h:188
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecAddExpr.h:433
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecAddExpr.h:438
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:105
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecAddExpr.h:474
Constraint on the data type.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:235
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecAddExpr.h:402
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:162
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the addition expression. ...
Definition: DVecDVecAddExpr.h:132
Header file for the IsTemporary type trait class.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If class template.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:530
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecAddExpr.h:269
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:165
Header file for the VecVecAddExpr base class.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:192
If_t< IsExpression_v< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:171
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:301
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:585
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:367
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECADDEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecAddExpr.h:104
Header file for the HasSIMDAdd type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
Header file for all SIMD functionality.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecAddExpr.h:422
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.The AddTrait_t alias declaration provides...
Definition: AddTrait.h:238
Header file for the IsAligned type trait.
Constraint on the data type.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:356
DVecDVecAddExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecAddExpr class.
Definition: DVecDVecAddExpr.h:447
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:552
ReferenceType reference
Reference return type.
Definition: DVecDVecAddExpr.h:194
Constraint on the data type.
ElementType * PointerType
Pointer return type.
Definition: DVecDVecAddExpr.h:186
If_t< useAssign, const ResultType, const DVecDVecAddExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:168
Header file for the exception macros of the math module.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:222
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Base class for all vector/vector addition expression templates.The VecVecAddExpr class serves as a ta...
Definition: VecVecAddExpr.h:66
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:488
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
Constraint on the data type.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecAddExpr.h:281
PointerType pointer
Pointer return type.
Definition: DVecDVecAddExpr.h:193
AddTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:160
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:540
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecAddExpr.h:461
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:291
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:334
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
Header file for the addition trait.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:101
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:259
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:198
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecAddExpr.h:421
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:593
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:103
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:95
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:390
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:201
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:104
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecAddExpr.h:429
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:185
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:312
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecAddExpr.h:247
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:108
Header file for the IsComputation type trait class.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
Header file for the IntegralConstant class template.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:500
decltype(std::declval< RN1 >()+std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecAddExpr.h:121
Constraint on the data type.
System settings for the inline keywords.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:191
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:102