Blaze 3.9
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>
56#include <blaze/math/SIMD.h>
67#include <blaze/system/Inline.h>
70#include <blaze/util/Assert.h>
71#include <blaze/util/EnableIf.h>
74#include <blaze/util/mpl/If.h>
75#include <blaze/util/Types.h>
76
77
78namespace blaze {
79
80//=================================================================================================
81//
82// CLASS DVECDVECMULTEXPR
83//
84//=================================================================================================
85
86//*************************************************************************************************
93template< typename VT1 // Type of the left-hand side dense vector
94 , typename VT2 // Type of the right-hand side dense vector
95 , bool TF > // Transpose flag
97 : public VecVecMultExpr< DenseVector< DVecDVecMultExpr<VT1,VT2,TF>, TF > >
98 , private Computation
99{
100 private:
101 //**Type definitions****************************************************************************
110 //**********************************************************************************************
111
112 //**Return type evaluation**********************************************************************
114
119 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
120
122 using ExprReturnType = decltype( std::declval<RN1>() * std::declval<RN2>() );
123 //**********************************************************************************************
124
125 //**Serial evaluation strategy******************************************************************
127
133 static constexpr bool useAssign =
134 ( RequiresEvaluation_v<VT1> || RequiresEvaluation_v<VT2> || !returnExpr );
135
138 template< typename VT >
139 static constexpr bool UseAssign_v = useAssign;
141 //**********************************************************************************************
142
143 //**Parallel evaluation strategy****************************************************************
145
151 template< typename VT >
152 static constexpr bool UseSMPAssign_v =
153 ( ( !VT1::smpAssignable || !VT2::smpAssignable ) && useAssign );
155 //**********************************************************************************************
156
157 public:
158 //**Type definitions****************************************************************************
161
164
168
171
174
176 using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
177
179 using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
180 //**********************************************************************************************
181
182 //**ConstIterator class definition**************************************************************
186 {
187 public:
188 //**Type definitions*************************************************************************
189 using IteratorCategory = std::random_access_iterator_tag;
193 using DifferenceType = ptrdiff_t;
194
195 // STL iterator requirements
201
204
207 //*******************************************************************************************
208
209 //**Constructor******************************************************************************
216 : left_ ( left ) // Iterator to the current left-hand side element
217 , right_( right ) // Iterator to the current right-hand side element
218 {}
219 //*******************************************************************************************
220
221 //**Addition assignment operator*************************************************************
228 left_ += inc;
229 right_ += inc;
230 return *this;
231 }
232 //*******************************************************************************************
233
234 //**Subtraction assignment operator**********************************************************
241 left_ -= dec;
242 right_ -= dec;
243 return *this;
244 }
245 //*******************************************************************************************
246
247 //**Prefix increment operator****************************************************************
253 ++left_;
254 ++right_;
255 return *this;
256 }
257 //*******************************************************************************************
258
259 //**Postfix increment operator***************************************************************
265 return ConstIterator( left_++, right_++ );
266 }
267 //*******************************************************************************************
268
269 //**Prefix decrement operator****************************************************************
275 --left_;
276 --right_;
277 return *this;
278 }
279 //*******************************************************************************************
280
281 //**Postfix decrement operator***************************************************************
287 return ConstIterator( left_--, right_-- );
288 }
289 //*******************************************************************************************
290
291 //**Element access operator******************************************************************
297 return (*left_) * (*right_);
298 }
299 //*******************************************************************************************
300
301 //**Load function****************************************************************************
306 inline auto load() const noexcept {
307 return left_.load() * right_.load();
308 }
309 //*******************************************************************************************
310
311 //**Equality operator************************************************************************
317 inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
318 return left_ == rhs.left_;
319 }
320 //*******************************************************************************************
321
322 //**Inequality operator**********************************************************************
328 inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
329 return left_ != rhs.left_;
330 }
331 //*******************************************************************************************
332
333 //**Less-than operator***********************************************************************
339 inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
340 return left_ < rhs.left_;
341 }
342 //*******************************************************************************************
343
344 //**Greater-than operator********************************************************************
350 inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
351 return left_ > rhs.left_;
352 }
353 //*******************************************************************************************
354
355 //**Less-or-equal-than operator**************************************************************
361 inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
362 return left_ <= rhs.left_;
363 }
364 //*******************************************************************************************
365
366 //**Greater-or-equal-than operator***********************************************************
372 inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
373 return left_ >= rhs.left_;
374 }
375 //*******************************************************************************************
376
377 //**Subtraction operator*********************************************************************
384 return left_ - rhs.left_;
385 }
386 //*******************************************************************************************
387
388 //**Addition operator************************************************************************
395 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
396 return ConstIterator( it.left_ + inc, it.right_ + inc );
397 }
398 //*******************************************************************************************
399
400 //**Addition operator************************************************************************
407 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
408 return ConstIterator( it.left_ + inc, it.right_ + inc );
409 }
410 //*******************************************************************************************
411
412 //**Subtraction operator*********************************************************************
419 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
420 return ConstIterator( it.left_ - dec, it.right_ - dec );
421 }
422 //*******************************************************************************************
423
424 private:
425 //**Member variables*************************************************************************
428 //*******************************************************************************************
429 };
430 //**********************************************************************************************
431
432 //**Compilation flags***************************************************************************
434 static constexpr bool simdEnabled =
435 ( VT1::simdEnabled && VT2::simdEnabled && HasSIMDMult_v<ET1,ET2> );
436
438 static constexpr bool smpAssignable = ( VT1::smpAssignable && VT2::smpAssignable );
439 //**********************************************************************************************
440
441 //**SIMD properties*****************************************************************************
443 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
444 //**********************************************************************************************
445
446 //**Constructor*********************************************************************************
452 inline DVecDVecMultExpr( const VT1& lhs, const VT2& rhs ) noexcept
453 : lhs_( lhs ) // Left-hand side dense vector of the multiplication expression
454 , rhs_( rhs ) // Right-hand side dense vector of the multiplication expression
455 {
456 BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
457 }
458 //**********************************************************************************************
459
460 //**Subscript operator**************************************************************************
466 inline ReturnType operator[]( size_t index ) const {
467 BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
468 return lhs_[index] * rhs_[index];
469 }
470 //**********************************************************************************************
471
472 //**At function*********************************************************************************
479 inline ReturnType at( size_t index ) const {
480 if( index >= lhs_.size() ) {
481 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
482 }
483 return (*this)[index];
484 }
485 //**********************************************************************************************
486
487 //**Load function*******************************************************************************
493 BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
494 BLAZE_INTERNAL_ASSERT( index < lhs_.size() , "Invalid vector access index" );
495 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
496 return lhs_.load( index ) * rhs_.load( index );
497 }
498 //**********************************************************************************************
499
500 //**Begin function******************************************************************************
505 inline ConstIterator begin() const {
506 return ConstIterator( lhs_.begin(), rhs_.begin() );
507 }
508 //**********************************************************************************************
509
510 //**End function********************************************************************************
515 inline ConstIterator end() const {
516 return ConstIterator( lhs_.end(), rhs_.end() );
517 }
518 //**********************************************************************************************
519
520 //**Size function*******************************************************************************
525 inline size_t size() const noexcept {
526 return lhs_.size();
527 }
528 //**********************************************************************************************
529
530 //**Left operand access*************************************************************************
535 inline LeftOperand leftOperand() const noexcept {
536 return lhs_;
537 }
538 //**********************************************************************************************
539
540 //**Right operand access************************************************************************
545 inline RightOperand rightOperand() const noexcept {
546 return rhs_;
547 }
548 //**********************************************************************************************
549
550 //**********************************************************************************************
556 template< typename T >
557 inline bool canAlias( const T* alias ) const noexcept {
558 return ( IsExpression_v<VT1> && ( RequiresEvaluation_v<VT1> ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
559 ( IsExpression_v<VT2> && ( RequiresEvaluation_v<VT2> ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
560 }
561 //**********************************************************************************************
562
563 //**********************************************************************************************
569 template< typename T >
570 inline bool isAliased( const T* alias ) const noexcept {
571 return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
572 }
573 //**********************************************************************************************
574
575 //**********************************************************************************************
580 inline bool isAligned() const noexcept {
581 return lhs_.isAligned() && rhs_.isAligned();
582 }
583 //**********************************************************************************************
584
585 //**********************************************************************************************
590 inline bool canSMPAssign() const noexcept {
591 return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
592 ( size() > SMP_DVECDVECMULT_THRESHOLD );
593 }
594 //**********************************************************************************************
595
596 private:
597 //**Member variables****************************************************************************
600 //**********************************************************************************************
601
602 //**Assignment to dense vectors*****************************************************************
617 template< typename VT > // Type of the target dense vector
618 friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
619 -> EnableIf_t< UseAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
620 {
622
623 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
624
625 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
626 multAssign( *lhs, rhs.rhs_ );
627 }
628 else {
629 CT1 a( serial( rhs.lhs_ ) );
630 CT2 b( serial( rhs.rhs_ ) );
631 assign( *lhs, a * b );
632 }
633 }
635 //**********************************************************************************************
636
637 //**Assignment to dense vectors*****************************************************************
651 template< typename VT > // Type of the target dense vector
652 friend inline auto assign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
653 -> EnableIf_t< UseAssign_v<VT> && IsCommutative_v<VT1,VT2> >
654 {
656
657 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
658
659 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
660 multAssign( *lhs, rhs.rhs_ );
661 }
662 else if( !IsComputation_v<VT2> && isSame( *lhs, rhs.rhs_ ) ) {
663 multAssign( *lhs, rhs.lhs_ );
664 }
665 else if( !RequiresEvaluation_v<VT2> ) {
666 assign ( *lhs, rhs.rhs_ );
667 multAssign( *lhs, rhs.lhs_ );
668 }
669 else {
670 assign ( *lhs, rhs.lhs_ );
671 multAssign( *lhs, rhs.rhs_ );
672 }
673 }
675 //**********************************************************************************************
676
677 //**Assignment to sparse vectors****************************************************************
691 template< typename VT > // Type of the target sparse vector
692 friend inline auto assign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
693 -> EnableIf_t< UseAssign_v<VT> >
694 {
696
700
701 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
702
703 const ResultType tmp( serial( rhs ) );
704 assign( *lhs, tmp );
705 }
707 //**********************************************************************************************
708
709 //**Addition assignment to dense vectors********************************************************
723 template< typename VT > // Type of the target dense vector
724 friend inline auto addAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
725 -> EnableIf_t< UseAssign_v<VT> >
726 {
728
732
733 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
734
735 const ResultType tmp( serial( rhs ) );
736 addAssign( *lhs, tmp );
737 }
739 //**********************************************************************************************
740
741 //**Addition assignment to sparse vectors*******************************************************
742 // No special implementation for the addition assignment to sparse vectors.
743 //**********************************************************************************************
744
745 //**Subtraction assignment to dense vectors*****************************************************
759 template< typename VT > // Type of the target dense vector
760 friend inline auto subAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
761 -> EnableIf_t< UseAssign_v<VT> >
762 {
764
768
769 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
770
771 const ResultType tmp( serial( rhs ) );
772 subAssign( *lhs, tmp );
773 }
775 //**********************************************************************************************
776
777 //**Subtraction assignment to sparse vectors****************************************************
778 // No special implementation for the subtraction assignment to sparse vectors.
779 //**********************************************************************************************
780
781 //**Multiplication assignment to dense vectors**************************************************
796 template< typename VT > // Type of the target dense vector
797 friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
798 -> EnableIf_t< UseAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
799 {
801
805
806 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
807
808 const ResultType tmp( serial( rhs ) );
809 multAssign( *lhs, tmp );
810 }
812 //**********************************************************************************************
813
814 //**Multiplication assignment to dense vectors**************************************************
829 template< typename VT > // Type of the target dense vector
830 friend inline auto multAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
831 -> EnableIf_t< UseAssign_v<VT> && IsCommutative_v<VT1,VT2> >
832 {
834
835 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
836
837 if( !RequiresEvaluation_v<VT2> ) {
838 multAssign( *lhs, rhs.rhs_ );
839 multAssign( *lhs, rhs.lhs_ );
840 }
841 else {
842 multAssign( *lhs, rhs.lhs_ );
843 multAssign( *lhs, rhs.rhs_ );
844 }
845 }
847 //**********************************************************************************************
848
849 //**Multiplication assignment to sparse vectors*************************************************
850 // No special implementation for the multiplication assignment to sparse vectors.
851 //**********************************************************************************************
852
853 //**Division assignment to dense vectors********************************************************
867 template< typename VT > // Type of the target dense vector
868 friend inline auto divAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
869 -> EnableIf_t< UseAssign_v<VT> >
870 {
872
876
877 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
878
879 const ResultType tmp( serial( rhs ) );
880 divAssign( *lhs, tmp );
881 }
883 //**********************************************************************************************
884
885 //**Division assignment to sparse vectors*******************************************************
886 // No special implementation for the division assignment to sparse vectors.
887 //**********************************************************************************************
888
889 //**SMP assignment to dense vectors*************************************************************
904 template< typename VT > // Type of the target dense vector
905 friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
906 -> EnableIf_t< UseSMPAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
907 {
909
910 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
911
912 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
913 multAssign( *lhs, rhs.rhs_ );
914 }
915 else {
916 CT1 a( rhs.lhs_ );
917 CT2 b( rhs.rhs_ );
918 smpAssign( *lhs, a * b );
919 }
920 }
922 //**********************************************************************************************
923
924 //**SMP assignment to dense vectors*************************************************************
939 template< typename VT > // Type of the target dense vector
940 friend inline auto smpAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
941 -> EnableIf_t< UseSMPAssign_v<VT> && IsCommutative_v<VT1,VT2> >
942 {
944
945 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
946
947 if( !IsComputation_v<VT1> && isSame( *lhs, rhs.lhs_ ) ) {
948 smpMultAssign( *lhs, rhs.rhs_ );
949 }
950 else if( !IsComputation_v<VT2> && isSame( *lhs, rhs.rhs_ ) ) {
951 smpMultAssign( *lhs, rhs.lhs_ );
952 }
953 else if( !RequiresEvaluation_v<VT2> ) {
954 smpAssign ( *lhs, rhs.rhs_ );
955 smpMultAssign( *lhs, rhs.lhs_ );
956 }
957 else {
958 smpAssign ( *lhs, rhs.lhs_ );
959 smpMultAssign( *lhs, rhs.rhs_ );
960 }
961 }
963 //**********************************************************************************************
964
965 //**SMP assignment to sparse vectors************************************************************
979 template< typename VT > // Type of the target sparse vector
980 friend inline auto smpAssign( SparseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
981 -> EnableIf_t< UseSMPAssign_v<VT> >
982 {
984
988
989 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
990
991 const ResultType tmp( rhs );
992 smpAssign( *lhs, tmp );
993 }
995 //**********************************************************************************************
996
997 //**SMP addition assignment to dense vectors****************************************************
1011 template< typename VT > // Type of the target dense vector
1012 friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1013 -> EnableIf_t< UseSMPAssign_v<VT> >
1014 {
1016
1020
1021 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1022
1023 const ResultType tmp( rhs );
1024 smpAddAssign( *lhs, tmp );
1025 }
1027 //**********************************************************************************************
1028
1029 //**SMP addition assignment to sparse vectors***************************************************
1030 // No special implementation for the SMP addition assignment to sparse vectors.
1031 //**********************************************************************************************
1032
1033 //**SMP subtraction assignment to dense vectors*************************************************
1048 template< typename VT > // Type of the target dense vector
1049 friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1050 -> EnableIf_t< UseSMPAssign_v<VT> >
1051 {
1053
1057
1058 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1059
1060 const ResultType tmp( rhs );
1061 smpSubAssign( *lhs, tmp );
1062 }
1064 //**********************************************************************************************
1065
1066 //**SMP subtraction assignment to sparse vectors************************************************
1067 // No special implementation for the SMP subtraction assignment to sparse vectors.
1068 //**********************************************************************************************
1069
1070 //**SMP multiplication assignment to dense vectors**********************************************
1085 template< typename VT > // Type of the target dense vector
1086 friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1087 -> EnableIf_t< UseSMPAssign_v<VT> && !IsCommutative_v<VT1,VT2> >
1088 {
1090
1094
1095 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1096
1097 const ResultType tmp( rhs );
1098 smpMultAssign( *lhs, tmp );
1099 }
1101 //**********************************************************************************************
1102
1103 //**SMP multiplication assignment to dense vectors**********************************************
1118 template< typename VT > // Type of the target dense vector
1119 friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1120 -> EnableIf_t< UseSMPAssign_v<VT> && IsCommutative_v<VT1,VT2> >
1121 {
1123
1124 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1125
1126 if( !RequiresEvaluation_v<VT2> ) {
1127 smpMultAssign( *lhs, rhs.rhs_ );
1128 smpMultAssign( *lhs, rhs.lhs_ );
1129 }
1130 else {
1131 smpMultAssign( *lhs, rhs.lhs_ );
1132 smpMultAssign( *lhs, rhs.rhs_ );
1133 }
1134 }
1136 //**********************************************************************************************
1137
1138 //**SMP multiplication assignment to sparse vectors*********************************************
1139 // No special implementation for the SMP multiplication assignment to sparse vectors.
1140 //**********************************************************************************************
1141
1142 //**SMP division assignment to dense vectors****************************************************
1156 template< typename VT > // Type of the target dense vector
1157 friend inline auto smpDivAssign( DenseVector<VT,TF>& lhs, const DVecDVecMultExpr& rhs )
1158 -> EnableIf_t< UseSMPAssign_v<VT> >
1159 {
1161
1165
1166 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
1167
1168 const ResultType tmp( rhs );
1169 smpDivAssign( *lhs, tmp );
1170 }
1172 //**********************************************************************************************
1173
1174 //**SMP division assignment to sparse vectors***************************************************
1175 // No special implementation for the SMP division assignment to sparse vectors.
1176 //**********************************************************************************************
1177
1178 //**Compile time checks*************************************************************************
1186 //**********************************************************************************************
1187};
1188//*************************************************************************************************
1189
1190
1191
1192
1193//=================================================================================================
1194//
1195// GLOBAL BINARY ARITHMETIC OPERATORS
1196//
1197//=================================================================================================
1198
1199//*************************************************************************************************
1224template< typename VT1 // Type of the left-hand side dense vector
1225 , typename VT2 // Type of the right-hand side dense vector
1226 , bool TF > // Transpose flag
1227inline decltype(auto)
1228 operator*( const DenseVector<VT1,TF>& lhs, const DenseVector<VT2,TF>& rhs )
1229{
1231
1232 if( (*lhs).size() != (*rhs).size() ) {
1233 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1234 }
1235
1236 using ReturnType = const DVecDVecMultExpr<VT1,VT2,TF>;
1237 return ReturnType( *lhs, *rhs );
1238}
1239//*************************************************************************************************
1240
1241
1242
1243
1244//=================================================================================================
1245//
1246// ISALIGNED SPECIALIZATIONS
1247//
1248//=================================================================================================
1249
1250//*************************************************************************************************
1252template< typename VT1, typename VT2, bool TF >
1253struct IsAligned< DVecDVecMultExpr<VT1,VT2,TF> >
1254 : public BoolConstant< IsAligned_v<VT1> && IsAligned_v<VT2> >
1255{};
1257//*************************************************************************************************
1258
1259
1260
1261
1262//=================================================================================================
1263//
1264// ISPADDED SPECIALIZATIONS
1265//
1266//=================================================================================================
1267
1268//*************************************************************************************************
1270template< typename VT1, typename VT2, bool TF >
1271struct IsPadded< DVecDVecMultExpr<VT1,VT2,TF> >
1272 : public BoolConstant< IsPadded_v<VT1> && IsPadded_v<VT2> >
1273{};
1275//*************************************************************************************************
1276
1277} // namespace blaze
1278
1279#endif
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition: Aliases.h:130
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the HasSIMDMult type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsCommutative type trait.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the IsPadded type trait.
Header file for the IsTemporary type trait class.
Deactivation of problematic macros.
Header file for the multiplication trait.
Header file for all SIMD functionality.
Iterator over the elements of the dense vector.
Definition: DVecDVecMultExpr.h:186
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecMultExpr.h:252
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:361
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecMultExpr.h:190
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DVecDVecMultExpr.h:426
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:328
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DVecDVecMultExpr.h:427
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecMultExpr.h:395
BLAZE_DEVICE_CALLABLE ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DVecDVecMultExpr.h:215
ElementType * PointerType
Pointer return type.
Definition: DVecDVecMultExpr.h:191
PointerType pointer
Pointer return type.
Definition: DVecDVecMultExpr.h:198
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecMultExpr.h:274
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecMultExpr.h:200
BLAZE_DEVICE_CALLABLE ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecMultExpr.h:296
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecMultExpr.h:192
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecMultExpr.h:227
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:317
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecMultExpr.h:193
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecMultExpr.h:286
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecMultExpr.h:407
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecMultExpr.h:240
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecMultExpr.h:196
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecMultExpr.h:189
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecMultExpr.h:383
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:350
ConstIterator_t< VT2 > RightIteratorType
ConstIterator type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:206
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecMultExpr.h:197
ReferenceType reference
Reference return type.
Definition: DVecDVecMultExpr.h:199
ConstIterator_t< VT1 > LeftIteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:203
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:372
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecMultExpr.h:264
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecMultExpr.h:339
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMultExpr.h:306
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecMultExpr.h:419
Expression object for dense vector-dense vector multiplications.
Definition: DVecDVecMultExpr.h:99
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecMultExpr.h:167
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecMultExpr.h:570
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:106
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:107
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:109
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecMultExpr.h:525
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecMultExpr.h:493
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecMultExpr.h:466
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecMultExpr.h:557
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:176
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecMultExpr.h:535
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:179
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecMultExpr.h:505
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:108
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the multiplication expression.
Definition: DVecDVecMultExpr.h:133
LeftOperand lhs_
Left-hand side dense vector of the multiplication expression.
Definition: DVecDVecMultExpr.h:598
DVecDVecMultExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecMultExpr class.
Definition: DVecDVecMultExpr.h:452
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecDVecMultExpr.h:443
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:104
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecDVecMultExpr.h:580
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecMultExpr.h:166
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecMultExpr.h:434
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:102
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecDVecMultExpr.h:590
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecMultExpr.h:119
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecMultExpr.h:122
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecMultExpr.h:515
MultTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecMultExpr.h:165
RightOperand rhs_
Right-hand side dense vector of the multiplication expression.
Definition: DVecDVecMultExpr.h:599
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecMultExpr.h:438
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecMultExpr.h:545
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:103
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecMultExpr.h:170
If_t< useAssign, const ResultType, const DVecDVecMultExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecDVecMultExpr.h:173
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecMultExpr.h:105
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecMultExpr.h:479
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseVector base class.
Header file for the VecVecMultExpr base class.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition: TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECMULTEXPR(T1, T2)
Constraint on the data type.
Definition: VecVecMultExpr.h:104
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
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:1424
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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:221
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
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
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:192
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
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all vector/vector multiplication expression templates.
Definition: VecVecMultExpr.h:68
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.