DVecDVecMultExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECDVECMULTEXPR_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 DVECDVECMULTEXPR
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 DVecDVecMultExpr : public DenseVector< DVecDVecMultExpr<VT1,VT2,TF>, TF >
98  , private VecVecMultExpr
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 DVecDVecMultExpr( const VT1& lhs, const VT2& rhs ) noexcept
451  : lhs_( lhs ) // Left-hand side dense vector of the multiplication expression
452  , rhs_( rhs ) // Right-hand side dense vector of the multiplication 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_DVECDVECMULT_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 DVecDVecMultExpr& 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  multAssign( ~lhs, rhs.rhs_ );
624  }
625  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
626  multAssign( ~lhs, rhs.lhs_ );
627  }
628  else {
629  assign ( ~lhs, rhs.lhs_ );
630  multAssign( ~lhs, rhs.rhs_ );
631  }
632  }
634  //**********************************************************************************************
635 
636  //**Assignment to sparse vectors****************************************************************
650  template< typename VT > // Type of the target sparse vector
651  friend inline EnableIf_< UseAssign<VT> >
652  assign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
653  {
655 
659 
660  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
661 
662  const ResultType tmp( serial( rhs ) );
663  assign( ~lhs, tmp );
664  }
666  //**********************************************************************************************
667 
668  //**Addition assignment to dense vectors********************************************************
682  template< typename VT > // Type of the target dense vector
683  friend inline EnableIf_< UseAssign<VT> >
684  addAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
685  {
687 
690  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
691 
692  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
693 
694  const ResultType tmp( serial( rhs ) );
695  addAssign( ~lhs, tmp );
696  }
698  //**********************************************************************************************
699 
700  //**Addition assignment to sparse vectors*******************************************************
701  // No special implementation for the addition assignment to sparse vectors.
702  //**********************************************************************************************
703 
704  //**Subtraction assignment to dense vectors*****************************************************
718  template< typename VT > // Type of the target dense vector
719  friend inline EnableIf_< UseAssign<VT> >
720  subAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
721  {
723 
726  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
727 
728  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
729 
730  const ResultType tmp( serial( rhs ) );
731  subAssign( ~lhs, tmp );
732  }
734  //**********************************************************************************************
735 
736  //**Subtraction assignment to sparse vectors****************************************************
737  // No special implementation for the subtraction assignment to sparse vectors.
738  //**********************************************************************************************
739 
740  //**Multiplication assignment to dense vectors**************************************************
754  template< typename VT > // Type of the target dense vector
755  friend inline EnableIf_< UseAssign<VT> >
756  multAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
757  {
759 
760  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
761 
762  multAssign( ~lhs, rhs.lhs_ );
763  multAssign( ~lhs, rhs.rhs_ );
764  }
766  //**********************************************************************************************
767 
768  //**Multiplication assignment to sparse vectors*************************************************
782  template< typename VT > // Type of the target sparse vector
783  friend inline EnableIf_< UseAssign<VT> >
784  multAssign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
785  {
787 
788  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
789 
790  multAssign( ~lhs, rhs.lhs_ );
791  multAssign( ~lhs, rhs.rhs_ );
792  }
794  //**********************************************************************************************
795 
796  //**Division assignment to dense vectors********************************************************
810  template< typename VT > // Type of the target dense vector
811  friend inline EnableIf_< UseAssign<VT> >
812  divAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
813  {
815 
818  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
819 
820  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
821 
822  const ResultType tmp( serial( rhs ) );
823  divAssign( ~lhs, tmp );
824  }
826  //**********************************************************************************************
827 
828  //**Division assignment to sparse vectors*******************************************************
829  // No special implementation for the division assignment to sparse vectors.
830  //**********************************************************************************************
831 
832  //**SMP assignment to dense vectors*************************************************************
846  template< typename VT > // Type of the target dense vector
847  friend inline EnableIf_< UseSMPAssign<VT> >
848  smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
849  {
851 
852  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
853 
854  if( !IsComputation<VT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
855  smpMultAssign( ~lhs, rhs.rhs_ );
856  }
857  else if( !IsComputation<VT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
858  smpMultAssign( ~lhs, rhs.lhs_ );
859  }
860  else {
861  smpAssign ( ~lhs, rhs.lhs_ );
862  smpMultAssign( ~lhs, rhs.rhs_ );
863  }
864  }
866  //**********************************************************************************************
867 
868  //**SMP assignment to sparse vectors************************************************************
882  template< typename VT > // Type of the target sparse vector
883  friend inline EnableIf_< UseSMPAssign<VT> >
884  smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
885  {
887 
890  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
891 
892  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
893 
894  const ResultType tmp( rhs );
895  smpAssign( ~lhs, tmp );
896  }
898  //**********************************************************************************************
899 
900  //**SMP addition assignment to dense vectors****************************************************
914  template< typename VT > // Type of the target dense vector
915  friend inline EnableIf_< UseSMPAssign<VT> >
916  smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
917  {
919 
922  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
923 
924  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
925 
926  const ResultType tmp( rhs );
927  smpAddAssign( ~lhs, tmp );
928  }
930  //**********************************************************************************************
931 
932  //**SMP addition assignment to sparse vectors***************************************************
933  // No special implementation for the SMP addition assignment to sparse vectors.
934  //**********************************************************************************************
935 
936  //**SMP subtraction assignment to dense vectors*************************************************
951  template< typename VT > // Type of the target dense vector
952  friend inline EnableIf_< UseSMPAssign<VT> >
953  smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
954  {
956 
959  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
960 
961  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
962 
963  const ResultType tmp( rhs );
964  smpSubAssign( ~lhs, tmp );
965  }
967  //**********************************************************************************************
968 
969  //**SMP subtraction assignment to sparse vectors************************************************
970  // No special implementation for the SMP subtraction assignment to sparse vectors.
971  //**********************************************************************************************
972 
973  //**SMP multiplication assignment to dense vectors**********************************************
988  template< typename VT > // Type of the target dense vector
989  friend inline EnableIf_< UseSMPAssign<VT> >
990  smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
991  {
993 
994  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
995 
996  smpMultAssign( ~lhs, rhs.lhs_ );
997  smpMultAssign( ~lhs, rhs.rhs_ );
998  }
1000  //**********************************************************************************************
1001 
1002  //**SMP multiplication assignment to sparse vectors*********************************************
1017  template< typename VT > // Type of the target sparse vector
1018  friend inline EnableIf_< UseSMPAssign<VT> >
1019  smpMultAssign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1020  {
1022 
1023  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1024 
1025  smpMultAssign( ~lhs, rhs.lhs_ );
1026  smpMultAssign( ~lhs, rhs.rhs_ );
1027  }
1029  //**********************************************************************************************
1030 
1031  //**SMP division assignment to dense vectors****************************************************
1045  template< typename VT > // Type of the target dense vector
1046  friend inline EnableIf_< UseSMPAssign<VT> >
1047  smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1048  {
1050 
1053  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
1054 
1055  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1056 
1057  const ResultType tmp( rhs );
1058  smpDivAssign( ~lhs, tmp );
1059  }
1061  //**********************************************************************************************
1062 
1063  //**SMP division assignment to sparse vectors***************************************************
1064  // No special implementation for the SMP division assignment to sparse vectors.
1065  //**********************************************************************************************
1066 
1067  //**Compile time checks*************************************************************************
1075  //**********************************************************************************************
1076 };
1077 //*************************************************************************************************
1078 
1079 
1080 
1081 
1082 //=================================================================================================
1083 //
1084 // GLOBAL BINARY ARITHMETIC OPERATORS
1085 //
1086 //=================================================================================================
1087 
1088 //*************************************************************************************************
1113 template< typename T1 // Type of the left-hand side dense vector
1114  , typename T2 // Type of the right-hand side dense vector
1115  , bool TF > // Transpose flag
1116 inline const DVecDVecMultExpr<T1,T2,TF>
1118 {
1120 
1121  if( (~lhs).size() != (~rhs).size() ) {
1122  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1123  }
1124 
1125  return DVecDVecMultExpr<T1,T2,TF>( ~lhs, ~rhs );
1126 }
1127 //*************************************************************************************************
1128 
1129 
1130 
1131 
1132 //=================================================================================================
1133 //
1134 // SIZE SPECIALIZATIONS
1135 //
1136 //=================================================================================================
1137 
1138 //*************************************************************************************************
1140 template< typename VT1, typename VT2, bool TF >
1141 struct Size< DVecDVecMultExpr<VT1,VT2,TF> >
1142  : public Max< Size<VT1>, Size<VT2> >
1143 {};
1145 //*************************************************************************************************
1146 
1147 
1148 
1149 
1150 //=================================================================================================
1151 //
1152 // ISALIGNED SPECIALIZATIONS
1153 //
1154 //=================================================================================================
1155 
1156 //*************************************************************************************************
1158 template< typename VT1, typename VT2, bool TF >
1159 struct IsAligned< DVecDVecMultExpr<VT1,VT2,TF> >
1160  : public BoolConstant< And< IsAligned<VT1>, IsAligned<VT2> >::value >
1161 {};
1163 //*************************************************************************************************
1164 
1165 
1166 
1167 
1168 //=================================================================================================
1169 //
1170 // ISPADDED SPECIALIZATIONS
1171 //
1172 //=================================================================================================
1173 
1174 //*************************************************************************************************
1176 template< typename VT1, typename VT2, bool TF >
1177 struct IsPadded< DVecDVecMultExpr<VT1,VT2,TF> >
1178  : public BoolConstant< And< IsPadded<VT1>, IsPadded<VT2> >::value >
1179 {};
1181 //*************************************************************************************************
1182 
1183 
1184 
1185 
1186 //=================================================================================================
1187 //
1188 // EXPRESSION TRAIT SPECIALIZATIONS
1189 //
1190 //=================================================================================================
1191 
1192 //*************************************************************************************************
1194 template< typename VT1, typename VT2, bool TF, bool AF >
1195 struct SubvectorExprTrait< DVecDVecMultExpr<VT1,VT2,TF>, AF >
1196 {
1197  public:
1198  //**********************************************************************************************
1199  using Type = MultExprTrait_< SubvectorExprTrait_<const VT1,AF>
1200  , SubvectorExprTrait_<const VT2,AF> >;
1201  //**********************************************************************************************
1202 };
1204 //*************************************************************************************************
1205 
1206 } // namespace blaze
1207 
1208 #endif
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecMultExpr.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
Pointer difference type of the Blaze library.
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMultExpr.h:304
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
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
MultExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecMultExpr.h:123
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecMultExpr.h:250
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecMultExpr.h:213
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.
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecMultExpr.h:198
Iterator over the elements of the dense vector.
Definition: DVecDVecMultExpr.h:183
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
ReferenceType reference
Reference return type.
Definition: DVecDVecMultExpr.h:197
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
LeftOperand lhs_
Left-hand side dense vector of the multiplication expression.
Definition: DVecDVecMultExpr.h:596
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:359
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:337
ResultType_< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:104
Availability of a SIMD multiplication for the given data types.Depending on the available instruction...
Definition: HasSIMDMult.h:162
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.
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecMultExpr.h:424
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
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Header file for the Computation base class.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecMultExpr.h:294
Header file for the RequiresEvaluation type trait.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecMultExpr.h:523
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:326
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecMultExpr.h:381
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
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
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecMultExpr.h:191
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecMultExpr.h:555
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMultExpr.h:491
typename MultExprTrait< T1, T2 >::Type MultExprTrait_
Auxiliary alias declaration for the MultExprTrait class template.The MultExprTrait_ alias declaration...
Definition: MultExprTrait.h:344
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ReturnType_< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:105
Header file for the IsTemporary type trait class.
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecDVecMultExpr.h:165
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecMultExpr.h:262
Header file for the multiplication trait.
ElementType_< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:110
PointerType pointer
Pointer return type.
Definition: DVecDVecMultExpr.h:196
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.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecMultExpr.h:187
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
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
If_< IsExpression< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:174
#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
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecMultExpr.h:238
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.
IfTrue_< useAssign, const ResultType, const DVecDVecMultExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecMultExpr.h:171
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:348
#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
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:370
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecMultExpr.h:513
CompositeType_< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:108
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecMultExpr.h:284
Constraint on the data type.
Header file for the exception macros of the math module.
Header file for the VecVecMultExpr base class.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecMultExpr.h:477
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecMultExpr.h:168
CompositeType_< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:107
Header file for all forward declarations for expression class templates.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecMultExpr.h:568
DVecDVecMultExpr< VT1, VT2, TF > This
Type of this DVecDVecMultExpr instance.
Definition: DVecDVecMultExpr.h:162
Expression object for dense vector-dense vector multiplications.The DVecDVecMultExpr class represents...
Definition: DVecDVecMultExpr.h:97
ElementType_< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:109
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecMultExpr.h:503
ResultType_< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:103
If_< IsExpression< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:177
Header file for the HasSIMDMult type trait.
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecMultExpr.h:543
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecMultExpr.h:188
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecMultExpr.h:533
Header file for run time assertion macros.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecMultExpr.h:195
ConstIterator_< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:204
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
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecMultExpr.h:194
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:315
ReturnType_< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:106
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecMultExpr.h:588
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecMultExpr.h:464
DVecDVecMultExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecMultExpr class.
Definition: DVecDVecMultExpr.h:450
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecMultExpr.h:272
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecMultExpr.h:393
ElementType * PointerType
Pointer return type.
Definition: DVecDVecMultExpr.h:189
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecMultExpr.h:578
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
MultTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecMultExpr.h:163
ConstIterator_< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:201
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecMultExpr.h:109
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecMultExpr.h:417
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
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
Header file for the IntegralConstant class template.
Header file for the SubvectorExprTrait class template.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecMultExpr.h:164
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: DVecDVecMultExpr.h:597
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecMultExpr.h:225
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecMultExpr.h:405
System settings for the inline keywords.
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:63
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Base class for all vector/vector multiplication expression templates.The VecVecMultExpr class serves ...
Definition: VecVecMultExpr.h:65
#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:71
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecMultExpr.h:190