Blaze 3.9
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>
56#include <blaze/math/SIMD.h>
66#include <blaze/system/Inline.h>
69#include <blaze/util/Assert.h>
72#include <blaze/util/EnableIf.h>
75#include <blaze/util/mpl/If.h>
76#include <blaze/util/Types.h>
77
78
79namespace blaze {
80
81//=================================================================================================
82//
83// CLASS DVECDVECADDEXPR
84//
85//=================================================================================================
86
87//*************************************************************************************************
94template< typename VT1 // Type of the left-hand side dense vector
95 , typename VT2 // Type of the right-hand side dense vector
96 , bool TF > // Transpose flag
98 : public VecVecAddExpr< DenseVector< DVecDVecAddExpr<VT1,VT2,TF>, TF > >
99 , private Computation
100{
101 private:
102 //**Type definitions****************************************************************************
111 //**********************************************************************************************
112
113 //**Return type evaluation**********************************************************************
115
120 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
121
123 using ExprReturnType = decltype( std::declval<RN1>() + std::declval<RN2>() );
124 //**********************************************************************************************
125
126 //**Serial evaluation strategy******************************************************************
128
134 static constexpr bool useAssign =
135 ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !returnExpr );
136
139 template< typename VT >
140 static constexpr bool UseAssign_v = useAssign;
142 //**********************************************************************************************
143
144 //**Parallel evaluation strategy****************************************************************
146
152 template< typename VT >
153 static constexpr bool UseSMPAssign_v =
154 ( ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign );
156 //**********************************************************************************************
157
158 public:
159 //**Type definitions****************************************************************************
162
165
169
172
175
177 using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
178
180 using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
181 //**********************************************************************************************
182
183 //**ConstIterator class definition**************************************************************
187 {
188 public:
189 //**Type definitions*************************************************************************
190 using IteratorCategory = std::random_access_iterator_tag;
194 using DifferenceType = ptrdiff_t;
195
196 // STL iterator requirements
202
205
208 //*******************************************************************************************
209
210 //**Constructor******************************************************************************
217 : left_ ( left ) // Iterator to the current left-hand side element
218 , right_( right ) // Iterator to the current right-hand side element
219 {}
220 //*******************************************************************************************
221
222 //**Addition assignment operator*************************************************************
229 left_ += inc;
230 right_ += inc;
231 return *this;
232 }
233 //*******************************************************************************************
234
235 //**Subtraction assignment operator**********************************************************
242 left_ -= dec;
243 right_ -= dec;
244 return *this;
245 }
246 //*******************************************************************************************
247
248 //**Prefix increment operator****************************************************************
254 ++left_;
255 ++right_;
256 return *this;
257 }
258 //*******************************************************************************************
259
260 //**Postfix increment operator***************************************************************
266 return ConstIterator( left_++, right_++ );
267 }
268 //*******************************************************************************************
269
270 //**Prefix decrement operator****************************************************************
276 --left_;
277 --right_;
278 return *this;
279 }
280 //*******************************************************************************************
281
282 //**Postfix decrement operator***************************************************************
288 return ConstIterator( left_--, right_-- );
289 }
290 //*******************************************************************************************
291
292 //**Element access operator******************************************************************
298 return (*left_) + (*right_);
299 }
300 //*******************************************************************************************
301
302 //**Load function****************************************************************************
307 inline auto load() const noexcept {
308 return left_.load() + right_.load();
309 }
310 //*******************************************************************************************
311
312 //**Equality operator************************************************************************
318 inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
319 return left_ == rhs.left_;
320 }
321 //*******************************************************************************************
322
323 //**Inequality operator**********************************************************************
329 inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
330 return left_ != rhs.left_;
331 }
332 //*******************************************************************************************
333
334 //**Less-than operator***********************************************************************
340 inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
341 return left_ < rhs.left_;
342 }
343 //*******************************************************************************************
344
345 //**Greater-than operator********************************************************************
351 inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
352 return left_ > rhs.left_;
353 }
354 //*******************************************************************************************
355
356 //**Less-or-equal-than operator**************************************************************
362 inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
363 return left_ <= rhs.left_;
364 }
365 //*******************************************************************************************
366
367 //**Greater-or-equal-than operator***********************************************************
373 inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
374 return left_ >= rhs.left_;
375 }
376 //*******************************************************************************************
377
378 //**Subtraction operator*********************************************************************
385 return left_ - rhs.left_;
386 }
387 //*******************************************************************************************
388
389 //**Addition operator************************************************************************
396 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
397 return ConstIterator( it.left_ + inc, it.right_ + inc );
398 }
399 //*******************************************************************************************
400
401 //**Addition operator************************************************************************
408 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
409 return ConstIterator( it.left_ + inc, it.right_ + inc );
410 }
411 //*******************************************************************************************
412
413 //**Subtraction operator*********************************************************************
420 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
421 return ConstIterator( it.left_ - dec, it.right_ - dec );
422 }
423 //*******************************************************************************************
424
425 private:
426 //**Member variables*************************************************************************
429 //*******************************************************************************************
430 };
431 //**********************************************************************************************
432
433 //**Compilation flags***************************************************************************
435 static constexpr bool simdEnabled =
436 ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDAdd_v<ET1,ET2> );
437
439 static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
440 //**********************************************************************************************
441
442 //**SIMD properties*****************************************************************************
444 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
445 //**********************************************************************************************
446
447 //**Constructor*********************************************************************************
453 inline DVecDVecAddExpr( const VT1& lhs, const VT2& rhs ) noexcept
454 : lhs_( lhs ) // Left-hand side dense vector of the addition expression
455 , rhs_( rhs ) // Right-hand side dense vector of the addition expression
456 {
457 BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
458 }
459 //**********************************************************************************************
460
461 //**Subscript operator**************************************************************************
467 inline ReturnType operator[]( size_t index ) const {
468 BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
469 return lhs_[index] + rhs_[index];
470 }
471 //**********************************************************************************************
472
473 //**At function*********************************************************************************
480 inline ReturnType at( size_t index ) const {
481 if( index >= lhs_.size() ) {
482 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
483 }
484 return (*this)[index];
485 }
486 //**********************************************************************************************
487
488 //**Load function*******************************************************************************
494 BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
495 BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
496 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
497 return lhs_.load( index ) + rhs_.load( index );
498 }
499 //**********************************************************************************************
500
501 //**Begin function******************************************************************************
506 inline ConstIterator begin() const {
507 return ConstIterator( lhs_.begin(), rhs_.begin() );
508 }
509 //**********************************************************************************************
510
511 //**End function********************************************************************************
516 inline ConstIterator end() const {
517 return ConstIterator( lhs_.end(), rhs_.end() );
518 }
519 //**********************************************************************************************
520
521 //**Size function*******************************************************************************
526 inline size_t size() const noexcept {
527 return lhs_.size();
528 }
529 //**********************************************************************************************
530
531 //**Left operand access*************************************************************************
536 inline LeftOperand leftOperand() const noexcept {
537 return lhs_;
538 }
539 //**********************************************************************************************
540
541 //**Right operand access************************************************************************
546 inline RightOperand rightOperand() const noexcept {
547 return rhs_;
548 }
549 //**********************************************************************************************
550
551 //**********************************************************************************************
557 template< typename T >
558 inline bool canAlias( const T* alias ) const noexcept {
559 return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
560 ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
561 }
562 //**********************************************************************************************
563
564 //**********************************************************************************************
570 template< typename T >
571 inline bool isAliased( const T* alias ) const noexcept {
572 return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
573 }
574 //**********************************************************************************************
575
576 //**********************************************************************************************
581 inline bool isAligned() const noexcept {
582 return lhs_.isAligned() && rhs_.isAligned();
583 }
584 //**********************************************************************************************
585
586 //**********************************************************************************************
591 inline bool canSMPAssign() const noexcept {
592 return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
593 ( size() > SMP_DVECDVECADD_THRESHOLD );
594 }
595 //**********************************************************************************************
596
597 private:
598 //**Member variables****************************************************************************
601 //**********************************************************************************************
602
603 //**Assignment to dense vectors*****************************************************************
617 template< typename VT > // Type of the target dense vector
618 friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
620 {
622
623 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
624
625 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
626 addAssign( *lhs, rhs.rhs_ );
627 }
628 else if( !IsComputation_v<VT2> && isSame( *lhs, rhs.rhs_ ) ) {
629 addAssign( *lhs, rhs.lhs_ );
630 }
631 else if( !RequiresEvaluation_v<VT2> ) {
632 assign ( *lhs, rhs.rhs_ );
633 addAssign( *lhs, rhs.lhs_ );
634 }
635 else {
636 assign ( *lhs, rhs.lhs_ );
637 addAssign( *lhs, rhs.rhs_ );
638 }
639 }
641 //**********************************************************************************************
642
643 //**Assignment to sparse vectors****************************************************************
657 template< typename VT > // Type of the target sparse vector
658 friend inline auto assign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
660 {
662
666
667 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
668
669 const ResultType tmp( serial( rhs ) );
670 assign( *lhs, tmp );
671 }
673 //**********************************************************************************************
674
675 //**Addition assignment to dense vectors********************************************************
689 template< typename VT > // Type of the target dense vector
690 friend inline auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
691 -> EnableIf_t< UseAssign_v<VT> >
692 {
694
695 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
696
697 if( !RequiresEvaluation_v<VT2> ) {
698 addAssign( *lhs, rhs.rhs_ );
699 addAssign( *lhs, rhs.lhs_ );
700 }
701 else {
702 addAssign( *lhs, rhs.lhs_ );
703 addAssign( *lhs, rhs.rhs_ );
704 }
705 }
707 //**********************************************************************************************
708
709 //**Addition assignment to sparse vectors*******************************************************
710 // No special implementation for the addition assignment to sparse vectors.
711 //**********************************************************************************************
712
713 //**Subtraction assignment to dense vectors*****************************************************
727 template< typename VT > // Type of the target dense vector
728 friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
729 -> EnableIf_t< UseAssign_v<VT> >
730 {
732
733 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
734
735 if( !RequiresEvaluation_v<VT2> ) {
736 subAssign( *lhs, rhs.rhs_ );
737 subAssign( *lhs, rhs.lhs_ );
738 }
739 else {
740 subAssign( *lhs, rhs.lhs_ );
741 subAssign( *lhs, rhs.rhs_ );
742 }
743 }
745 //**********************************************************************************************
746
747 //**Subtraction assignment to sparse vectors****************************************************
748 // No special implementation for the subtraction assignment to sparse vectors.
749 //**********************************************************************************************
750
751 //**Multiplication assignment to dense vectors**************************************************
765 template< typename VT > // Type of the target dense vector
766 friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
767 -> EnableIf_t< UseAssign_v<VT> >
768 {
770
774
775 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
776
777 const ResultType tmp( serial( rhs ) );
778 multAssign( *lhs, tmp );
779 }
781 //**********************************************************************************************
782
783 //**Multiplication assignment to sparse vectors*************************************************
784 // No special implementation for the multiplication assignment to sparse vectors.
785 //**********************************************************************************************
786
787 //**Division assignment to dense vectors********************************************************
801 template< typename VT > // Type of the target dense vector
802 friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
803 -> EnableIf_t< UseAssign_v<VT> >
804 {
806
810
811 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
812
813 const ResultType tmp( serial( rhs ) );
814 divAssign( *lhs, tmp );
815 }
817 //**********************************************************************************************
818
819 //**Division assignment to sparse vectors*******************************************************
820 // No special implementation for the division assignment to sparse vectors.
821 //**********************************************************************************************
822
823 //**SMP assignment to dense vectors*************************************************************
837 template< typename VT > // Type of the target dense vector
838 friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
839 -> EnableIf_t< UseSMPAssign_v<VT> >
840 {
842
843 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
844
845 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
846 smpAddAssign( *lhs, rhs.rhs_ );
847 }
848 else if( !IsComputation_v<VT2> && isSame( *lhs, rhs.rhs_ ) ) {
849 smpAddAssign( *lhs, rhs.lhs_ );
850 }
851 else if( !RequiresEvaluation_v<VT2> ) {
852 smpAssign ( *lhs, rhs.rhs_ );
853 smpAddAssign( *lhs, rhs.lhs_ );
854 }
855 else {
856 smpAssign ( *lhs, rhs.lhs_ );
857 smpAddAssign( *lhs, rhs.rhs_ );
858 }
859 }
861 //**********************************************************************************************
862
863 //**SMP assignment to sparse vectors************************************************************
877 template< typename VT > // Type of the target sparse vector
878 friend inline auto smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
879 -> EnableIf_t< UseSMPAssign_v<VT> >
880 {
882
886
887 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
888
889 const ResultType tmp( rhs );
890 smpAssign( *lhs, tmp );
891 }
893 //**********************************************************************************************
894
895 //**SMP addition assignment to dense vectors****************************************************
909 template< typename VT > // Type of the target dense vector
910 friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
911 -> EnableIf_t< UseSMPAssign_v<VT> >
912 {
914
915 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
916
917 if( !RequiresEvaluation_v<VT2> ) {
918 smpAddAssign( *lhs, rhs.rhs_ );
919 smpAddAssign( *lhs, rhs.lhs_ );
920 }
921 else {
922 smpAddAssign( *lhs, rhs.lhs_ );
923 smpAddAssign( *lhs, rhs.rhs_ );
924 }
925 }
927 //**********************************************************************************************
928
929 //**SMP addition assignment to sparse vectors***************************************************
930 // No special implementation for the SMP addition assignment to sparse vectors.
931 //**********************************************************************************************
932
933 //**SMP subtraction assignment to dense vectors*************************************************
947 template< typename VT > // Type of the target dense vector
948 friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
949 -> EnableIf_t< UseSMPAssign_v<VT> >
950 {
952
953 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
954
955 if( !RequiresEvaluation_v<VT2> ) {
956 smpSubAssign( *lhs, rhs.rhs_ );
957 smpSubAssign( *lhs, rhs.lhs_ );
958 }
959 else {
960 smpSubAssign( *lhs, rhs.lhs_ );
961 smpSubAssign( *lhs, rhs.rhs_ );
962 }
963 }
965 //**********************************************************************************************
966
967 //**SMP subtraction assignment to sparse vectors************************************************
968 // No special implementation for the SMP subtraction assignment to sparse vectors.
969 //**********************************************************************************************
970
971 //**SMP multiplication assignment to dense vectors**********************************************
985 template< typename VT > // Type of the target dense vector
986 friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
987 -> EnableIf_t< UseSMPAssign_v<VT> >
988 {
990
994
995 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
996
997 const ResultType tmp( rhs );
998 smpMultAssign( *lhs, tmp );
999 }
1001 //**********************************************************************************************
1002
1003 //**SMP multiplication assignment to sparse vectors*********************************************
1004 // No special implementation for the SMP multiplication assignment to sparse vectors.
1005 //**********************************************************************************************
1006
1007 //**SMP division assignment to dense vectors****************************************************
1021 template< typename VT > // Type of the target dense vector
1022 friend inline auto smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecAddExpr& rhs )
1023 -> EnableIf_t< UseSMPAssign_v<VT> >
1024 {
1026
1030
1031 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1032
1033 const ResultType tmp( rhs );
1034 smpDivAssign( *lhs, tmp );
1035 }
1037 //**********************************************************************************************
1038
1039 //**SMP division assignment to sparse vectors***************************************************
1040 // No special implementation for the SMP division assignment to sparse vectors.
1041 //**********************************************************************************************
1042
1043 //**Compile time checks*************************************************************************
1051 //**********************************************************************************************
1052};
1053//*************************************************************************************************
1054
1055
1056
1057
1058//=================================================================================================
1059//
1060// GLOBAL BINARY ARITHMETIC OPERATORS
1061//
1062//=================================================================================================
1063
1064//*************************************************************************************************
1088template< typename VT1 // Type of the left-hand side dense vector
1089 , typename VT2 // Type of the right-hand side dense vector
1090 , bool TF > // Transpose flag
1091inline decltype(auto)
1092 operator+( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1093{
1095
1096 if( (*lhs).size() != (*rhs).size() ) {
1097 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1098 }
1099
1100 using ReturnType = const DVecDVecAddExpr<VT1,VT2,TF>;
1101 return ReturnType( *lhs, *rhs );
1102}
1103//*************************************************************************************************
1104
1105
1106
1107
1108//=================================================================================================
1109//
1110// ISALIGNED SPECIALIZATIONS
1111//
1112//=================================================================================================
1113
1114//*************************************************************************************************
1116template< typename VT1, typename VT2, bool TF >
1117struct IsAligned< DVecDVecAddExpr<VT1,VT2,TF> >
1118 : public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
1119{};
1121//*************************************************************************************************
1122
1123
1124
1125
1126//=================================================================================================
1127//
1128// ISPADDED SPECIALIZATIONS
1129//
1130//=================================================================================================
1131
1132//*************************************************************************************************
1134template< typename VT1, typename VT2, bool TF >
1135struct IsPadded< DVecDVecAddExpr<VT1,VT2,TF> >
1136 : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1137{};
1139//*************************************************************************************************
1140
1141} // namespace blaze
1142
1143#endif
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition: Aliases.h:130
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Constraint on the data type.
Header file for the EnableIf class template.
Constraint on the data type.
Header file for the function trace functionality.
Header file for the HasSIMDAdd type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the IsPadded type trait.
Header file for the IsTemporary type trait class.
Deactivation of problematic macros.
Header file for all SIMD functionality.
Iterator over the elements of the dense vector.
Definition: DVecDVecAddExpr.h:187
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:351
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecAddExpr.h:194
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecAddExpr.h:197
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecAddExpr.h:241
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecAddExpr.h:384
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:373
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:396
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecAddExpr.h:228
ReferenceType reference
Reference return type.
Definition: DVecDVecAddExpr.h:200
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecAddExpr.h:190
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:340
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:204
PointerType pointer
Pointer return type.
Definition: DVecDVecAddExpr.h:199
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:318
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecAddExpr.h:216
ElementType * PointerType
Pointer return type.
Definition: DVecDVecAddExpr.h:192
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecAddExpr.h:287
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecAddExpr.h:193
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:307
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:207
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:362
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecAddExpr.h:265
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:191
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecAddExpr.h:408
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecAddExpr.h:427
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecAddExpr.h:198
BLAZE_DEVICE_CALLABLE ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecAddExpr.h:297
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecAddExpr.h:329
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecAddExpr.h:275
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecAddExpr.h:428
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecAddExpr.h:253
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecAddExpr.h:201
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecAddExpr.h:420
Expression object for dense vector-dense vector additions.
Definition: DVecDVecAddExpr.h:100
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecAddExpr.h:571
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecAddExpr.h:467
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecAddExpr.h:558
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:108
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecAddExpr.h:444
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:506
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:109
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecAddExpr.h:435
If_t< useAssign, const ResultType, const DVecDVecAddExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecAddExpr.h:174
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:103
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecAddExpr.h:120
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:546
AddTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecAddExpr.h:166
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:104
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecAddExpr.h:480
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecAddExpr.h:168
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecAddExpr.h:494
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the addition expression.
Definition: DVecDVecAddExpr.h:134
RightOperand rhs_
Right-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:600
DVecDVecAddExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecAddExpr class.
Definition: DVecDVecAddExpr.h:453
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecAddExpr.h:581
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:177
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecAddExpr.h:439
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecAddExpr.h:591
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:106
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:110
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecAddExpr.h:171
decltype(std::declval< RN1 >()+std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecAddExpr.h:123
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecAddExpr.h:526
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:107
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecAddExpr.h:516
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecAddExpr.h:536
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecAddExpr.h:167
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:105
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecAddExpr.h:180
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecDVecAddExpr.h:599
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse vectors.
Definition: SparseVector.h:72
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseVector base class.
Header file for the VecVecAddExpr base class.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition: TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECADDEXPR(T1, T2)
Constraint on the data type.
Definition: VecVecAddExpr.h:104
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition: AddTrait.h:163
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:1424
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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:221
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
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
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:192
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
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all vector/vector addition expression templates.
Definition: VecVecAddExpr.h:68
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.