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>
51 #include <blaze/math/Intrinsics.h>
63 #include <blaze/system/Inline.h>
65 #include <blaze/util/Assert.h>
67 #include <blaze/util/EnableIf.h>
68 #include <blaze/util/Exception.h>
70 #include <blaze/util/mpl/And.h>
71 #include <blaze/util/mpl/Max.h>
72 #include <blaze/util/SelectType.h>
73 #include <blaze/util/Types.h>
76 
77 
78 namespace blaze {
79 
80 //=================================================================================================
81 //
82 // CLASS DVECDVECSUBEXPR
83 //
84 //=================================================================================================
85 
86 //*************************************************************************************************
93 template< typename VT1 // Type of the left-hand side dense vector
94  , typename VT2 // Type of the right-hand side dense vector
95  , bool TF > // Transpose flag
96 class DVecDVecSubExpr : public DenseVector< DVecDVecSubExpr<VT1,VT2,TF>, TF >
97  , private VecVecSubExpr
98  , private Computation
99 {
100  private:
101  //**Type definitions****************************************************************************
102  typedef typename VT1::ResultType RT1;
103  typedef typename VT2::ResultType RT2;
104  typedef typename VT1::ReturnType RN1;
105  typedef typename VT2::ReturnType RN2;
106  typedef typename VT1::CompositeType CT1;
107  typedef typename VT2::CompositeType CT2;
108  typedef typename VT1::ElementType ET1;
109  typedef typename VT2::ElementType ET2;
110  //**********************************************************************************************
111 
112  //**Return type evaluation**********************************************************************
114 
119  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
120 
123  //**********************************************************************************************
124 
125  //**Serial evaluation strategy******************************************************************
127 
133  enum { useAssign = ( RequiresEvaluation<VT1>::value || RequiresEvaluation<VT2>::value || !returnExpr ) };
134 
136  template< typename VT >
138  struct UseAssign {
139  enum { value = useAssign };
140  };
142  //**********************************************************************************************
143 
144  //**Parallel evaluation strategy****************************************************************
146 
152  template< typename VT >
153  struct UseSMPAssign {
154  enum { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign };
155  };
157  //**********************************************************************************************
158 
159  public:
160  //**Type definitions****************************************************************************
166 
169 
172 
174  typedef typename SelectType< IsExpression<VT1>::value, const VT1, const VT1& >::Type LeftOperand;
175 
177  typedef typename SelectType< IsExpression<VT2>::value, const VT2, const VT2& >::Type 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 IntrinsicType load() const {
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 { vectorizable = VT1::vectorizable && VT2::vectorizable &&
435 
437  enum { smpAssignable = VT1::smpAssignable && VT2::smpAssignable };
438  //**********************************************************************************************
439 
440  //**Constructor*********************************************************************************
446  explicit inline DVecDVecSubExpr( const VT1& lhs, const VT2& rhs )
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 IntrinsicType load( size_t index ) const {
488  typedef IntrinsicTrait<ElementType> IT;
489  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
490  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
491  const IntrinsicType xmm1( lhs_.load( index ) );
492  const IntrinsicType xmm2( rhs_.load( index ) );
493  return xmm1 - xmm2;
494  }
495  //**********************************************************************************************
496 
497  //**Begin function******************************************************************************
502  inline ConstIterator begin() const {
503  return ConstIterator( lhs_.begin(), rhs_.begin() );
504  }
505  //**********************************************************************************************
506 
507  //**End function********************************************************************************
512  inline ConstIterator end() const {
513  return ConstIterator( lhs_.end(), rhs_.end() );
514  }
515  //**********************************************************************************************
516 
517  //**Size function*******************************************************************************
522  inline size_t size() const {
523  return lhs_.size();
524  }
525  //**********************************************************************************************
526 
527  //**Left operand access*************************************************************************
532  inline LeftOperand leftOperand() const {
533  return lhs_;
534  }
535  //**********************************************************************************************
536 
537  //**Right operand access************************************************************************
542  inline RightOperand rightOperand() const {
543  return rhs_;
544  }
545  //**********************************************************************************************
546 
547  //**********************************************************************************************
553  template< typename T >
554  inline bool canAlias( const T* alias ) const {
555  return ( IsExpression<VT1>::value && ( RequiresEvaluation<VT1>::value ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
556  ( IsExpression<VT2>::value && ( RequiresEvaluation<VT2>::value ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
557  }
558  //**********************************************************************************************
559 
560  //**********************************************************************************************
566  template< typename T >
567  inline bool isAliased( const T* alias ) const {
568  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
569  }
570  //**********************************************************************************************
571 
572  //**********************************************************************************************
577  inline bool isAligned() const {
578  return lhs_.isAligned() && rhs_.isAligned();
579  }
580  //**********************************************************************************************
581 
582  //**********************************************************************************************
587  inline bool canSMPAssign() const {
588  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
589  ( size() > SMP_DVECDVECSUB_THRESHOLD );
590  }
591  //**********************************************************************************************
592 
593  private:
594  //**Member variables****************************************************************************
595  LeftOperand lhs_;
596  RightOperand rhs_;
597  //**********************************************************************************************
598 
599  //**Assignment to dense vectors*****************************************************************
613  template< typename VT > // Type of the target dense vector
614  friend inline typename EnableIf< UseAssign<VT> >::Type
615  assign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
616  {
618 
619  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
620 
621  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
622  subAssign( ~lhs, rhs.rhs_ );
623  }
624  else {
625  assign ( ~lhs, rhs.lhs_ );
626  subAssign( ~lhs, rhs.rhs_ );
627  }
628  }
630  //**********************************************************************************************
631 
632  //**Assignment to sparse vectors****************************************************************
646  template< typename VT > // Type of the target sparse vector
647  friend inline typename EnableIf< UseAssign<VT> >::Type
648  assign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
649  {
651 
655 
656  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
657 
658  const ResultType tmp( serial( rhs ) );
659  assign( ~lhs, tmp );
660  }
662  //**********************************************************************************************
663 
664  //**Addition assignment to dense vectors********************************************************
678  template< typename VT > // Type of the target dense vector
679  friend inline typename EnableIf< UseAssign<VT> >::Type
680  addAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
681  {
683 
684  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
685 
686  addAssign( ~lhs, rhs.lhs_ );
687  subAssign( ~lhs, rhs.rhs_ );
688  }
690  //**********************************************************************************************
691 
692  //**Addition assignment to sparse vectors*******************************************************
693  // No special implementation for the addition assignment to sparse vectors.
694  //**********************************************************************************************
695 
696  //**Subtraction assignment to dense vectors*****************************************************
710  template< typename VT > // Type of the target dense vector
711  friend inline typename EnableIf< UseAssign<VT> >::Type
712  subAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
713  {
715 
716  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
717 
718  subAssign( ~lhs, rhs.lhs_ );
719  addAssign( ~lhs, rhs.rhs_ );
720  }
722  //**********************************************************************************************
723 
724  //**Subtraction assignment to sparse vectors****************************************************
725  // No special implementation for the subtraction assignment to sparse vectors.
726  //**********************************************************************************************
727 
728  //**Multiplication assignment to dense vectors**************************************************
742  template< typename VT > // Type of the target dense vector
743  friend inline typename EnableIf< UseAssign<VT> >::Type
744  multAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
745  {
747 
751 
752  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
753 
754  const ResultType tmp( serial( rhs ) );
755  multAssign( ~lhs, tmp );
756  }
758  //**********************************************************************************************
759 
760  //**Multiplication assignment to sparse vectors*************************************************
761  // No special implementation for the multiplication assignment to sparse vectors.
762  //**********************************************************************************************
763 
764  //**SMP assignment to dense vectors*************************************************************
778  template< typename VT > // Type of the target dense vector
779  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
780  smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
781  {
783 
784  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
785 
786  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
787  smpSubAssign( ~lhs, rhs.rhs_ );
788  }
789  else {
790  smpAssign ( ~lhs, rhs.lhs_ );
791  smpSubAssign( ~lhs, rhs.rhs_ );
792  }
793  }
795  //**********************************************************************************************
796 
797  //**SMP assignment to sparse vectors************************************************************
811  template< typename VT > // Type of the target sparse vector
812  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
813  smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
814  {
816 
820 
821  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
822 
823  const ResultType tmp( rhs );
824  smpAssign( ~lhs, tmp );
825  }
827  //**********************************************************************************************
828 
829  //**SMP addition assignment to dense vectors****************************************************
843  template< typename VT > // Type of the target dense vector
844  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
845  smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
846  {
848 
849  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
850 
851  smpAddAssign( ~lhs, rhs.lhs_ );
852  smpSubAssign( ~lhs, rhs.rhs_ );
853  }
855  //**********************************************************************************************
856 
857  //**SMP addition assignment to sparse vectors***************************************************
858  // No special implementation for the SMP addition assignment to sparse vectors.
859  //**********************************************************************************************
860 
861  //**SMP subtraction assignment to dense vectors*************************************************
875  template< typename VT > // Type of the target dense vector
876  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
877  smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
878  {
880 
881  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
882 
883  smpSubAssign( ~lhs, rhs.lhs_ );
884  smpAddAssign( ~lhs, rhs.rhs_ );
885  }
887  //**********************************************************************************************
888 
889  //**SMP subtraction assignment to sparse vectors************************************************
890  // No special implementation for the SMP subtraction assignment to sparse vectors.
891  //**********************************************************************************************
892 
893  //**SMP multiplication assignment to dense vectors**********************************************
907  template< typename VT > // Type of the target dense vector
908  friend inline typename EnableIf< UseSMPAssign<VT> >::Type
909  smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
910  {
912 
916 
917  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
918 
919  const ResultType tmp( rhs );
920  smpMultAssign( ~lhs, tmp );
921  }
923  //**********************************************************************************************
924 
925  //**SMP multiplication assignment to sparse vectors*********************************************
926  // No special implementation for the SMP multiplication assignment to sparse vectors.
927  //**********************************************************************************************
928 
929  //**Compile time checks*************************************************************************
937  //**********************************************************************************************
938 };
939 //*************************************************************************************************
940 
941 
942 
943 
944 //=================================================================================================
945 //
946 // GLOBAL BINARY ARITHMETIC OPERATORS
947 //
948 //=================================================================================================
949 
950 //*************************************************************************************************
974 template< typename T1 // Type of the left-hand side dense vector
975  , typename T2 // Type of the right-hand side dense vector
976  , bool TF > // Transpose flag
977 inline const DVecDVecSubExpr<T1,T2,TF>
979 {
981 
982  if( (~lhs).size() != (~rhs).size() ) {
983  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
984  }
985 
986  return DVecDVecSubExpr<T1,T2,TF>( ~lhs, ~rhs );
987 }
988 //*************************************************************************************************
989 
990 
991 
992 
993 //=================================================================================================
994 //
995 // SIZE SPECIALIZATIONS
996 //
997 //=================================================================================================
998 
999 //*************************************************************************************************
1001 template< typename VT1, typename VT2, bool TF >
1002 struct Size< DVecDVecSubExpr<VT1,VT2,TF> >
1003  : public Max< Size<VT1>, Size<VT2> >
1004 {};
1006 //*************************************************************************************************
1007 
1008 
1009 
1010 
1011 //=================================================================================================
1012 //
1013 // ISALIGNED SPECIALIZATIONS
1014 //
1015 //=================================================================================================
1016 
1017 //*************************************************************************************************
1019 template< typename VT1, typename VT2, bool TF >
1020 struct IsAligned< DVecDVecSubExpr<VT1,VT2,TF> >
1021  : public IsTrue< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1022 {};
1024 //*************************************************************************************************
1025 
1026 
1027 
1028 
1029 //=================================================================================================
1030 //
1031 // ISPADDED SPECIALIZATIONS
1032 //
1033 //=================================================================================================
1034 
1035 //*************************************************************************************************
1037 template< typename VT1, typename VT2, bool TF >
1038 struct IsPadded< DVecDVecSubExpr<VT1,VT2,TF> >
1039  : public IsTrue< And< IsPadded<VT1>, IsPadded<VT2> >::value >
1040 {};
1042 //*************************************************************************************************
1043 
1044 
1045 
1046 
1047 //=================================================================================================
1048 //
1049 // EXPRESSION TRAIT SPECIALIZATIONS
1050 //
1051 //=================================================================================================
1052 
1053 //*************************************************************************************************
1055 template< typename VT1, typename VT2, bool TF, bool AF >
1056 struct SubvectorExprTrait< DVecDVecSubExpr<VT1,VT2,TF>, AF >
1057 {
1058  public:
1059  //**********************************************************************************************
1060  typedef typename SubExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
1061  , typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
1062  //**********************************************************************************************
1063 };
1065 //*************************************************************************************************
1066 
1067 } // namespace blaze
1068 
1069 #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 exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
PointerType pointer
Pointer return type.
Definition: DVecDVecSubExpr.h:196
Pointer difference type of the Blaze library.
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:89
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:195
Header file for the subtraction trait.
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Access to the intrinsic elements of the vector.
Definition: DVecDVecSubExpr.h:487
ReferenceType reference
Reference return type.
Definition: DVecDVecSubExpr.h:197
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:177
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecSubExpr.h:262
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecSubExpr.h:460
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:174
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:647
Header file for the IsSame and IsStrictlySame type traits.
DVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the DVecDVecSubExpr class.
Definition: DVecDVecSubExpr.h:446
VT1::ReturnType RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:104
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:393
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
VT2::ReturnType RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:105
Header file for the And class template.
Header file for the DenseVector base class.
VT1::ElementType ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:108
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the Computation base class.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:158
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecSubExpr.h:577
Header file for the RequiresEvaluation type trait.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecSubExpr.h:238
DVecDVecSubExpr< VT1, VT2, TF > This
Type of this DVecDVecSubExpr instance.
Definition: DVecDVecSubExpr.h:161
ElementType * PointerType
Pointer return type.
Definition: DVecDVecSubExpr.h:189
Constraint on the data type.
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:417
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecSubExpr.h:225
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:261
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecDVecSubExpr.h:165
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
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
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.
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
VT1::CompositeType CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:106
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecSubExpr.h:272
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecSubExpr.h:187
Iterator over the elements of the dense vector.
Definition: DVecDVecSubExpr.h:183
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecDVecSubExpr.h:164
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
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
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
SelectType< useAssign, const ResultType, const DVecDVecSubExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecDVecSubExpr.h:171
Header file for the IsAligned type trait.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:642
Constraint on the data type.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecSubExpr.h:163
#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:78
Constraint on the data type.
VT2::ElementType ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:109
Evaluation of the return type of a subtraction expression.Via this type trait it is possible to evalu...
Definition: SubExprTrait.h:104
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecSubExpr.h:424
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
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.
Header file for the SelectType class template.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:512
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:502
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.
Header file for the serial shim.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecSubExpr.h:587
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
VT1::ConstIterator LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:201
EnableIf< IsDenseMatrix< MT1 > >::Type 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
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecDVecSubExpr.h:168
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecSubExpr.h:190
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecSubExpr.h:567
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecSubExpr.h:250
SubTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DVecDVecSubExpr.h:162
VT2::ConstIterator RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:204
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:315
IntrinsicType load() const
Access to the intrinsic elements of the vector.
Definition: DVecDVecSubExpr.h:304
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:596
SubExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecSubExpr.h:122
Header file for all intrinsic functionality.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecSubExpr.h:473
Constraint on the data type.
#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:79
VT2::CompositeType CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:107
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecSubExpr.h:554
#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:165
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
EnableIf< IsDenseMatrix< MT1 > >::Type 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
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:532
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
VT2::ResultType RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:103
Header file for the SubvectorExprTrait class template.
Base template for the SubTrait class.
Definition: SubTrait.h:138
VT1::ResultType RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:102
Header file for exception macros.
RightOperand rightOperand() const
Returns the right-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:542
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:595
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecSubExpr.h:284
Header file for the SubExprTrait class template.
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecDVecSubExpr.h:522
Expression object for dense vector-dense vector subtractions.The DVecDVecSubExpr class represents the...
Definition: DVecDVecSubExpr.h:96
System settings for the inline keywords.
EnableIf< IsDenseVector< VT1 > >::Type 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:189
Header file for the Size type trait.
#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:81
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
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:87
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.