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 <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
56 #include <blaze/math/SIMD.h>
66 #include <blaze/system/Inline.h>
68 #include <blaze/util/Assert.h>
69 #include <blaze/util/EnableIf.h>
72 #include <blaze/util/mpl/If.h>
73 #include <blaze/util/Types.h>
74 
75 
76 namespace blaze {
77 
78 //=================================================================================================
79 //
80 // CLASS DVECDVECMULTEXPR
81 //
82 //=================================================================================================
83 
84 //*************************************************************************************************
91 template< typename VT1 // Type of the left-hand side dense vector
92  , typename VT2 // Type of the right-hand side dense vector
93  , bool TF > // Transpose flag
95  : public VecVecMultExpr< DenseVector< DVecDVecMultExpr<VT1,VT2,TF>, TF > >
96  , private Computation
97 {
98  private:
99  //**Type definitions****************************************************************************
108  //**********************************************************************************************
109 
110  //**Return type evaluation**********************************************************************
112 
117  static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
118 
120  using ExprReturnType = decltype( std::declval<RN1>() * std::declval<RN2>() );
121  //**********************************************************************************************
122 
123  //**Serial evaluation strategy******************************************************************
125 
131  static constexpr bool useAssign =
132  ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !returnExpr );
133 
135  template< typename VT >
137  static constexpr bool UseAssign_v = useAssign;
139  //**********************************************************************************************
140 
141  //**Parallel evaluation strategy****************************************************************
143 
149  template< typename VT >
150  static constexpr bool UseSMPAssign_v =
153  //**********************************************************************************************
154 
155  public:
156  //**Type definitions****************************************************************************
162 
165 
168 
170  using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
171 
173  using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
174  //**********************************************************************************************
175 
176  //**ConstIterator class definition**************************************************************
180  {
181  public:
182  //**Type definitions*************************************************************************
183  using IteratorCategory = std::random_access_iterator_tag;
188 
189  // STL iterator requirements
195 
198 
201  //*******************************************************************************************
202 
203  //**Constructor******************************************************************************
209  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
210  : left_ ( left ) // Iterator to the current left-hand side element
211  , right_( right ) // Iterator to the current right-hand side element
212  {}
213  //*******************************************************************************************
214 
215  //**Addition assignment operator*************************************************************
221  inline ConstIterator& operator+=( size_t inc ) {
222  left_ += inc;
223  right_ += inc;
224  return *this;
225  }
226  //*******************************************************************************************
227 
228  //**Subtraction assignment operator**********************************************************
234  inline ConstIterator& operator-=( size_t dec ) {
235  left_ -= dec;
236  right_ -= dec;
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Prefix increment operator****************************************************************
247  ++left_;
248  ++right_;
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Postfix increment operator***************************************************************
258  inline const ConstIterator operator++( int ) {
259  return ConstIterator( left_++, right_++ );
260  }
261  //*******************************************************************************************
262 
263  //**Prefix decrement operator****************************************************************
269  --left_;
270  --right_;
271  return *this;
272  }
273  //*******************************************************************************************
274 
275  //**Postfix decrement operator***************************************************************
280  inline const ConstIterator operator--( int ) {
281  return ConstIterator( left_--, right_-- );
282  }
283  //*******************************************************************************************
284 
285  //**Element access operator******************************************************************
290  inline ReturnType operator*() const {
291  return (*left_) * (*right_);
292  }
293  //*******************************************************************************************
294 
295  //**Load function****************************************************************************
300  inline auto load() const noexcept {
301  return left_.load() * right_.load();
302  }
303  //*******************************************************************************************
304 
305  //**Equality operator************************************************************************
311  inline bool operator==( const ConstIterator& rhs ) const {
312  return left_ == rhs.left_;
313  }
314  //*******************************************************************************************
315 
316  //**Inequality operator**********************************************************************
322  inline bool operator!=( const ConstIterator& rhs ) const {
323  return left_ != rhs.left_;
324  }
325  //*******************************************************************************************
326 
327  //**Less-than operator***********************************************************************
333  inline bool operator<( const ConstIterator& rhs ) const {
334  return left_ < rhs.left_;
335  }
336  //*******************************************************************************************
337 
338  //**Greater-than operator********************************************************************
344  inline bool operator>( const ConstIterator& rhs ) const {
345  return left_ > rhs.left_;
346  }
347  //*******************************************************************************************
348 
349  //**Less-or-equal-than operator**************************************************************
355  inline bool operator<=( const ConstIterator& rhs ) const {
356  return left_ <= rhs.left_;
357  }
358  //*******************************************************************************************
359 
360  //**Greater-or-equal-than operator***********************************************************
366  inline bool operator>=( const ConstIterator& rhs ) const {
367  return left_ >= rhs.left_;
368  }
369  //*******************************************************************************************
370 
371  //**Subtraction operator*********************************************************************
377  inline DifferenceType operator-( const ConstIterator& rhs ) const {
378  return left_ - rhs.left_;
379  }
380  //*******************************************************************************************
381 
382  //**Addition operator************************************************************************
389  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
390  return ConstIterator( it.left_ + inc, it.right_ + inc );
391  }
392  //*******************************************************************************************
393 
394  //**Addition operator************************************************************************
401  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
402  return ConstIterator( it.left_ + inc, it.right_ + inc );
403  }
404  //*******************************************************************************************
405 
406  //**Subtraction operator*********************************************************************
413  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
414  return ConstIterator( it.left_ - dec, it.right_ - dec );
415  }
416  //*******************************************************************************************
417 
418  private:
419  //**Member variables*************************************************************************
422  //*******************************************************************************************
423  };
424  //**********************************************************************************************
425 
426  //**Compilation flags***************************************************************************
428  static constexpr bool simdEnabled =
429  ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDMult_v<ET1,ET2> );
430 
432  static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
433  //**********************************************************************************************
434 
435  //**SIMD properties*****************************************************************************
437  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
438  //**********************************************************************************************
439 
440  //**Constructor*********************************************************************************
446  explicit inline DVecDVecMultExpr( const VT1& lhs, const VT2& rhs ) noexcept
447  : lhs_( lhs ) // Left-hand side dense vector of the multiplication expression
448  , rhs_( rhs ) // Right-hand side dense vector of the multiplication expression
449  {
450  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
451  }
452  //**********************************************************************************************
453 
454  //**Subscript operator**************************************************************************
460  inline ReturnType operator[]( size_t index ) const {
461  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
462  return lhs_[index] * rhs_[index];
463  }
464  //**********************************************************************************************
465 
466  //**At function*********************************************************************************
473  inline ReturnType at( size_t index ) const {
474  if( index >= lhs_.size() ) {
475  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
476  }
477  return (*this)[index];
478  }
479  //**********************************************************************************************
480 
481  //**Load function*******************************************************************************
487  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
488  BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
489  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
490  return lhs_.load( index ) * rhs_.load( index );
491  }
492  //**********************************************************************************************
493 
494  //**Begin function******************************************************************************
499  inline ConstIterator begin() const {
500  return ConstIterator( lhs_.begin(), rhs_.begin() );
501  }
502  //**********************************************************************************************
503 
504  //**End function********************************************************************************
509  inline ConstIterator end() const {
510  return ConstIterator( lhs_.end(), rhs_.end() );
511  }
512  //**********************************************************************************************
513 
514  //**Size function*******************************************************************************
519  inline size_t size() const noexcept {
520  return lhs_.size();
521  }
522  //**********************************************************************************************
523 
524  //**Left operand access*************************************************************************
529  inline LeftOperand leftOperand() const noexcept {
530  return lhs_;
531  }
532  //**********************************************************************************************
533 
534  //**Right operand access************************************************************************
539  inline RightOperand rightOperand() const noexcept {
540  return rhs_;
541  }
542  //**********************************************************************************************
543 
544  //**********************************************************************************************
550  template< typename T >
551  inline bool canAlias( const T* alias ) const noexcept {
552  return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
553  ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
554  }
555  //**********************************************************************************************
556 
557  //**********************************************************************************************
563  template< typename T >
564  inline bool isAliased( const T* alias ) const noexcept {
565  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
566  }
567  //**********************************************************************************************
568 
569  //**********************************************************************************************
574  inline bool isAligned() const noexcept {
575  return lhs_.isAligned() && rhs_.isAligned();
576  }
577  //**********************************************************************************************
578 
579  //**********************************************************************************************
584  inline bool canSMPAssign() const noexcept {
585  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
586  ( size() > SMP_DVECDVECMULT_THRESHOLD );
587  }
588  //**********************************************************************************************
589 
590  private:
591  //**Member variables****************************************************************************
594  //**********************************************************************************************
595 
596  //**Assignment to dense vectors*****************************************************************
611  template< typename VT > // Type of the target dense vector
612  friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
613  -> EnableIf_t< UseAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
614  {
616 
617  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
618 
619  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
620  multAssign( ~lhs, rhs.rhs_ );
621  }
622  else {
623  CT1 a( serial( rhs.lhs_ ) );
624  CT2 b( serial( rhs.rhs_ ) );
625  assign( ~lhs, a * b );
626  }
627  }
629  //**********************************************************************************************
630 
631  //**Assignment to dense vectors*****************************************************************
645  template< typename VT > // Type of the target dense vector
646  friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
647  -> EnableIf_t< UseAssign_v<VT> && IsCommutative_v<VT1,VT2> >
648  {
650 
651  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
652 
653  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
654  multAssign( ~lhs, rhs.rhs_ );
655  }
656  else if( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) {
657  multAssign( ~lhs, rhs.lhs_ );
658  }
659  else if( !RequiresEvaluation_v<VT2> ) {
660  assign ( ~lhs, rhs.rhs_ );
661  multAssign( ~lhs, rhs.lhs_ );
662  }
663  else {
664  assign ( ~lhs, rhs.lhs_ );
665  multAssign( ~lhs, rhs.rhs_ );
666  }
667  }
669  //**********************************************************************************************
670 
671  //**Assignment to sparse vectors****************************************************************
685  template< typename VT > // Type of the target sparse vector
686  friend inline auto assign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
687  -> EnableIf_t< UseAssign_v<VT> >
688  {
690 
694 
695  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
696 
697  const ResultType tmp( serial( rhs ) );
698  assign( ~lhs, tmp );
699  }
701  //**********************************************************************************************
702 
703  //**Addition assignment to dense vectors********************************************************
717  template< typename VT > // Type of the target dense vector
718  friend inline auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
719  -> EnableIf_t< UseAssign_v<VT> >
720  {
722 
726 
727  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
728 
729  const ResultType tmp( serial( rhs ) );
730  addAssign( ~lhs, tmp );
731  }
733  //**********************************************************************************************
734 
735  //**Addition assignment to sparse vectors*******************************************************
736  // No special implementation for the addition assignment to sparse vectors.
737  //**********************************************************************************************
738 
739  //**Subtraction assignment to dense vectors*****************************************************
753  template< typename VT > // Type of the target dense vector
754  friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
755  -> EnableIf_t< UseAssign_v<VT> >
756  {
758 
762 
763  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
764 
765  const ResultType tmp( serial( rhs ) );
766  subAssign( ~lhs, tmp );
767  }
769  //**********************************************************************************************
770 
771  //**Subtraction assignment to sparse vectors****************************************************
772  // No special implementation for the subtraction assignment to sparse vectors.
773  //**********************************************************************************************
774 
775  //**Multiplication assignment to dense vectors**************************************************
790  template< typename VT > // Type of the target dense vector
791  friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
792  -> EnableIf_t< UseAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
793  {
795 
799 
800  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
801 
802  const ResultType tmp( serial( rhs ) );
803  multAssign( ~lhs, tmp );
804  }
806  //**********************************************************************************************
807 
808  //**Multiplication assignment to dense vectors**************************************************
823  template< typename VT > // Type of the target dense vector
824  friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
825  -> EnableIf_t< UseAssign_v<VT> && IsCommutative_v<VT1,VT2> >
826  {
828 
829  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
830 
831  if( !RequiresEvaluation_v<VT2> ) {
832  multAssign( ~lhs, rhs.rhs_ );
833  multAssign( ~lhs, rhs.lhs_ );
834  }
835  else {
836  multAssign( ~lhs, rhs.lhs_ );
837  multAssign( ~lhs, rhs.rhs_ );
838  }
839  }
841  //**********************************************************************************************
842 
843  //**Multiplication assignment to sparse vectors*************************************************
844  // No special implementation for the multiplication assignment to sparse vectors.
845  //**********************************************************************************************
846 
847  //**Division assignment to dense vectors********************************************************
861  template< typename VT > // Type of the target dense vector
862  friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
863  -> EnableIf_t< UseAssign_v<VT> >
864  {
866 
870 
871  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
872 
873  const ResultType tmp( serial( rhs ) );
874  divAssign( ~lhs, tmp );
875  }
877  //**********************************************************************************************
878 
879  //**Division assignment to sparse vectors*******************************************************
880  // No special implementation for the division assignment to sparse vectors.
881  //**********************************************************************************************
882 
883  //**SMP assignment to dense vectors*************************************************************
898  template< typename VT > // Type of the target dense vector
899  friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
900  -> EnableIf_t< UseSMPAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
901  {
903 
904  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
905 
906  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
907  multAssign( ~lhs, rhs.rhs_ );
908  }
909  else {
910  CT1 a( rhs.lhs_ );
911  CT2 b( rhs.rhs_ );
912  smpAssign( ~lhs, a * b );
913  }
914  }
916  //**********************************************************************************************
917 
918  //**SMP assignment to dense vectors*************************************************************
933  template< typename VT > // Type of the target dense vector
934  friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
935  -> EnableIf_t< UseSMPAssign_v<VT> && IsCommutative_v<VT1,VT2> >
936  {
938 
939  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
940 
941  if( !IsComputation_v<VT1> && isSame( ~lhs, rhs.lhs_ ) ) {
942  smpMultAssign( ~lhs, rhs.rhs_ );
943  }
944  else if( !IsComputation_v<VT2> && isSame( ~lhs, rhs.rhs_ ) ) {
945  smpMultAssign( ~lhs, rhs.lhs_ );
946  }
947  else if( !RequiresEvaluation_v<VT2> ) {
948  smpAssign ( ~lhs, rhs.rhs_ );
949  smpMultAssign( ~lhs, rhs.lhs_ );
950  }
951  else {
952  smpAssign ( ~lhs, rhs.lhs_ );
953  smpMultAssign( ~lhs, rhs.rhs_ );
954  }
955  }
957  //**********************************************************************************************
958 
959  //**SMP assignment to sparse vectors************************************************************
973  template< typename VT > // Type of the target sparse vector
974  friend inline auto smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& 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  smpAssign( ~lhs, tmp );
987  }
989  //**********************************************************************************************
990 
991  //**SMP addition assignment to dense vectors****************************************************
1005  template< typename VT > // Type of the target dense vector
1006  friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1007  -> EnableIf_t< UseSMPAssign_v<VT> >
1008  {
1010 
1014 
1015  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1016 
1017  const ResultType tmp( rhs );
1018  smpAddAssign( ~lhs, tmp );
1019  }
1021  //**********************************************************************************************
1022 
1023  //**SMP addition assignment to sparse vectors***************************************************
1024  // No special implementation for the SMP addition assignment to sparse vectors.
1025  //**********************************************************************************************
1026 
1027  //**SMP subtraction assignment to dense vectors*************************************************
1042  template< typename VT > // Type of the target dense vector
1043  friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1044  -> EnableIf_t< UseSMPAssign_v<VT> >
1045  {
1047 
1051 
1052  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1053 
1054  const ResultType tmp( rhs );
1055  smpSubAssign( ~lhs, tmp );
1056  }
1058  //**********************************************************************************************
1059 
1060  //**SMP subtraction assignment to sparse vectors************************************************
1061  // No special implementation for the SMP subtraction assignment to sparse vectors.
1062  //**********************************************************************************************
1063 
1064  //**SMP multiplication assignment to dense vectors**********************************************
1079  template< typename VT > // Type of the target dense vector
1080  friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1081  -> EnableIf_t< UseSMPAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
1082  {
1084 
1088 
1089  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1090 
1091  const ResultType tmp( rhs );
1092  smpMultAssign( ~lhs, tmp );
1093  }
1095  //**********************************************************************************************
1096 
1097  //**SMP multiplication assignment to dense vectors**********************************************
1112  template< typename VT > // Type of the target dense vector
1113  friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1114  -> EnableIf_t< UseSMPAssign_v<VT> && IsCommutative_v<VT1,VT2> >
1115  {
1117 
1118  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1119 
1120  if( !RequiresEvaluation_v<VT2> ) {
1121  smpMultAssign( ~lhs, rhs.rhs_ );
1122  smpMultAssign( ~lhs, rhs.lhs_ );
1123  }
1124  else {
1125  smpMultAssign( ~lhs, rhs.lhs_ );
1126  smpMultAssign( ~lhs, rhs.rhs_ );
1127  }
1128  }
1130  //**********************************************************************************************
1131 
1132  //**SMP multiplication assignment to sparse vectors*********************************************
1133  // No special implementation for the SMP multiplication assignment to sparse vectors.
1134  //**********************************************************************************************
1135 
1136  //**SMP division assignment to dense vectors****************************************************
1150  template< typename VT > // Type of the target dense vector
1151  friend inline auto smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1152  -> EnableIf_t< UseSMPAssign_v<VT> >
1153  {
1155 
1159 
1160  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
1161 
1162  const ResultType tmp( rhs );
1163  smpDivAssign( ~lhs, tmp );
1164  }
1166  //**********************************************************************************************
1167 
1168  //**SMP division assignment to sparse vectors***************************************************
1169  // No special implementation for the SMP division assignment to sparse vectors.
1170  //**********************************************************************************************
1171 
1172  //**Compile time checks*************************************************************************
1180  //**********************************************************************************************
1181 };
1182 //*************************************************************************************************
1183 
1184 
1185 
1186 
1187 //=================================================================================================
1188 //
1189 // GLOBAL BINARY ARITHMETIC OPERATORS
1190 //
1191 //=================================================================================================
1192 
1193 //*************************************************************************************************
1218 template< typename VT1 // Type of the left-hand side dense vector
1219  , typename VT2 // Type of the right-hand side dense vector
1220  , bool TF > // Transpose flag
1221 inline decltype(auto)
1222  operator*( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1223 {
1225 
1226  if( (~lhs).size() != (~rhs).size() ) {
1227  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1228  }
1229 
1231  return ReturnType( ~lhs, ~rhs );
1232 }
1233 //*************************************************************************************************
1234 
1235 
1236 
1237 
1238 //=================================================================================================
1239 //
1240 // ISALIGNED SPECIALIZATIONS
1241 //
1242 //=================================================================================================
1243 
1244 //*************************************************************************************************
1246 template< typename VT1, typename VT2, bool TF >
1247 struct IsAligned< DVecDVecMultExpr<VT1,VT2,TF> >
1248  : public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
1249 {};
1251 //*************************************************************************************************
1252 
1253 
1254 
1255 
1256 //=================================================================================================
1257 //
1258 // ISPADDED SPECIALIZATIONS
1259 //
1260 //=================================================================================================
1261 
1262 //*************************************************************************************************
1264 template< typename VT1, typename VT2, bool TF >
1265 struct IsPadded< DVecDVecMultExpr<VT1,VT2,TF> >
1266  : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1267 {};
1269 //*************************************************************************************************
1270 
1271 } // namespace blaze
1272 
1273 #endif
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecMultExpr.h:421
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:197
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:104
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecMultExpr.h:529
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecMultExpr.h:246
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecMultExpr.h:209
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.
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:101
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
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecMultExpr.h:160
Iterator over the elements of the dense vector.
Definition: DVecDVecMultExpr.h:179
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 IsCommutative type trait.
Header file for the serial shim.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecMultExpr.h:551
LeftOperand lhs_
Left-hand side dense vector of the multiplication expression.
Definition: DVecDVecMultExpr.h:592
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecMultExpr.h:290
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecMultExpr.h:428
ElementType * PointerType
Pointer return type.
Definition: DVecDVecMultExpr.h:185
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecMultExpr.h:473
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecMultExpr.h:377
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecMultExpr.h:120
Header file for the DenseVector base class.
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecMultExpr.h:420
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:102
If_t< IsExpression_v< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:170
Header file for the Computation base class.
PointerType pointer
Pointer return type.
Definition: DVecDVecMultExpr.h:192
Header file for the RequiresEvaluation type trait.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
If_t< useAssign, const ResultType, const DVecDVecMultExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecDVecMultExpr.h:167
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 ValueType
Type of the underlying elements.
Definition: DVecDVecMultExpr.h:184
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecMultExpr.h:499
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:344
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:105
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
Header file for the IsTemporary type trait class.
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecMultExpr.h:258
Header file for the multiplication trait.
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:103
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.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:311
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecMultExpr.h:574
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecMultExpr.h:584
#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:234
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecMultExpr.h:161
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
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
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecMultExpr.h:539
Header file for the IsAligned type trait.
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMultExpr.h:300
Constraint on the data type.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecMultExpr.h:280
Constraint on the data type.
Header file for the exception macros of the math module.
Header file for the VecVecMultExpr base class.
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:100
Constraint on the data type.
Header file for all forward declarations for expression class templates.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecMultExpr.h:460
Expression object for dense vector-dense vector multiplications.The DVecDVecMultExpr class represents...
Definition: DVecDVecMultExpr.h:94
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:200
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ReferenceType reference
Reference return type.
Definition: DVecDVecMultExpr.h:193
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecMultExpr.h:519
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecMultExpr.h:186
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.The MultTrait_t alias declaration provid...
Definition: MultTrait.h:240
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecMultExpr.h:564
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMultExpr.h:487
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:333
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:107
Header file for the HasSIMDMult type trait.
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecMultExpr.h:437
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecMultExpr.h:117
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:322
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
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
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
DVecDVecMultExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecMultExpr class.
Definition: DVecDVecMultExpr.h:446
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecMultExpr.h:268
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
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecMultExpr.h:389
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecMultExpr.h:183
If_t< IsExpression_v< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:173
#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
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:355
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecMultExpr.h:509
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecMultExpr.h:190
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
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecMultExpr.h:164
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:106
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:104
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecMultExpr.h:413
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
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecMultExpr.h:187
Header file for the IntegralConstant class template.
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecMultExpr.h:432
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: DVecDVecMultExpr.h:593
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecMultExpr.h:159
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the multiplication expression.
Definition: DVecDVecMultExpr.h:131
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecMultExpr.h:221
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecMultExpr.h:401
System settings for the inline keywords.
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecMultExpr.h:191
#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:66
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:366
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.
Header file for the function trace functionality.