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 <blaze/math/Aliases.h>
48 #include <blaze/math/Exception.h>
54 #include <blaze/math/SIMD.h>
66 #include <blaze/system/Inline.h>
68 #include <blaze/util/Assert.h>
70 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/mpl/And.h>
74 #include <blaze/util/mpl/If.h>
75 #include <blaze/util/mpl/Max.h>
76 #include <blaze/util/Types.h>
77 
78 
79 namespace blaze {
80 
81 //=================================================================================================
82 //
83 // CLASS DVECDVECSUBEXPR
84 //
85 //=================================================================================================
86 
87 //*************************************************************************************************
94 template< 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
97 class DVecDVecSubExpr : public DenseVector< DVecDVecSubExpr<VT1,VT2,TF>, TF >
98  , private VecVecSubExpr
99  , private Computation
100 {
101  private:
102  //**Type definitions****************************************************************************
111  //**********************************************************************************************
112 
113  //**Return type evaluation**********************************************************************
115 
120  enum : bool { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
121 
124  //**********************************************************************************************
125 
126  //**Serial evaluation strategy******************************************************************
128 
134  enum : bool { useAssign = ( RequiresEvaluation<VT1>::value || RequiresEvaluation<VT2>::value || !returnExpr ) };
135 
137  template< typename VT >
139  struct UseAssign {
140  enum : bool { value = useAssign };
141  };
143  //**********************************************************************************************
144 
145  //**Parallel evaluation strategy****************************************************************
147 
153  template< typename VT >
154  struct UseSMPAssign {
155  enum : bool { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
156  };
158  //**********************************************************************************************
159 
160  public:
161  //**Type definitions****************************************************************************
166 
169 
172 
174  typedef If_< IsExpression<VT1>, const VT1, const VT1& > LeftOperand;
175 
177  typedef If_< IsExpression<VT2>, const VT2, const VT2& > RightOperand;
178  //**********************************************************************************************
179 
180  //**ConstIterator class definition**************************************************************
184  {
185  public:
186  //**Type definitions*************************************************************************
187  typedef std::random_access_iterator_tag IteratorCategory;
188  typedef ElementType ValueType;
189  typedef ElementType* PointerType;
190  typedef ElementType& ReferenceType;
192 
193  // STL iterator requirements
194  typedef IteratorCategory iterator_category;
195  typedef ValueType value_type;
196  typedef PointerType pointer;
197  typedef ReferenceType reference;
198  typedef DifferenceType difference_type;
199 
202 
205  //*******************************************************************************************
206 
207  //**Constructor******************************************************************************
213  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
214  : left_ ( left ) // Iterator to the current left-hand side element
215  , right_( right ) // Iterator to the current right-hand side element
216  {}
217  //*******************************************************************************************
218 
219  //**Addition assignment operator*************************************************************
225  inline ConstIterator& operator+=( size_t inc ) {
226  left_ += inc;
227  right_ += inc;
228  return *this;
229  }
230  //*******************************************************************************************
231 
232  //**Subtraction assignment operator**********************************************************
238  inline ConstIterator& operator-=( size_t dec ) {
239  left_ -= dec;
240  right_ -= dec;
241  return *this;
242  }
243  //*******************************************************************************************
244 
245  //**Prefix increment operator****************************************************************
251  ++left_;
252  ++right_;
253  return *this;
254  }
255  //*******************************************************************************************
256 
257  //**Postfix increment operator***************************************************************
262  inline const ConstIterator operator++( int ) {
263  return ConstIterator( left_++, right_++ );
264  }
265  //*******************************************************************************************
266 
267  //**Prefix decrement operator****************************************************************
273  --left_;
274  --right_;
275  return *this;
276  }
277  //*******************************************************************************************
278 
279  //**Postfix decrement operator***************************************************************
284  inline const ConstIterator operator--( int ) {
285  return ConstIterator( left_--, right_-- );
286  }
287  //*******************************************************************************************
288 
289  //**Element access operator******************************************************************
294  inline ReturnType operator*() const {
295  return (*left_) - (*right_);
296  }
297  //*******************************************************************************************
298 
299  //**Load function****************************************************************************
304  inline auto load() const noexcept {
305  return left_.load() - right_.load();
306  }
307  //*******************************************************************************************
308 
309  //**Equality operator************************************************************************
315  inline bool operator==( const ConstIterator& rhs ) const {
316  return left_ == rhs.left_;
317  }
318  //*******************************************************************************************
319 
320  //**Inequality operator**********************************************************************
326  inline bool operator!=( const ConstIterator& rhs ) const {
327  return left_ != rhs.left_;
328  }
329  //*******************************************************************************************
330 
331  //**Less-than operator***********************************************************************
337  inline bool operator<( const ConstIterator& rhs ) const {
338  return left_ < rhs.left_;
339  }
340  //*******************************************************************************************
341 
342  //**Greater-than operator********************************************************************
348  inline bool operator>( const ConstIterator& rhs ) const {
349  return left_ > rhs.left_;
350  }
351  //*******************************************************************************************
352 
353  //**Less-or-equal-than operator**************************************************************
359  inline bool operator<=( const ConstIterator& rhs ) const {
360  return left_ <= rhs.left_;
361  }
362  //*******************************************************************************************
363 
364  //**Greater-or-equal-than operator***********************************************************
370  inline bool operator>=( const ConstIterator& rhs ) const {
371  return left_ >= rhs.left_;
372  }
373  //*******************************************************************************************
374 
375  //**Subtraction operator*********************************************************************
381  inline DifferenceType operator-( const ConstIterator& rhs ) const {
382  return left_ - rhs.left_;
383  }
384  //*******************************************************************************************
385 
386  //**Addition operator************************************************************************
393  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
394  return ConstIterator( it.left_ + inc, it.right_ + inc );
395  }
396  //*******************************************************************************************
397 
398  //**Addition operator************************************************************************
405  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
406  return ConstIterator( it.left_ + inc, it.right_ + inc );
407  }
408  //*******************************************************************************************
409 
410  //**Subtraction operator*********************************************************************
417  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
418  return ConstIterator( it.left_ - dec, it.right_ - dec );
419  }
420  //*******************************************************************************************
421 
422  private:
423  //**Member variables*************************************************************************
424  LeftIteratorType left_;
425  RightIteratorType right_;
426  //*******************************************************************************************
427  };
428  //**********************************************************************************************
429 
430  //**Compilation flags***************************************************************************
432  enum : bool { simdEnabled = VT1::simdEnabled && VT2::simdEnabled &&
434 
436  enum : bool { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
437  //**********************************************************************************************
438 
439  //**SIMD properties*****************************************************************************
441  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
442  //**********************************************************************************************
443 
444  //**Constructor*********************************************************************************
450  explicit inline DVecDVecSubExpr( const VT1& lhs, const VT2& rhs ) noexcept
451  : lhs_( lhs ) // Left-hand side dense vector of the subtraction expression
452  , rhs_( rhs ) // Right-hand side dense vector of the subtraction expression
453  {
454  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
455  }
456  //**********************************************************************************************
457 
458  //**Subscript operator**************************************************************************
464  inline ReturnType operator[]( size_t index ) const {
465  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
466  return lhs_[index] - rhs_[index];
467  }
468  //**********************************************************************************************
469 
470  //**At function*********************************************************************************
477  inline ReturnType at( size_t index ) const {
478  if( index >= lhs_.size() ) {
479  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
480  }
481  return (*this)[index];
482  }
483  //**********************************************************************************************
484 
485  //**Load function*******************************************************************************
491  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
492  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
493  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
494  return lhs_.load( index ) - rhs_.load( index );
495  }
496  //**********************************************************************************************
497 
498  //**Begin function******************************************************************************
503  inline ConstIterator begin() const {
504  return ConstIterator( lhs_.begin(), rhs_.begin() );
505  }
506  //**********************************************************************************************
507 
508  //**End function********************************************************************************
513  inline ConstIterator end() const {
514  return ConstIterator( lhs_.end(), rhs_.end() );
515  }
516  //**********************************************************************************************
517 
518  //**Size function*******************************************************************************
523  inline size_t size() const noexcept {
524  return lhs_.size();
525  }
526  //**********************************************************************************************
527 
528  //**Left operand access*************************************************************************
533  inline LeftOperand leftOperand() const noexcept {
534  return lhs_;
535  }
536  //**********************************************************************************************
537 
538  //**Right operand access************************************************************************
543  inline RightOperand rightOperand() const noexcept {
544  return rhs_;
545  }
546  //**********************************************************************************************
547 
548  //**********************************************************************************************
554  template< typename T >
555  inline bool canAlias( const T* alias ) const noexcept {
556  return ( IsExpression<VT1>::value && ( RequiresEvaluation<VT1>::value ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
557  ( IsExpression<VT2>::value && ( RequiresEvaluation<VT2>::value ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
558  }
559  //**********************************************************************************************
560 
561  //**********************************************************************************************
567  template< typename T >
568  inline bool isAliased( const T* alias ) const noexcept {
569  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
570  }
571  //**********************************************************************************************
572 
573  //**********************************************************************************************
578  inline bool isAligned() const noexcept {
579  return lhs_.isAligned() && rhs_.isAligned();
580  }
581  //**********************************************************************************************
582 
583  //**********************************************************************************************
588  inline bool canSMPAssign() const noexcept {
589  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
590  ( size() > SMP_DVECDVECSUB_THRESHOLD );
591  }
592  //**********************************************************************************************
593 
594  private:
595  //**Member variables****************************************************************************
596  LeftOperand lhs_;
597  RightOperand rhs_;
598  //**********************************************************************************************
599 
600  //**Assignment to dense vectors*****************************************************************
614  template< typename VT > // Type of the target dense vector
615  friend inline EnableIf_< UseAssign<VT> >
616  assign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
617  {
619 
620  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
621 
622  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
623  subAssign( ~lhs, rhs.rhs_ );
624  }
625  else {
626  assign ( ~lhs, rhs.lhs_ );
627  subAssign( ~lhs, rhs.rhs_ );
628  }
629  }
631  //**********************************************************************************************
632 
633  //**Assignment to sparse vectors****************************************************************
647  template< typename VT > // Type of the target sparse vector
648  friend inline EnableIf_< UseAssign<VT> >
649  assign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
650  {
652 
656 
657  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
658 
659  const ResultType tmp( serial( rhs ) );
660  assign( ~lhs, tmp );
661  }
663  //**********************************************************************************************
664 
665  //**Addition assignment to dense vectors********************************************************
679  template< typename VT > // Type of the target dense vector
680  friend inline EnableIf_< UseAssign<VT> >
681  addAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
682  {
684 
685  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
686 
687  addAssign( ~lhs, rhs.lhs_ );
688  subAssign( ~lhs, rhs.rhs_ );
689  }
691  //**********************************************************************************************
692 
693  //**Addition assignment to sparse vectors*******************************************************
694  // No special implementation for the addition assignment to sparse vectors.
695  //**********************************************************************************************
696 
697  //**Subtraction assignment to dense vectors*****************************************************
711  template< typename VT > // Type of the target dense vector
712  friend inline EnableIf_< UseAssign<VT> >
713  subAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
714  {
716 
717  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
718 
719  subAssign( ~lhs, rhs.lhs_ );
720  addAssign( ~lhs, rhs.rhs_ );
721  }
723  //**********************************************************************************************
724 
725  //**Subtraction assignment to sparse vectors****************************************************
726  // No special implementation for the subtraction assignment to sparse vectors.
727  //**********************************************************************************************
728 
729  //**Multiplication assignment to dense vectors**************************************************
743  template< typename VT > // Type of the target dense vector
744  friend inline EnableIf_< UseAssign<VT> >
745  multAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
746  {
748 
751  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
752 
753  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
754 
755  const ResultType tmp( serial( rhs ) );
756  multAssign( ~lhs, tmp );
757  }
759  //**********************************************************************************************
760 
761  //**Multiplication assignment to sparse vectors*************************************************
762  // No special implementation for the multiplication assignment to sparse vectors.
763  //**********************************************************************************************
764 
765  //**Division assignment to dense vectors********************************************************
779  template< typename VT > // Type of the target dense vector
780  friend inline EnableIf_< UseAssign<VT> >
781  divAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
782  {
784 
787  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
788 
789  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
790 
791  const ResultType tmp( serial( rhs ) );
792  divAssign( ~lhs, tmp );
793  }
795  //**********************************************************************************************
796 
797  //**Division assignment to sparse vectors*******************************************************
798  // No special implementation for the division assignment to sparse vectors.
799  //**********************************************************************************************
800 
801  //**SMP assignment to dense vectors*************************************************************
815  template< typename VT > // Type of the target dense vector
816  friend inline EnableIf_< UseSMPAssign<VT> >
817  smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
818  {
820 
821  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
822 
823  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
824  smpSubAssign( ~lhs, rhs.rhs_ );
825  }
826  else {
827  smpAssign ( ~lhs, rhs.lhs_ );
828  smpSubAssign( ~lhs, rhs.rhs_ );
829  }
830  }
832  //**********************************************************************************************
833 
834  //**SMP assignment to sparse vectors************************************************************
848  template< typename VT > // Type of the target sparse vector
849  friend inline EnableIf_< UseSMPAssign<VT> >
850  smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
851  {
853 
856  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
857 
858  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
859 
860  const ResultType tmp( rhs );
861  smpAssign( ~lhs, tmp );
862  }
864  //**********************************************************************************************
865 
866  //**SMP addition assignment to dense vectors****************************************************
880  template< typename VT > // Type of the target dense vector
881  friend inline EnableIf_< UseSMPAssign<VT> >
882  smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
883  {
885 
886  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
887 
888  smpAddAssign( ~lhs, rhs.lhs_ );
889  smpSubAssign( ~lhs, rhs.rhs_ );
890  }
892  //**********************************************************************************************
893 
894  //**SMP addition assignment to sparse vectors***************************************************
895  // No special implementation for the SMP addition assignment to sparse vectors.
896  //**********************************************************************************************
897 
898  //**SMP subtraction assignment to dense vectors*************************************************
912  template< typename VT > // Type of the target dense vector
913  friend inline EnableIf_< UseSMPAssign<VT> >
914  smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
915  {
917 
918  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
919 
920  smpSubAssign( ~lhs, rhs.lhs_ );
921  smpAddAssign( ~lhs, rhs.rhs_ );
922  }
924  //**********************************************************************************************
925 
926  //**SMP subtraction assignment to sparse vectors************************************************
927  // No special implementation for the SMP subtraction assignment to sparse vectors.
928  //**********************************************************************************************
929 
930  //**SMP multiplication assignment to dense vectors**********************************************
944  template< typename VT > // Type of the target dense vector
945  friend inline EnableIf_< UseSMPAssign<VT> >
946  smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
947  {
949 
952  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
953 
954  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
955 
956  const ResultType tmp( rhs );
957  smpMultAssign( ~lhs, tmp );
958  }
960  //**********************************************************************************************
961 
962  //**SMP multiplication assignment to sparse vectors*********************************************
963  // No special implementation for the SMP multiplication assignment to sparse vectors.
964  //**********************************************************************************************
965 
966  //**SMP division assignment to dense vectors****************************************************
980  template< typename VT > // Type of the target dense vector
981  friend inline EnableIf_< UseSMPAssign<VT> >
982  smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
983  {
985 
988  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
989 
990  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
991 
992  const ResultType tmp( rhs );
993  smpDivAssign( ~lhs, tmp );
994  }
996  //**********************************************************************************************
997 
998  //**SMP division assignment to sparse vectors***************************************************
999  // No special implementation for the SMP division assignment to sparse vectors.
1000  //**********************************************************************************************
1001 
1002  //**Compile time checks*************************************************************************
1010  //**********************************************************************************************
1011 };
1012 //*************************************************************************************************
1013 
1014 
1015 
1016 
1017 //=================================================================================================
1018 //
1019 // GLOBAL BINARY ARITHMETIC OPERATORS
1020 //
1021 //=================================================================================================
1022 
1023 //*************************************************************************************************
1047 template< typename T1 // Type of the left-hand side dense vector
1048  , typename T2 // Type of the right-hand side dense vector
1049  , bool TF > // Transpose flag
1050 inline const DVecDVecSubExpr<T1,T2,TF>
1052 {
1054 
1055  if( (~lhs).size() != (~rhs).size() ) {
1056  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1057  }
1058 
1059  return DVecDVecSubExpr<T1,T2,TF>( ~lhs, ~rhs );
1060 }
1061 //*************************************************************************************************
1062 
1063 
1064 
1065 
1066 //=================================================================================================
1067 //
1068 // SIZE SPECIALIZATIONS
1069 //
1070 //=================================================================================================
1071 
1072 //*************************************************************************************************
1074 template< typename VT1, typename VT2, bool TF >
1075 struct Size< DVecDVecSubExpr<VT1,VT2,TF> >
1076  : public Max< Size<VT1>, Size<VT2> >
1077 {};
1079 //*************************************************************************************************
1080 
1081 
1082 
1083 
1084 //=================================================================================================
1085 //
1086 // ISALIGNED SPECIALIZATIONS
1087 //
1088 //=================================================================================================
1089 
1090 //*************************************************************************************************
1092 template< typename VT1, typename VT2, bool TF >
1093 struct IsAligned< DVecDVecSubExpr<VT1,VT2,TF> >
1094  : public BoolConstant< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1095 {};
1097 //*************************************************************************************************
1098 
1099 
1100 
1101 
1102 //=================================================================================================
1103 //
1104 // ISPADDED SPECIALIZATIONS
1105 //
1106 //=================================================================================================
1107 
1108 //*************************************************************************************************
1110 template< typename VT1, typename VT2, bool TF >
1111 struct IsPadded< DVecDVecSubExpr<VT1,VT2,TF> >
1112  : public BoolConstant< And< IsPadded<VT1>, IsPadded<VT2> >::value >
1113 {};
1115 //*************************************************************************************************
1116 
1117 
1118 
1119 
1120 //=================================================================================================
1121 //
1122 // EXPRESSION TRAIT SPECIALIZATIONS
1123 //
1124 //=================================================================================================
1125 
1126 //*************************************************************************************************
1128 template< typename VT1, typename VT2, bool TF, bool AF >
1129 struct SubvectorExprTrait< DVecDVecSubExpr<VT1,VT2,TF>, AF >
1130 {
1131  public:
1132  //**********************************************************************************************
1133  using Type = SubExprTrait_< SubvectorExprTrait_<const VT1,AF>
1134  , SubvectorExprTrait_<const VT2,AF> >;
1135  //**********************************************************************************************
1136 };
1138 //*************************************************************************************************
1139 
1140 } // namespace blaze
1141 
1142 #endif
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecSubExpr.h:191
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecSubExpr.h:425
#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
PointerType pointer
Pointer return type.
Definition: DVecDVecSubExpr.h:196
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Header file for the Max class template.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:72
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:110
Availability of a SIMD subtraction for the given data types.Depending on the available instruction se...
Definition: HasSIMDSub.h:163
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:195
Header file for the subtraction trait.
ResultType_< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:104
BLAZE_ALWAYS_INLINE 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:653
Header file for basic type definitions.
ReferenceType reference
Reference return type.
Definition: DVecDVecSubExpr.h:197
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecSubExpr.h:262
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the serial shim.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecSubExpr.h:464
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:393
ConstIterator_< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:204
SubExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecSubExpr.h:123
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
Header file for the And class template.
Header file for the DenseVector base class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
Header file for the Computation base class.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
Header file for the RequiresEvaluation type trait.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecSubExpr.h:238
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
DVecDVecSubExpr< VT1, VT2, TF > This
Type of this DVecDVecSubExpr instance.
Definition: DVecDVecSubExpr.h:162
ElementType * PointerType
Pointer return type.
Definition: DVecDVecSubExpr.h:189
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecSubExpr.h:578
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
ConstIterator_< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:201
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:417
typename SubExprTrait< T1, T2 >::Type SubExprTrait_
Auxiliary alias declaration for the SubExprTrait class template.The SubExprTrait_ alias declaration p...
Definition: SubExprTrait.h:220
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecSubExpr.h:225
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecSubExpr.h:294
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:359
IfTrue_< useAssign, const ResultType, const DVecDVecSubExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecSubExpr.h:171
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:370
Header file for the IsTemporary type trait class.
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecSubExpr.h:168
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:106
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecSubExpr.h:194
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecSubExpr.h:381
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If class template.
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecSubExpr.h:272
ResultType_< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:103
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecSubExpr.h:187
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Iterator over the elements of the dense vector.
Definition: DVecDVecSubExpr.h:183
#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
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:533
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:326
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecSubExpr.h:198
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Header file for the IsAligned type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
CompositeType_< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:107
Constraint on the data type.
Header file for the exception macros of the math module.
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecSubExpr.h:424
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecSubExpr.h:405
Header file for the VecVecSubExpr base class.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:513
Header file for all forward declarations for expression class templates.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:503
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:188
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecSubExpr.h:588
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecSubExpr.h:213
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:337
Header file for run time assertion macros.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecSubExpr.h:523
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
DVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecSubExpr class.
Definition: DVecDVecSubExpr.h:450
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecSubExpr.h:190
If_< IsExpression< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:174
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecSubExpr.h:250
If_< IsExpression< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:177
Header file for the HasSIMDSub type trait.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:315
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecDVecSubExpr.h:165
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:597
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecSubExpr.h:555
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecSubExpr.h:477
Constraint on the data type.
ReturnType_< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:105
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#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
#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:109
Header file for the IsComputation type trait class.
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
ElementType_< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:109
Header file for the IntegralConstant class template.
Header file for the SubvectorExprTrait class template.
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:543
SubTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecSubExpr.h:163
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:491
Base class for all vector/vector subtraction expression templates.The VecVecSubExpr class serves as a...
Definition: VecVecSubExpr.h:65
LeftOperand lhs_
Left-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:596
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecSubExpr.h:284
Header file for the SubExprTrait class template.
Expression object for dense vector-dense vector subtractions.The DVecDVecSubExpr class represents the...
Definition: DVecDVecSubExpr.h:97
System settings for the inline keywords.
Header file for the Size type trait.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecSubExpr.h:164
#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.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:348
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecSubExpr.h:568
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:71
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:304
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:108