Blaze  3.6
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>
50 #include <blaze/math/Exception.h>
56 #include <blaze/math/SIMD.h>
66 #include <blaze/system/Inline.h>
68 #include <blaze/util/Assert.h>
69 #include <blaze/util/EnableIf.h>
72 #include <blaze/util/mpl/If.h>
73 #include <blaze/util/Types.h>
74 
75 
76 namespace blaze {
77 
78 //=================================================================================================
79 //
80 // CLASS DVECDVECSUBEXPR
81 //
82 //=================================================================================================
83 
84 //*************************************************************************************************
91 template< typename VT1 // Type of the left-hand side dense vector
92  , typename VT2 // Type of the right-hand side dense vector
93  , bool TF > // Transpose flag
95  : public VecVecSubExpr< DenseVector< DVecDVecSubExpr<VT1,VT2,TF>, TF > >
96  , private Computation
97 {
98  private:
99  //**Type definitions****************************************************************************
108  //**********************************************************************************************
109 
110  //**Return type evaluation**********************************************************************
112 
117  static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
118 
120  using ExprReturnType = decltype( std::declval<RN1>() - std::declval<RN2>() );
121  //**********************************************************************************************
122 
123  //**Serial evaluation strategy******************************************************************
125 
131  static constexpr bool useAssign =
132  ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !returnExpr );
133 
135  template< typename VT >
137  static constexpr bool UseAssign_v = useAssign;
139  //**********************************************************************************************
140 
141  //**Parallel evaluation strategy****************************************************************
143 
149  template< typename VT >
150  static constexpr bool UseSMPAssign_v =
151  ( ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign );
153  //**********************************************************************************************
154 
155  public:
156  //**Type definitions****************************************************************************
162 
165 
168 
170  using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
171 
173  using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
174  //**********************************************************************************************
175 
176  //**ConstIterator class definition**************************************************************
180  {
181  public:
182  //**Type definitions*************************************************************************
183  using IteratorCategory = std::random_access_iterator_tag;
188 
189  // STL iterator requirements
195 
198 
201  //*******************************************************************************************
202 
203  //**Constructor******************************************************************************
210  : left_ ( left ) // Iterator to the current left-hand side element
211  , right_( right ) // Iterator to the current right-hand side element
212  {}
213  //*******************************************************************************************
214 
215  //**Addition assignment operator*************************************************************
222  left_ += inc;
223  right_ += inc;
224  return *this;
225  }
226  //*******************************************************************************************
227 
228  //**Subtraction assignment operator**********************************************************
235  left_ -= dec;
236  right_ -= dec;
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Prefix increment operator****************************************************************
247  ++left_;
248  ++right_;
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Postfix increment operator***************************************************************
259  return ConstIterator( left_++, right_++ );
260  }
261  //*******************************************************************************************
262 
263  //**Prefix decrement operator****************************************************************
269  --left_;
270  --right_;
271  return *this;
272  }
273  //*******************************************************************************************
274 
275  //**Postfix decrement operator***************************************************************
281  return ConstIterator( left_--, right_-- );
282  }
283  //*******************************************************************************************
284 
285  //**Element access operator******************************************************************
291  return (*left_) - (*right_);
292  }
293  //*******************************************************************************************
294 
295  //**Load function****************************************************************************
300  inline auto load() const noexcept {
301  return left_.load() - right_.load();
302  }
303  //*******************************************************************************************
304 
305  //**Equality operator************************************************************************
311  inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
312  return left_ == rhs.left_;
313  }
314  //*******************************************************************************************
315 
316  //**Inequality operator**********************************************************************
322  inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
323  return left_ != rhs.left_;
324  }
325  //*******************************************************************************************
326 
327  //**Less-than operator***********************************************************************
333  inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
334  return left_ < rhs.left_;
335  }
336  //*******************************************************************************************
337 
338  //**Greater-than operator********************************************************************
344  inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
345  return left_ > rhs.left_;
346  }
347  //*******************************************************************************************
348 
349  //**Less-or-equal-than operator**************************************************************
355  inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
356  return left_ <= rhs.left_;
357  }
358  //*******************************************************************************************
359 
360  //**Greater-or-equal-than operator***********************************************************
366  inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
367  return left_ >= rhs.left_;
368  }
369  //*******************************************************************************************
370 
371  //**Subtraction operator*********************************************************************
378  return left_ - rhs.left_;
379  }
380  //*******************************************************************************************
381 
382  //**Addition operator************************************************************************
389  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
390  return ConstIterator( it.left_ + inc, it.right_ + inc );
391  }
392  //*******************************************************************************************
393 
394  //**Addition operator************************************************************************
401  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
402  return ConstIterator( it.left_ + inc, it.right_ + inc );
403  }
404  //*******************************************************************************************
405 
406  //**Subtraction operator*********************************************************************
413  friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
414  return ConstIterator( it.left_ - dec, it.right_ - dec );
415  }
416  //*******************************************************************************************
417 
418  private:
419  //**Member variables*************************************************************************
422  //*******************************************************************************************
423  };
424  //**********************************************************************************************
425 
426  //**Compilation flags***************************************************************************
428  static constexpr bool simdEnabled =
429  ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDSub_v<ET1,ET2> );
430 
432  static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
433  //**********************************************************************************************
434 
435  //**SIMD properties*****************************************************************************
437  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
438  //**********************************************************************************************
439 
440  //**Constructor*********************************************************************************
446  explicit inline DVecDVecSubExpr( const VT1& lhs, const VT2& rhs ) noexcept
447  : lhs_( lhs ) // Left-hand side dense vector of the subtraction expression
448  , rhs_( rhs ) // Right-hand side dense vector of the subtraction expression
449  {
450  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
451  }
452  //**********************************************************************************************
453 
454  //**Subscript operator**************************************************************************
460  inline ReturnType operator[]( size_t index ) const {
461  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
462  return lhs_[index] - rhs_[index];
463  }
464  //**********************************************************************************************
465 
466  //**At function*********************************************************************************
473  inline ReturnType at( size_t index ) const {
474  if( index >= lhs_.size() ) {
475  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
476  }
477  return (*this)[index];
478  }
479  //**********************************************************************************************
480 
481  //**Load function*******************************************************************************
487  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
488  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
489  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
490  return lhs_.load( index ) - rhs_.load( index );
491  }
492  //**********************************************************************************************
493 
494  //**Begin function******************************************************************************
499  inline ConstIterator begin() const {
500  return ConstIterator( lhs_.begin(), rhs_.begin() );
501  }
502  //**********************************************************************************************
503 
504  //**End function********************************************************************************
509  inline ConstIterator end() const {
510  return ConstIterator( lhs_.end(), rhs_.end() );
511  }
512  //**********************************************************************************************
513 
514  //**Size function*******************************************************************************
519  inline size_t size() const noexcept {
520  return lhs_.size();
521  }
522  //**********************************************************************************************
523 
524  //**Left operand access*************************************************************************
529  inline LeftOperand leftOperand() const noexcept {
530  return lhs_;
531  }
532  //**********************************************************************************************
533 
534  //**Right operand access************************************************************************
539  inline RightOperand rightOperand() const noexcept {
540  return rhs_;
541  }
542  //**********************************************************************************************
543 
544  //**********************************************************************************************
550  template< typename T >
551  inline bool canAlias( const T* alias ) const noexcept {
552  return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
553  ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
554  }
555  //**********************************************************************************************
556 
557  //**********************************************************************************************
563  template< typename T >
564  inline bool isAliased( const T* alias ) const noexcept {
565  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
566  }
567  //**********************************************************************************************
568 
569  //**********************************************************************************************
574  inline bool isAligned() const noexcept {
575  return lhs_.isAligned() && rhs_.isAligned();
576  }
577  //**********************************************************************************************
578 
579  //**********************************************************************************************
584  inline bool canSMPAssign() const noexcept {
585  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
586  ( size() > SMP_DVECDVECSUB_THRESHOLD );
587  }
588  //**********************************************************************************************
589 
590  private:
591  //**Member variables****************************************************************************
594  //**********************************************************************************************
595 
596  //**Assignment to dense vectors*****************************************************************
610  template< typename VT > // Type of the target dense vector
611  friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
613  {
615 
616  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
617 
618  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
619  subAssign( ~lhs, rhs.rhs_ );
620  }
621  else if( ( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) ||
622  ( !RequiresEvaluation_v<VT2> && rhs.rhs_.isAliased( &(~lhs) ) ) ) {
623  assign ( ~lhs, -rhs.rhs_ );
624  addAssign( ~lhs, rhs.lhs_ );
625  }
626  else {
627  assign ( ~lhs, rhs.lhs_ );
628  subAssign( ~lhs, rhs.rhs_ );
629  }
630  }
632  //**********************************************************************************************
633 
634  //**Assignment to sparse vectors****************************************************************
648  template< typename VT > // Type of the target sparse vector
649  friend inline auto assign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
651  {
653 
657 
658  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
659 
660  const ResultType tmp( serial( rhs ) );
661  assign( ~lhs, tmp );
662  }
664  //**********************************************************************************************
665 
666  //**Addition assignment to dense vectors********************************************************
680  template< typename VT > // Type of the target dense vector
681  friend inline auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
682  -> EnableIf_t< UseAssign_v<VT> >
683  {
685 
686  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
687 
688  if( !RequiresEvaluation_v<VT2> ) {
689  subAssign( ~lhs, rhs.rhs_ );
690  addAssign( ~lhs, rhs.lhs_ );
691  }
692  else {
693  addAssign( ~lhs, rhs.lhs_ );
694  subAssign( ~lhs, rhs.rhs_ );
695  }
696  }
698  //**********************************************************************************************
699 
700  //**Addition assignment to sparse vectors*******************************************************
701  // No special implementation for the addition assignment to sparse vectors.
702  //**********************************************************************************************
703 
704  //**Subtraction assignment to dense vectors*****************************************************
718  template< typename VT > // Type of the target dense vector
719  friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
720  -> EnableIf_t< UseAssign_v<VT> >
721  {
723 
724  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
725 
726  if( !RequiresEvaluation_v<VT2> ) {
727  addAssign( ~lhs, rhs.rhs_ );
728  subAssign( ~lhs, rhs.lhs_ );
729  }
730  else {
731  subAssign( ~lhs, rhs.lhs_ );
732  addAssign( ~lhs, rhs.rhs_ );
733  }
734  }
736  //**********************************************************************************************
737 
738  //**Subtraction assignment to sparse vectors****************************************************
739  // No special implementation for the subtraction assignment to sparse vectors.
740  //**********************************************************************************************
741 
742  //**Multiplication assignment to dense vectors**************************************************
756  template< typename VT > // Type of the target dense vector
757  friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
758  -> EnableIf_t< UseAssign_v<VT> >
759  {
761 
765 
766  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
767 
768  const ResultType tmp( serial( rhs ) );
769  multAssign( ~lhs, tmp );
770  }
772  //**********************************************************************************************
773 
774  //**Multiplication assignment to sparse vectors*************************************************
775  // No special implementation for the multiplication assignment to sparse vectors.
776  //**********************************************************************************************
777 
778  //**Division assignment to dense vectors********************************************************
792  template< typename VT > // Type of the target dense vector
793  friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
794  -> EnableIf_t< UseAssign_v<VT> >
795  {
797 
801 
802  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
803 
804  const ResultType tmp( serial( rhs ) );
805  divAssign( ~lhs, tmp );
806  }
808  //**********************************************************************************************
809 
810  //**Division assignment to sparse vectors*******************************************************
811  // No special implementation for the division assignment to sparse vectors.
812  //**********************************************************************************************
813 
814  //**SMP assignment to dense vectors*************************************************************
828  template< typename VT > // Type of the target dense vector
829  friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
830  -> EnableIf_t< UseSMPAssign_v<VT> >
831  {
833 
834  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
835 
836  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
837  smpSubAssign( ~lhs, rhs.rhs_ );
838  }
839  else if( ( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) ||
840  ( !RequiresEvaluation_v<VT2> && rhs.rhs_.isAliased( &(~lhs) ) ) ) {
841  smpAssign ( ~lhs, -rhs.rhs_ );
842  smpAddAssign( ~lhs, rhs.lhs_ );
843  }
844  else {
845  smpAssign ( ~lhs, rhs.lhs_ );
846  smpSubAssign( ~lhs, rhs.rhs_ );
847  }
848  }
850  //**********************************************************************************************
851 
852  //**SMP assignment to sparse vectors************************************************************
866  template< typename VT > // Type of the target sparse vector
867  friend inline auto smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
868  -> EnableIf_t< UseSMPAssign_v<VT> >
869  {
871 
875 
876  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
877 
878  const ResultType tmp( rhs );
879  smpAssign( ~lhs, tmp );
880  }
882  //**********************************************************************************************
883 
884  //**SMP addition assignment to dense vectors****************************************************
898  template< typename VT > // Type of the target dense vector
899  friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
900  -> EnableIf_t< UseSMPAssign_v<VT> >
901  {
903 
904  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
905 
906  if( !RequiresEvaluation_v<VT2> ) {
907  smpSubAssign( ~lhs, rhs.rhs_ );
908  smpAddAssign( ~lhs, rhs.lhs_ );
909  }
910  else {
911  smpAddAssign( ~lhs, rhs.lhs_ );
912  smpSubAssign( ~lhs, rhs.rhs_ );
913  }
914  }
916  //**********************************************************************************************
917 
918  //**SMP addition assignment to sparse vectors***************************************************
919  // No special implementation for the SMP addition assignment to sparse vectors.
920  //**********************************************************************************************
921 
922  //**SMP subtraction assignment to dense vectors*************************************************
936  template< typename VT > // Type of the target dense vector
937  friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
938  -> EnableIf_t< UseSMPAssign_v<VT> >
939  {
941 
942  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
943 
944  if( !RequiresEvaluation_v<VT2> ) {
945  smpAddAssign( ~lhs, rhs.rhs_ );
946  smpSubAssign( ~lhs, rhs.lhs_ );
947  }
948  else {
949  smpSubAssign( ~lhs, rhs.lhs_ );
950  smpAddAssign( ~lhs, rhs.rhs_ );
951  }
952  }
954  //**********************************************************************************************
955 
956  //**SMP subtraction assignment to sparse vectors************************************************
957  // No special implementation for the SMP subtraction assignment to sparse vectors.
958  //**********************************************************************************************
959 
960  //**SMP multiplication assignment to dense vectors**********************************************
974  template< typename VT > // Type of the target dense vector
975  friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
976  -> EnableIf_t< UseSMPAssign_v<VT> >
977  {
979 
983 
984  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
985 
986  const ResultType tmp( rhs );
987  smpMultAssign( ~lhs, tmp );
988  }
990  //**********************************************************************************************
991 
992  //**SMP multiplication assignment to sparse vectors*********************************************
993  // No special implementation for the SMP multiplication assignment to sparse vectors.
994  //**********************************************************************************************
995 
996  //**SMP division assignment to dense vectors****************************************************
1010  template< typename VT > // Type of the target dense vector
1011  friend inline auto smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
1012  -> EnableIf_t< UseSMPAssign_v<VT> >
1013  {
1015 
1019 
1020  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1021 
1022  const ResultType tmp( rhs );
1023  smpDivAssign( ~lhs, tmp );
1024  }
1026  //**********************************************************************************************
1027 
1028  //**SMP division assignment to sparse vectors***************************************************
1029  // No special implementation for the SMP division assignment to sparse vectors.
1030  //**********************************************************************************************
1031 
1032  //**Compile time checks*************************************************************************
1040  //**********************************************************************************************
1041 };
1042 //*************************************************************************************************
1043 
1044 
1045 
1046 
1047 //=================================================================================================
1048 //
1049 // GLOBAL BINARY ARITHMETIC OPERATORS
1050 //
1051 //=================================================================================================
1052 
1053 //*************************************************************************************************
1077 template< typename VT1 // Type of the left-hand side dense vector
1078  , typename VT2 // Type of the right-hand side dense vector
1079  , bool TF > // Transpose flag
1080 inline decltype(auto)
1081  operator-( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1082 {
1084 
1085  if( (~lhs).size() != (~rhs).size() ) {
1086  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1087  }
1088 
1089  using ReturnType = const DVecDVecSubExpr<VT1,VT2,TF>;
1090  return ReturnType( ~lhs, ~rhs );
1091 }
1092 //*************************************************************************************************
1093 
1094 
1095 
1096 
1097 //=================================================================================================
1098 //
1099 // ISALIGNED SPECIALIZATIONS
1100 //
1101 //=================================================================================================
1102 
1103 //*************************************************************************************************
1105 template< typename VT1, typename VT2, bool TF >
1106 struct IsAligned< DVecDVecSubExpr<VT1,VT2,TF> >
1107  : public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
1108 {};
1110 //*************************************************************************************************
1111 
1112 
1113 
1114 
1115 //=================================================================================================
1116 //
1117 // ISPADDED SPECIALIZATIONS
1118 //
1119 //=================================================================================================
1120 
1121 //*************************************************************************************************
1123 template< typename VT1, typename VT2, bool TF >
1124 struct IsPadded< DVecDVecSubExpr<VT1,VT2,TF> >
1125  : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1126 {};
1128 //*************************************************************************************************
1129 
1130 } // namespace blaze
1131 
1132 #endif
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecSubExpr.h:421
#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
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:103
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:333
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.The SubTrait_t alias declaration provides...
Definition: SubTrait.h:238
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecSubExpr.h:234
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecSubExpr.h:574
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecSubExpr.h:258
Header file for the subtraction trait.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:529
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecSubExpr.h:161
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.
If_t< useAssign, const ResultType, const DVecDVecSubExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecSubExpr.h:167
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:322
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecSubExpr.h:183
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.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:499
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:509
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:102
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecSubExpr.h:190
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:311
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:107
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecSubExpr.h:160
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:101
Header file for the DenseVector base class.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:191
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:300
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecSubExpr.h:164
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
ElementType * PointerType
Pointer return type.
Definition: DVecDVecSubExpr.h:185
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecSubExpr.h:209
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
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecSubExpr.h:280
Header file for the IsTemporary type trait class.
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:344
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.
decltype(std::declval< RN1 >() - std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecSubExpr.h:120
Iterator over the elements of the dense vector.
Definition: DVecDVecSubExpr.h:179
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:539
#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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecSubExpr.h:551
Header file for all SIMD functionality.
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecSubExpr.h:246
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecSubExpr.h:432
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecSubExpr.h:186
PointerType pointer
Pointer return type.
Definition: DVecDVecSubExpr.h:192
Header file for the IsAligned type trait.
Constraint on the data type.
Constraint on the data type.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecSubExpr.h:473
Header file for the exception macros of the math module.
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecSubExpr.h:420
Header file for the VecVecSubExpr base class.
Constraint on the data type.
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:104
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecSubExpr.h:377
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecSubExpr.h:519
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:197
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecSubExpr.h:564
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecSubExpr.h:437
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:170
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecSubExpr.h:401
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecSubExpr.h:428
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:184
Header file for run time assertion macros.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the subtraction expression.
Definition: DVecDVecSubExpr.h:131
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:173
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
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecSubExpr.h:187
DVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecSubExpr class.
Definition: DVecDVecSubExpr.h:446
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:100
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
Header file for all forward declarations for expression class templates.
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
Header file for the HasSIMDSub type trait.
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecSubExpr.h:268
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#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
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:355
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:389
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:487
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:105
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:593
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:413
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
ReferenceType reference
Reference return type.
Definition: DVecDVecSubExpr.h:193
Constraint on the data type.
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecSubExpr.h:117
#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 canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecSubExpr.h:584
Macro for CUDA compatibility.
SubTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecSubExpr.h:159
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:366
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECSUBEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecSubExpr.h:104
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
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:200
Header file for the IntegralConstant class template.
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:106
Base class for all vector/vector subtraction expression templates.The VecVecSubExpr class serves as a...
Definition: VecVecSubExpr.h:66
LeftOperand lhs_
Left-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:592
Expression object for dense vector-dense vector subtractions.The DVecDVecSubExpr class represents the...
Definition: DVecDVecSubExpr.h:94
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,...
Definition: Assert.h:101
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
BLAZE_DEVICE_CALLABLE ReturnType operator *() const
Direct access to the element at the current iterator position.
Definition: DVecDVecSubExpr.h:290
Header file for the IsExpression type trait class.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecSubExpr.h:460
Header file for the function trace functionality.
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecSubExpr.h:221