Blaze 3.9
DVecDVecSubExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECSUBEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DVECDVECSUBEXPR_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>
70#include <blaze/util/EnableIf.h>
73#include <blaze/util/mpl/If.h>
74#include <blaze/util/Types.h>
75
76
77namespace blaze {
78
79//=================================================================================================
80//
81// CLASS DVECDVECSUBEXPR
82//
83//=================================================================================================
84
85//*************************************************************************************************
92template< 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 VecVecSubExpr< DenseVector< DVecDVecSubExpr<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
137 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 =
152 ( ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign );
154 //**********************************************************************************************
155
156 public:
157 //**Type definitions****************************************************************************
160
163
167
170
173
175 using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
176
178 using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
179 //**********************************************************************************************
180
181 //**ConstIterator class definition**************************************************************
185 {
186 public:
187 //**Type definitions*************************************************************************
188 using IteratorCategory = std::random_access_iterator_tag;
192 using DifferenceType = ptrdiff_t;
193
194 // STL iterator requirements
200
203
206 //*******************************************************************************************
207
208 //**Constructor******************************************************************************
215 : left_ ( left ) // Iterator to the current left-hand side element
216 , right_( right ) // Iterator to the current right-hand side element
217 {}
218 //*******************************************************************************************
219
220 //**Addition assignment operator*************************************************************
227 left_ += inc;
228 right_ += inc;
229 return *this;
230 }
231 //*******************************************************************************************
232
233 //**Subtraction assignment operator**********************************************************
240 left_ -= dec;
241 right_ -= dec;
242 return *this;
243 }
244 //*******************************************************************************************
245
246 //**Prefix increment operator****************************************************************
252 ++left_;
253 ++right_;
254 return *this;
255 }
256 //*******************************************************************************************
257
258 //**Postfix increment operator***************************************************************
264 return ConstIterator( left_++, right_++ );
265 }
266 //*******************************************************************************************
267
268 //**Prefix decrement operator****************************************************************
274 --left_;
275 --right_;
276 return *this;
277 }
278 //*******************************************************************************************
279
280 //**Postfix decrement operator***************************************************************
286 return ConstIterator( left_--, right_-- );
287 }
288 //*******************************************************************************************
289
290 //**Element access operator******************************************************************
296 return (*left_) - (*right_);
297 }
298 //*******************************************************************************************
299
300 //**Load function****************************************************************************
305 inline auto load() const noexcept {
306 return left_.load() - right_.load();
307 }
308 //*******************************************************************************************
309
310 //**Equality operator************************************************************************
316 inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
317 return left_ == rhs.left_;
318 }
319 //*******************************************************************************************
320
321 //**Inequality operator**********************************************************************
327 inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
328 return left_ != rhs.left_;
329 }
330 //*******************************************************************************************
331
332 //**Less-than operator***********************************************************************
338 inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
339 return left_ < rhs.left_;
340 }
341 //*******************************************************************************************
342
343 //**Greater-than operator********************************************************************
349 inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
350 return left_ > rhs.left_;
351 }
352 //*******************************************************************************************
353
354 //**Less-or-equal-than operator**************************************************************
360 inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
361 return left_ <= rhs.left_;
362 }
363 //*******************************************************************************************
364
365 //**Greater-or-equal-than operator***********************************************************
371 inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
372 return left_ >= rhs.left_;
373 }
374 //*******************************************************************************************
375
376 //**Subtraction operator*********************************************************************
383 return left_ - rhs.left_;
384 }
385 //*******************************************************************************************
386
387 //**Addition operator************************************************************************
394 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
395 return ConstIterator( it.left_ + inc, it.right_ + inc );
396 }
397 //*******************************************************************************************
398
399 //**Addition operator************************************************************************
406 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
407 return ConstIterator( it.left_ + inc, it.right_ + inc );
408 }
409 //*******************************************************************************************
410
411 //**Subtraction operator*********************************************************************
418 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
419 return ConstIterator( it.left_ - dec, it.right_ - dec );
420 }
421 //*******************************************************************************************
422
423 private:
424 //**Member variables*************************************************************************
427 //*******************************************************************************************
428 };
429 //**********************************************************************************************
430
431 //**Compilation flags***************************************************************************
433 static constexpr bool simdEnabled =
434 ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDSub_v<ET1,ET2> );
435
437 static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
438 //**********************************************************************************************
439
440 //**SIMD properties*****************************************************************************
442 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
443 //**********************************************************************************************
444
445 //**Constructor*********************************************************************************
451 inline DVecDVecSubExpr( const VT1& lhs, const VT2& rhs ) noexcept
452 : lhs_( lhs ) // Left-hand side dense vector of the subtraction expression
453 , rhs_( rhs ) // Right-hand side dense vector of the subtraction expression
454 {
455 BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
456 }
457 //**********************************************************************************************
458
459 //**Subscript operator**************************************************************************
465 inline ReturnType operator[]( size_t index ) const {
466 BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
467 return lhs_[index] - rhs_[index];
468 }
469 //**********************************************************************************************
470
471 //**At function*********************************************************************************
478 inline ReturnType at( size_t index ) const {
479 if( index >= lhs_.size() ) {
480 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
481 }
482 return (*this)[index];
483 }
484 //**********************************************************************************************
485
486 //**Load function*******************************************************************************
492 BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
493 BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
494 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
495 return lhs_.load( index ) - rhs_.load( index );
496 }
497 //**********************************************************************************************
498
499 //**Begin function******************************************************************************
504 inline ConstIterator begin() const {
505 return ConstIterator( lhs_.begin(), rhs_.begin() );
506 }
507 //**********************************************************************************************
508
509 //**End function********************************************************************************
514 inline ConstIterator end() const {
515 return ConstIterator( lhs_.end(), rhs_.end() );
516 }
517 //**********************************************************************************************
518
519 //**Size function*******************************************************************************
524 inline size_t size() const noexcept {
525 return lhs_.size();
526 }
527 //**********************************************************************************************
528
529 //**Left operand access*************************************************************************
534 inline LeftOperand leftOperand() const noexcept {
535 return lhs_;
536 }
537 //**********************************************************************************************
538
539 //**Right operand access************************************************************************
544 inline RightOperand rightOperand() const noexcept {
545 return rhs_;
546 }
547 //**********************************************************************************************
548
549 //**********************************************************************************************
555 template< typename T >
556 inline bool canAlias( const T* alias ) const noexcept {
557 return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
558 ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
559 }
560 //**********************************************************************************************
561
562 //**********************************************************************************************
568 template< typename T >
569 inline bool isAliased( const T* alias ) const noexcept {
570 return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
571 }
572 //**********************************************************************************************
573
574 //**********************************************************************************************
579 inline bool isAligned() const noexcept {
580 return lhs_.isAligned() && rhs_.isAligned();
581 }
582 //**********************************************************************************************
583
584 //**********************************************************************************************
589 inline bool canSMPAssign() const noexcept {
590 return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
591 ( size() > SMP_DVECDVECSUB_THRESHOLD );
592 }
593 //**********************************************************************************************
594
595 private:
596 //**Member variables****************************************************************************
599 //**********************************************************************************************
600
601 //**Assignment to dense vectors*****************************************************************
615 template< typename VT > // Type of the target dense vector
616 friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
618 {
620
621 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
622
623 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
624 subAssign( *lhs, rhs.rhs_ );
625 }
626 else if( ( !IsComputation_v<VT2> && isSame( *lhs, rhs.rhs_ ) ) ||
627 ( !RequiresEvaluation_v<VT2> && rhs.rhs_.isAliased( &(*lhs) ) ) ) {
628 assign ( *lhs, -rhs.rhs_ );
629 addAssign( *lhs, rhs.lhs_ );
630 }
631 else {
632 assign ( *lhs, rhs.lhs_ );
633 subAssign( *lhs, rhs.rhs_ );
634 }
635 }
637 //**********************************************************************************************
638
639 //**Assignment to sparse vectors****************************************************************
653 template< typename VT > // Type of the target sparse vector
654 friend inline auto assign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
656 {
658
662
663 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
664
665 const ResultType tmp( serial( rhs ) );
666 assign( *lhs, tmp );
667 }
669 //**********************************************************************************************
670
671 //**Addition assignment to dense vectors********************************************************
685 template< typename VT > // Type of the target dense vector
686 friend inline auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
687 -> EnableIf_t< UseAssign_v<VT> >
688 {
690
691 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
692
693 if( !RequiresEvaluation_v<VT2> ) {
694 subAssign( *lhs, rhs.rhs_ );
695 addAssign( *lhs, rhs.lhs_ );
696 }
697 else {
698 addAssign( *lhs, rhs.lhs_ );
699 subAssign( *lhs, rhs.rhs_ );
700 }
701 }
703 //**********************************************************************************************
704
705 //**Addition assignment to sparse vectors*******************************************************
706 // No special implementation for the addition assignment to sparse vectors.
707 //**********************************************************************************************
708
709 //**Subtraction assignment to dense vectors*****************************************************
723 template< typename VT > // Type of the target dense vector
724 friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
725 -> EnableIf_t< UseAssign_v<VT> >
726 {
728
729 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
730
731 if( !RequiresEvaluation_v<VT2> ) {
732 addAssign( *lhs, rhs.rhs_ );
733 subAssign( *lhs, rhs.lhs_ );
734 }
735 else {
736 subAssign( *lhs, rhs.lhs_ );
737 addAssign( *lhs, rhs.rhs_ );
738 }
739 }
741 //**********************************************************************************************
742
743 //**Subtraction assignment to sparse vectors****************************************************
744 // No special implementation for the subtraction assignment to sparse vectors.
745 //**********************************************************************************************
746
747 //**Multiplication assignment to dense vectors**************************************************
761 template< typename VT > // Type of the target dense vector
762 friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
763 -> EnableIf_t< UseAssign_v<VT> >
764 {
766
770
771 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
772
773 const ResultType tmp( serial( rhs ) );
774 multAssign( *lhs, tmp );
775 }
777 //**********************************************************************************************
778
779 //**Multiplication assignment to sparse vectors*************************************************
780 // No special implementation for the multiplication assignment to sparse vectors.
781 //**********************************************************************************************
782
783 //**Division assignment to dense vectors********************************************************
797 template< typename VT > // Type of the target dense vector
798 friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
799 -> EnableIf_t< UseAssign_v<VT> >
800 {
802
806
807 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
808
809 const ResultType tmp( serial( rhs ) );
810 divAssign( *lhs, tmp );
811 }
813 //**********************************************************************************************
814
815 //**Division assignment to sparse vectors*******************************************************
816 // No special implementation for the division assignment to sparse vectors.
817 //**********************************************************************************************
818
819 //**SMP assignment to dense vectors*************************************************************
833 template< typename VT > // Type of the target dense vector
834 friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
835 -> EnableIf_t< UseSMPAssign_v<VT> >
836 {
838
839 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
840
841 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
842 smpSubAssign( *lhs, rhs.rhs_ );
843 }
844 else if( ( !IsComputation_v<VT2> && isSame( *lhs, rhs.rhs_ ) ) ||
845 ( !RequiresEvaluation_v<VT2> && rhs.rhs_.isAliased( &(*lhs) ) ) ) {
846 smpAssign ( *lhs, -rhs.rhs_ );
847 smpAddAssign( *lhs, rhs.lhs_ );
848 }
849 else {
850 smpAssign ( *lhs, rhs.lhs_ );
851 smpSubAssign( *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 DVecDVecSubExpr& 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 DVecDVecSubExpr& 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 smpSubAssign( *lhs, rhs.rhs_ );
913 smpAddAssign( *lhs, rhs.lhs_ );
914 }
915 else {
916 smpAddAssign( *lhs, rhs.lhs_ );
917 smpSubAssign( *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 DVecDVecSubExpr& 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 smpAddAssign( *lhs, rhs.rhs_ );
951 smpSubAssign( *lhs, rhs.lhs_ );
952 }
953 else {
954 smpSubAssign( *lhs, rhs.lhs_ );
955 smpAddAssign( *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 DVecDVecSubExpr& 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 DVecDVecSubExpr& 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//*************************************************************************************************
1082template< 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
1085inline 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
1094 using ReturnType = const DVecDVecSubExpr<VT1,VT2,TF>;
1095 return ReturnType( *lhs, *rhs );
1096}
1097//*************************************************************************************************
1098
1099
1100
1101
1102//=================================================================================================
1103//
1104// ISALIGNED SPECIALIZATIONS
1105//
1106//=================================================================================================
1107
1108//*************************************************************************************************
1110template< typename VT1, typename VT2, bool TF >
1111struct IsAligned< DVecDVecSubExpr<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//*************************************************************************************************
1128template< typename VT1, typename VT2, bool TF >
1129struct IsPadded< DVecDVecSubExpr<VT1,VT2,TF> >
1130 : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1131{};
1133//*************************************************************************************************
1134
1135} // namespace blaze
1136
1137#endif
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.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the HasSIMDSub 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.
Header file for the subtraction trait.
Iterator over the elements of the dense vector.
Definition: DVecDVecSubExpr.h:185
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:202
PointerType pointer
Pointer return type.
Definition: DVecDVecSubExpr.h:197
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecSubExpr.h:425
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecSubExpr.h:192
BLAZE_DEVICE_CALLABLE ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecSubExpr.h:295
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:349
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:360
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:394
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecSubExpr.h:195
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecSubExpr.h:382
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecSubExpr.h:285
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:196
ElementType * PointerType
Pointer return type.
Definition: DVecDVecSubExpr.h:190
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecSubExpr.h:239
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:189
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecSubExpr.h:273
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:338
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:371
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:205
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecSubExpr.h:199
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecSubExpr.h:426
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecSubExpr.h:226
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecSubExpr.h:188
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecSubExpr.h:406
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:316
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecSubExpr.h:214
ReferenceType reference
Reference return type.
Definition: DVecDVecSubExpr.h:198
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:305
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecSubExpr.h:263
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecSubExpr.h:251
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:418
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecSubExpr.h:191
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:327
Expression object for dense vector-dense vector subtractions.
Definition: DVecDVecSubExpr.h:98
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:178
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the subtraction expression.
Definition: DVecDVecSubExpr.h:132
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:104
decltype(std::declval< RN1 >() - std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecSubExpr.h:121
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecSubExpr.h:524
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:105
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:103
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:514
DVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecSubExpr class.
Definition: DVecDVecSubExpr.h:451
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:492
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:101
LeftOperand lhs_
Left-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:597
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:175
SubTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecSubExpr.h:164
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecSubExpr.h:166
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:544
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecSubExpr.h:433
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecSubExpr.h:169
If_t< useAssign, const ResultType, const DVecDVecSubExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecSubExpr.h:172
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecSubExpr.h:569
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecSubExpr.h:118
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecSubExpr.h:589
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecSubExpr.h:465
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecSubExpr.h:478
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:504
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:598
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:107
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecSubExpr.h:165
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:102
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecSubExpr.h:579
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecSubExpr.h:437
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecSubExpr.h:442
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecSubExpr.h:556
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:106
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:534
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:108
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 VecVecSubExpr 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_VECVECSUBEXPR(T1, T2)
Constraint on the data type.
Definition: VecVecSubExpr.h:104
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition: SubTrait.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 subtraction expression templates.
Definition: VecVecSubExpr.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.