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>
65 #include <blaze/system/Inline.h>
67 #include <blaze/util/Assert.h>
68 #include <blaze/util/EnableIf.h>
71 #include <blaze/util/mpl/If.h>
72 #include <blaze/util/Types.h>
73 
74 
75 namespace blaze {
76 
77 //=================================================================================================
78 //
79 // CLASS DVECDVECSUBEXPR
80 //
81 //=================================================================================================
82 
83 //*************************************************************************************************
90 template< typename VT1 // Type of the left-hand side dense vector
91  , typename VT2 // Type of the right-hand side dense vector
92  , bool TF > // Transpose flag
94  : public VecVecSubExpr< DenseVector< DVecDVecSubExpr<VT1,VT2,TF>, TF > >
95  , private Computation
96 {
97  private:
98  //**Type definitions****************************************************************************
107  //**********************************************************************************************
108 
109  //**Return type evaluation**********************************************************************
111 
116  static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
117 
119  using ExprReturnType = decltype( std::declval<RN1>() - std::declval<RN2>() );
120  //**********************************************************************************************
121 
122  //**Serial evaluation strategy******************************************************************
124 
130  static constexpr bool useAssign =
131  ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !returnExpr );
132 
134  template< typename VT >
136  static constexpr bool UseAssign_v = useAssign;
138  //**********************************************************************************************
139 
140  //**Parallel evaluation strategy****************************************************************
142 
148  template< typename VT >
149  static constexpr bool UseSMPAssign_v =
152  //**********************************************************************************************
153 
154  public:
155  //**Type definitions****************************************************************************
161 
164 
167 
169  using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
170 
172  using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
173  //**********************************************************************************************
174 
175  //**ConstIterator class definition**************************************************************
179  {
180  public:
181  //**Type definitions*************************************************************************
182  using IteratorCategory = std::random_access_iterator_tag;
187 
188  // STL iterator requirements
194 
197 
200  //*******************************************************************************************
201 
202  //**Constructor******************************************************************************
208  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
209  : left_ ( left ) // Iterator to the current left-hand side element
210  , right_( right ) // Iterator to the current right-hand side element
211  {}
212  //*******************************************************************************************
213 
214  //**Addition assignment operator*************************************************************
220  inline ConstIterator& operator+=( size_t inc ) {
221  left_ += inc;
222  right_ += inc;
223  return *this;
224  }
225  //*******************************************************************************************
226 
227  //**Subtraction assignment operator**********************************************************
233  inline ConstIterator& operator-=( size_t dec ) {
234  left_ -= dec;
235  right_ -= dec;
236  return *this;
237  }
238  //*******************************************************************************************
239 
240  //**Prefix increment operator****************************************************************
246  ++left_;
247  ++right_;
248  return *this;
249  }
250  //*******************************************************************************************
251 
252  //**Postfix increment operator***************************************************************
257  inline const ConstIterator operator++( int ) {
258  return ConstIterator( left_++, right_++ );
259  }
260  //*******************************************************************************************
261 
262  //**Prefix decrement operator****************************************************************
268  --left_;
269  --right_;
270  return *this;
271  }
272  //*******************************************************************************************
273 
274  //**Postfix decrement operator***************************************************************
279  inline const ConstIterator operator--( int ) {
280  return ConstIterator( left_--, right_-- );
281  }
282  //*******************************************************************************************
283 
284  //**Element access operator******************************************************************
289  inline ReturnType operator*() const {
290  return (*left_) - (*right_);
291  }
292  //*******************************************************************************************
293 
294  //**Load function****************************************************************************
299  inline auto load() const noexcept {
300  return left_.load() - right_.load();
301  }
302  //*******************************************************************************************
303 
304  //**Equality operator************************************************************************
310  inline bool operator==( const ConstIterator& rhs ) const {
311  return left_ == rhs.left_;
312  }
313  //*******************************************************************************************
314 
315  //**Inequality operator**********************************************************************
321  inline bool operator!=( const ConstIterator& rhs ) const {
322  return left_ != rhs.left_;
323  }
324  //*******************************************************************************************
325 
326  //**Less-than operator***********************************************************************
332  inline bool operator<( const ConstIterator& rhs ) const {
333  return left_ < rhs.left_;
334  }
335  //*******************************************************************************************
336 
337  //**Greater-than operator********************************************************************
343  inline bool operator>( const ConstIterator& rhs ) const {
344  return left_ > rhs.left_;
345  }
346  //*******************************************************************************************
347 
348  //**Less-or-equal-than operator**************************************************************
354  inline bool operator<=( const ConstIterator& rhs ) const {
355  return left_ <= rhs.left_;
356  }
357  //*******************************************************************************************
358 
359  //**Greater-or-equal-than operator***********************************************************
365  inline bool operator>=( const ConstIterator& rhs ) const {
366  return left_ >= rhs.left_;
367  }
368  //*******************************************************************************************
369 
370  //**Subtraction operator*********************************************************************
376  inline DifferenceType operator-( const ConstIterator& rhs ) const {
377  return left_ - rhs.left_;
378  }
379  //*******************************************************************************************
380 
381  //**Addition operator************************************************************************
388  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
389  return ConstIterator( it.left_ + inc, it.right_ + inc );
390  }
391  //*******************************************************************************************
392 
393  //**Addition operator************************************************************************
400  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
401  return ConstIterator( it.left_ + inc, it.right_ + inc );
402  }
403  //*******************************************************************************************
404 
405  //**Subtraction operator*********************************************************************
412  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
413  return ConstIterator( it.left_ - dec, it.right_ - dec );
414  }
415  //*******************************************************************************************
416 
417  private:
418  //**Member variables*************************************************************************
421  //*******************************************************************************************
422  };
423  //**********************************************************************************************
424 
425  //**Compilation flags***************************************************************************
427  static constexpr bool simdEnabled =
428  ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDSub_v<ET1,ET2> );
429 
431  static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
432  //**********************************************************************************************
433 
434  //**SIMD properties*****************************************************************************
436  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
437  //**********************************************************************************************
438 
439  //**Constructor*********************************************************************************
445  explicit inline DVecDVecSubExpr( const VT1& lhs, const VT2& rhs ) noexcept
446  : lhs_( lhs ) // Left-hand side dense vector of the subtraction expression
447  , rhs_( rhs ) // Right-hand side dense vector of the subtraction expression
448  {
449  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
450  }
451  //**********************************************************************************************
452 
453  //**Subscript operator**************************************************************************
459  inline ReturnType operator[]( size_t index ) const {
460  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
461  return lhs_[index] - rhs_[index];
462  }
463  //**********************************************************************************************
464 
465  //**At function*********************************************************************************
472  inline ReturnType at( size_t index ) const {
473  if( index >= lhs_.size() ) {
474  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
475  }
476  return (*this)[index];
477  }
478  //**********************************************************************************************
479 
480  //**Load function*******************************************************************************
486  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
487  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
488  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
489  return lhs_.load( index ) - rhs_.load( index );
490  }
491  //**********************************************************************************************
492 
493  //**Begin function******************************************************************************
498  inline ConstIterator begin() const {
499  return ConstIterator( lhs_.begin(), rhs_.begin() );
500  }
501  //**********************************************************************************************
502 
503  //**End function********************************************************************************
508  inline ConstIterator end() const {
509  return ConstIterator( lhs_.end(), rhs_.end() );
510  }
511  //**********************************************************************************************
512 
513  //**Size function*******************************************************************************
518  inline size_t size() const noexcept {
519  return lhs_.size();
520  }
521  //**********************************************************************************************
522 
523  //**Left operand access*************************************************************************
528  inline LeftOperand leftOperand() const noexcept {
529  return lhs_;
530  }
531  //**********************************************************************************************
532 
533  //**Right operand access************************************************************************
538  inline RightOperand rightOperand() const noexcept {
539  return rhs_;
540  }
541  //**********************************************************************************************
542 
543  //**********************************************************************************************
549  template< typename T >
550  inline bool canAlias( const T* alias ) const noexcept {
551  return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
552  ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
553  }
554  //**********************************************************************************************
555 
556  //**********************************************************************************************
562  template< typename T >
563  inline bool isAliased( const T* alias ) const noexcept {
564  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
565  }
566  //**********************************************************************************************
567 
568  //**********************************************************************************************
573  inline bool isAligned() const noexcept {
574  return lhs_.isAligned() && rhs_.isAligned();
575  }
576  //**********************************************************************************************
577 
578  //**********************************************************************************************
583  inline bool canSMPAssign() const noexcept {
584  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
585  ( size() > SMP_DVECDVECSUB_THRESHOLD );
586  }
587  //**********************************************************************************************
588 
589  private:
590  //**Member variables****************************************************************************
593  //**********************************************************************************************
594 
595  //**Assignment to dense vectors*****************************************************************
609  template< typename VT > // Type of the target dense vector
610  friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
612  {
614 
615  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
616 
617  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
618  subAssign( ~lhs, rhs.rhs_ );
619  }
620  else if( ( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) ||
621  ( !RequiresEvaluation_v<VT2> && rhs.rhs_.isAliased( &(~lhs) ) ) ) {
622  assign ( ~lhs, -rhs.rhs_ );
623  addAssign( ~lhs, rhs.lhs_ );
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 auto 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 auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
681  -> EnableIf_t< UseAssign_v<VT> >
682  {
684 
685  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
686 
687  if( !RequiresEvaluation_v<VT2> ) {
688  subAssign( ~lhs, rhs.rhs_ );
689  addAssign( ~lhs, rhs.lhs_ );
690  }
691  else {
692  addAssign( ~lhs, rhs.lhs_ );
693  subAssign( ~lhs, rhs.rhs_ );
694  }
695  }
697  //**********************************************************************************************
698 
699  //**Addition assignment to sparse vectors*******************************************************
700  // No special implementation for the addition assignment to sparse vectors.
701  //**********************************************************************************************
702 
703  //**Subtraction assignment to dense vectors*****************************************************
717  template< typename VT > // Type of the target dense vector
718  friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
719  -> EnableIf_t< UseAssign_v<VT> >
720  {
722 
723  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
724 
725  if( !RequiresEvaluation_v<VT2> ) {
726  addAssign( ~lhs, rhs.rhs_ );
727  subAssign( ~lhs, rhs.lhs_ );
728  }
729  else {
730  subAssign( ~lhs, rhs.lhs_ );
731  addAssign( ~lhs, rhs.rhs_ );
732  }
733  }
735  //**********************************************************************************************
736 
737  //**Subtraction assignment to sparse vectors****************************************************
738  // No special implementation for the subtraction assignment to sparse vectors.
739  //**********************************************************************************************
740 
741  //**Multiplication assignment to dense vectors**************************************************
755  template< typename VT > // Type of the target dense vector
756  friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
757  -> EnableIf_t< UseAssign_v<VT> >
758  {
760 
764 
765  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
766 
767  const ResultType tmp( serial( rhs ) );
768  multAssign( ~lhs, tmp );
769  }
771  //**********************************************************************************************
772 
773  //**Multiplication assignment to sparse vectors*************************************************
774  // No special implementation for the multiplication assignment to sparse vectors.
775  //**********************************************************************************************
776 
777  //**Division assignment to dense vectors********************************************************
791  template< typename VT > // Type of the target dense vector
792  friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
793  -> EnableIf_t< UseAssign_v<VT> >
794  {
796 
800 
801  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
802 
803  const ResultType tmp( serial( rhs ) );
804  divAssign( ~lhs, tmp );
805  }
807  //**********************************************************************************************
808 
809  //**Division assignment to sparse vectors*******************************************************
810  // No special implementation for the division assignment to sparse vectors.
811  //**********************************************************************************************
812 
813  //**SMP assignment to dense vectors*************************************************************
827  template< typename VT > // Type of the target dense vector
828  friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
829  -> EnableIf_t< UseSMPAssign_v<VT> >
830  {
832 
833  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
834 
835  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
836  smpSubAssign( ~lhs, rhs.rhs_ );
837  }
838  else if( ( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) ||
839  ( !RequiresEvaluation_v<VT2> && rhs.rhs_.isAliased( &(~lhs) ) ) ) {
840  smpAssign ( ~lhs, -rhs.rhs_ );
841  smpAddAssign( ~lhs, rhs.lhs_ );
842  }
843  else {
844  smpAssign ( ~lhs, rhs.lhs_ );
845  smpSubAssign( ~lhs, rhs.rhs_ );
846  }
847  }
849  //**********************************************************************************************
850 
851  //**SMP assignment to sparse vectors************************************************************
865  template< typename VT > // Type of the target sparse vector
866  friend inline auto smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
867  -> EnableIf_t< UseSMPAssign_v<VT> >
868  {
870 
874 
875  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
876 
877  const ResultType tmp( rhs );
878  smpAssign( ~lhs, tmp );
879  }
881  //**********************************************************************************************
882 
883  //**SMP addition assignment to dense vectors****************************************************
897  template< typename VT > // Type of the target dense vector
898  friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
899  -> EnableIf_t< UseSMPAssign_v<VT> >
900  {
902 
903  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
904 
905  if( !RequiresEvaluation_v<VT2> ) {
906  smpSubAssign( ~lhs, rhs.rhs_ );
907  smpAddAssign( ~lhs, rhs.lhs_ );
908  }
909  else {
910  smpAddAssign( ~lhs, rhs.lhs_ );
911  smpSubAssign( ~lhs, rhs.rhs_ );
912  }
913  }
915  //**********************************************************************************************
916 
917  //**SMP addition assignment to sparse vectors***************************************************
918  // No special implementation for the SMP addition assignment to sparse vectors.
919  //**********************************************************************************************
920 
921  //**SMP subtraction assignment to dense vectors*************************************************
935  template< typename VT > // Type of the target dense vector
936  friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
937  -> EnableIf_t< UseSMPAssign_v<VT> >
938  {
940 
941  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
942 
943  if( !RequiresEvaluation_v<VT2> ) {
944  smpAddAssign( ~lhs, rhs.rhs_ );
945  smpSubAssign( ~lhs, rhs.lhs_ );
946  }
947  else {
948  smpSubAssign( ~lhs, rhs.lhs_ );
949  smpAddAssign( ~lhs, rhs.rhs_ );
950  }
951  }
953  //**********************************************************************************************
954 
955  //**SMP subtraction assignment to sparse vectors************************************************
956  // No special implementation for the SMP subtraction assignment to sparse vectors.
957  //**********************************************************************************************
958 
959  //**SMP multiplication assignment to dense vectors**********************************************
973  template< typename VT > // Type of the target dense vector
974  friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
975  -> EnableIf_t< UseSMPAssign_v<VT> >
976  {
978 
982 
983  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
984 
985  const ResultType tmp( rhs );
986  smpMultAssign( ~lhs, tmp );
987  }
989  //**********************************************************************************************
990 
991  //**SMP multiplication assignment to sparse vectors*********************************************
992  // No special implementation for the SMP multiplication assignment to sparse vectors.
993  //**********************************************************************************************
994 
995  //**SMP division assignment to dense vectors****************************************************
1009  template< typename VT > // Type of the target dense vector
1010  friend inline auto smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecSubExpr& rhs )
1011  -> EnableIf_t< UseSMPAssign_v<VT> >
1012  {
1014 
1018 
1019  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1020 
1021  const ResultType tmp( rhs );
1022  smpDivAssign( ~lhs, tmp );
1023  }
1025  //**********************************************************************************************
1026 
1027  //**SMP division assignment to sparse vectors***************************************************
1028  // No special implementation for the SMP division assignment to sparse vectors.
1029  //**********************************************************************************************
1030 
1031  //**Compile time checks*************************************************************************
1039  //**********************************************************************************************
1040 };
1041 //*************************************************************************************************
1042 
1043 
1044 
1045 
1046 //=================================================================================================
1047 //
1048 // GLOBAL BINARY ARITHMETIC OPERATORS
1049 //
1050 //=================================================================================================
1051 
1052 //*************************************************************************************************
1076 template< typename VT1 // Type of the left-hand side dense vector
1077  , typename VT2 // Type of the right-hand side dense vector
1078  , bool TF > // Transpose flag
1079 inline decltype(auto)
1080  operator-( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1081 {
1083 
1084  if( (~lhs).size() != (~rhs).size() ) {
1085  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1086  }
1087 
1089  return ReturnType( ~lhs, ~rhs );
1090 }
1091 //*************************************************************************************************
1092 
1093 
1094 
1095 
1096 //=================================================================================================
1097 //
1098 // ISALIGNED SPECIALIZATIONS
1099 //
1100 //=================================================================================================
1101 
1102 //*************************************************************************************************
1104 template< typename VT1, typename VT2, bool TF >
1105 struct IsAligned< DVecDVecSubExpr<VT1,VT2,TF> >
1106  : public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
1107 {};
1109 //*************************************************************************************************
1110 
1111 
1112 
1113 
1114 //=================================================================================================
1115 //
1116 // ISPADDED SPECIALIZATIONS
1117 //
1118 //=================================================================================================
1119 
1120 //*************************************************************************************************
1122 template< typename VT1, typename VT2, bool TF >
1123 struct IsPadded< DVecDVecSubExpr<VT1,VT2,TF> >
1124  : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1125 {};
1127 //*************************************************************************************************
1128 
1129 } // namespace blaze
1130 
1131 #endif
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:321
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecSubExpr.h:420
#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:102
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
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecSubExpr.h:573
Header file for the subtraction trait.
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:528
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecSubExpr.h:160
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:166
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:343
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecSubExpr.h:257
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecSubExpr.h:182
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.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:224
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:498
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecSubExpr.h:508
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:101
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:388
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecSubExpr.h:189
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:106
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecSubExpr.h:159
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:100
Header file for the DenseVector base class.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecSubExpr.h:190
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecSubExpr.h:233
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:299
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:310
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:163
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:184
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecSubExpr.h:412
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
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:365
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecSubExpr.h:220
Header file for the IsTemporary type trait class.
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecSubExpr.h:376
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.
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecSubExpr.h:267
decltype(std::declval< RN1 >() - std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecSubExpr.h:119
Iterator over the elements of the dense vector.
Definition: DVecDVecSubExpr.h:178
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecSubExpr.h:538
#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
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecSubExpr.h:289
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecSubExpr.h:550
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:76
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecSubExpr.h:431
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecSubExpr.h:185
PointerType pointer
Pointer return type.
Definition: DVecDVecSubExpr.h:191
Header file for the IsAligned type trait.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:354
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:472
Header file for the exception macros of the math module.
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecSubExpr.h:419
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecSubExpr.h:400
Header file for the VecVecSubExpr base class.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:103
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecSubExpr.h:208
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecSubExpr.h:518
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:196
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecSubExpr.h:563
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecSubExpr.h:436
If_t< IsExpression_v< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:169
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecSubExpr.h:427
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:183
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:130
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:172
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:186
DVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecSubExpr class.
Definition: DVecDVecSubExpr.h:445
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:99
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecSubExpr.h:245
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
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.
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 class template represents ...
Definition: IntegralConstant.h:101
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecSubExpr.h:486
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:104
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: DVecDVecSubExpr.h:592
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:192
Constraint on the data type.
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecSubExpr.h:116
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#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:583
SubTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecSubExpr.h:158
#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:138
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:199
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecSubExpr.h:332
Header file for the IntegralConstant class template.
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecSubExpr.h:105
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:591
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecSubExpr.h:279
Expression object for dense vector-dense vector subtractions.The DVecDVecSubExpr class represents the...
Definition: DVecDVecSubExpr.h:93
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, 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
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
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:459
Header file for the function trace functionality.