Blaze 3.9
DVecScalarMultExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_DVECSCALARMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DVECSCALARMULTEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
45#include <blaze/math/Aliases.h>
61#include <blaze/math/SIMD.h>
74#include <blaze/system/Inline.h>
77#include <blaze/util/Assert.h>
79#include <blaze/util/EnableIf.h>
81#include <blaze/util/mpl/If.h>
82#include <blaze/util/Types.h>
84
85
86namespace blaze {
87
88//=================================================================================================
89//
90// CLASS DVECSCALARMULTEXPR
91//
92//=================================================================================================
93
94//*************************************************************************************************
101template< typename VT // Type of the left-hand side dense vector
102 , typename ST // Type of the right-hand side scalar value
103 , bool TF > // Transpose flag
105 : public VecScalarMultExpr< DenseVector< DVecScalarMultExpr<VT,ST,TF>, TF > >
106 , private Computation
107{
108 private:
109 //**Type definitions****************************************************************************
114 //**********************************************************************************************
115
116 //**Return type evaluation**********************************************************************
118
123 static constexpr bool returnExpr = !IsTemporary_v<RN>;
124
126 using ExprReturnType = decltype( std::declval<RN>() * std::declval<ST>() );
127 //**********************************************************************************************
128
129 //**Serial evaluation strategy******************************************************************
131
137 static constexpr bool useAssign = ( IsComputation_v<VT> && RequiresEvaluation_v<VT> );
138
141 template< typename VT2 >
142 static constexpr bool UseAssign_v = useAssign;
144 //**********************************************************************************************
145
146 //**Parallel evaluation strategy****************************************************************
148
154 template< typename VT2 >
155 static constexpr bool UseSMPAssign_v =
156 ( ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign );
158 //**********************************************************************************************
159
160 public:
161 //**Type definitions****************************************************************************
164
167
171
174
177
179 using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
180
182 using RightOperand = ST;
183 //**********************************************************************************************
184
185 //**ConstIterator class definition**************************************************************
189 {
190 public:
191 //**Type definitions*************************************************************************
192 using IteratorCategory = std::random_access_iterator_tag;
196 using DifferenceType = ptrdiff_t;
197
198 // STL iterator requirements
204
207 //*******************************************************************************************
208
209 //**Constructor******************************************************************************
216 : iterator_( iterator ) // Iterator to the current element
217 , scalar_ ( scalar ) // Scalar of the multiplication expression
218 {}
219 //*******************************************************************************************
220
221 //**Addition assignment operator*************************************************************
228 iterator_ += inc;
229 return *this;
230 }
231 //*******************************************************************************************
232
233 //**Subtraction assignment operator**********************************************************
240 iterator_ -= dec;
241 return *this;
242 }
243 //*******************************************************************************************
244
245 //**Prefix increment operator****************************************************************
251 ++iterator_;
252 return *this;
253 }
254 //*******************************************************************************************
255
256 //**Postfix increment operator***************************************************************
262 return ConstIterator( iterator_++, scalar_ );
263 }
264 //*******************************************************************************************
265
266 //**Prefix decrement operator****************************************************************
272 --iterator_;
273 return *this;
274 }
275 //*******************************************************************************************
276
277 //**Postfix decrement operator***************************************************************
283 return ConstIterator( iterator_--, scalar_ );
284 }
285 //*******************************************************************************************
286
287 //**Element access operator******************************************************************
293 return *iterator_ * scalar_;
294 }
295 //*******************************************************************************************
296
297 //**Load function****************************************************************************
302 inline auto load() const noexcept {
303 return iterator_.load() * set( scalar_ );
304 }
305 //*******************************************************************************************
306
307 //**Equality operator************************************************************************
313 inline BLAZE_DEVICE_CALLABLE bool operator==( const ConstIterator& rhs ) const {
314 return iterator_ == rhs.iterator_;
315 }
316 //*******************************************************************************************
317
318 //**Inequality operator**********************************************************************
324 inline BLAZE_DEVICE_CALLABLE bool operator!=( const ConstIterator& rhs ) const {
325 return iterator_ != rhs.iterator_;
326 }
327 //*******************************************************************************************
328
329 //**Less-than operator***********************************************************************
335 inline BLAZE_DEVICE_CALLABLE bool operator<( const ConstIterator& rhs ) const {
336 return iterator_ < rhs.iterator_;
337 }
338 //*******************************************************************************************
339
340 //**Greater-than operator********************************************************************
346 inline BLAZE_DEVICE_CALLABLE bool operator>( const ConstIterator& rhs ) const {
347 return iterator_ > rhs.iterator_;
348 }
349 //*******************************************************************************************
350
351 //**Less-or-equal-than operator**************************************************************
357 inline BLAZE_DEVICE_CALLABLE bool operator<=( const ConstIterator& rhs ) const {
358 return iterator_ <= rhs.iterator_;
359 }
360 //*******************************************************************************************
361
362 //**Greater-or-equal-than operator***********************************************************
368 inline BLAZE_DEVICE_CALLABLE bool operator>=( const ConstIterator& rhs ) const {
369 return iterator_ >= rhs.iterator_;
370 }
371 //*******************************************************************************************
372
373 //**Subtraction operator*********************************************************************
380 return iterator_ - rhs.iterator_;
381 }
382 //*******************************************************************************************
383
384 //**Addition operator************************************************************************
391 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
392 return ConstIterator( it.iterator_ + inc, it.scalar_ );
393 }
394 //*******************************************************************************************
395
396 //**Addition operator************************************************************************
403 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
404 return ConstIterator( it.iterator_ + inc, it.scalar_ );
405 }
406 //*******************************************************************************************
407
408 //**Subtraction operator*********************************************************************
415 friend inline BLAZE_DEVICE_CALLABLE const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
416 return ConstIterator( it.iterator_ - dec, it.scalar_ );
417 }
418 //*******************************************************************************************
419
420 private:
421 //**Member variables*************************************************************************
424 //*******************************************************************************************
425 };
426 //**********************************************************************************************
427
428 //**Compilation flags***************************************************************************
430 static constexpr bool simdEnabled =
431 ( VT::simdEnabled && IsNumeric_v<ET> &&
432 ( HasSIMDMult_v<ET,ST> || HasSIMDMult_v<UnderlyingElement_t<ET>,ST> ) );
433
435 static constexpr bool smpAssignable = VT::smpAssignable;
436 //**********************************************************************************************
437
438 //**SIMD properties*****************************************************************************
440 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
441 //**********************************************************************************************
442
443 //**Constructor*********************************************************************************
449 inline DVecScalarMultExpr( const VT& vector, ST scalar ) noexcept
450 : vector_( vector ) // Left-hand side dense vector of the multiplication expression
451 , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
452 {}
453 //**********************************************************************************************
454
455 //**Subscript operator**************************************************************************
461 inline ReturnType operator[]( size_t index ) const {
462 BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
463 return vector_[index] * scalar_;
464 }
465 //**********************************************************************************************
466
467 //**At function*********************************************************************************
474 inline ReturnType at( size_t index ) const {
475 if( index >= vector_.size() ) {
476 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
477 }
478 return (*this)[index];
479 }
480 //**********************************************************************************************
481
482 //**Load function*******************************************************************************
488 BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
489 BLAZE_INTERNAL_ASSERT( index < vector_.size() , "Invalid vector access index" );
490 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
491 return vector_.load( index ) * set( scalar_ );
492 }
493 //**********************************************************************************************
494
495 //**Begin function******************************************************************************
500 inline ConstIterator begin() const {
501 return ConstIterator( vector_.begin(), scalar_ );
502 }
503 //**********************************************************************************************
504
505 //**End function********************************************************************************
510 inline ConstIterator end() const {
511 return ConstIterator( vector_.end(), scalar_ );
512 }
513 //**********************************************************************************************
514
515 //**Size function*******************************************************************************
520 inline size_t size() const noexcept {
521 return vector_.size();
522 }
523 //**********************************************************************************************
524
525 //**Left operand access*************************************************************************
530 inline LeftOperand leftOperand() const noexcept {
531 return vector_;
532 }
533 //**********************************************************************************************
534
535 //**Right operand access************************************************************************
540 inline RightOperand rightOperand() const noexcept {
541 return scalar_;
542 }
543 //**********************************************************************************************
544
545 //**********************************************************************************************
551 template< typename T >
552 inline bool canAlias( const T* alias ) const noexcept {
553 return IsExpression_v<VT> && vector_.canAlias( alias );
554 }
555 //**********************************************************************************************
556
557 //**********************************************************************************************
563 template< typename T >
564 inline bool isAliased( const T* alias ) const noexcept {
565 return vector_.isAliased( alias );
566 }
567 //**********************************************************************************************
568
569 //**********************************************************************************************
574 inline bool isAligned() const noexcept {
575 return vector_.isAligned();
576 }
577 //**********************************************************************************************
578
579 //**********************************************************************************************
584 inline bool canSMPAssign() const noexcept {
585 return vector_.canSMPAssign() || ( size() > SMP_DVECSCALARMULT_THRESHOLD );
586 }
587 //**********************************************************************************************
588
589 private:
590 //**Member variables****************************************************************************
593 //**********************************************************************************************
594
595 //**Assignment to dense vectors*****************************************************************
609 template< typename VT2 > // Type of the target dense vector
610 friend inline auto assign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
612 {
614
615 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
616
617 assign( *lhs, rhs.vector_ );
618 assign( *lhs, (*lhs) * rhs.scalar_ );
619 }
621 //**********************************************************************************************
622
623 //**Assignment to sparse vectors****************************************************************
637 template< typename VT2 > // Type of the target sparse vector
638 friend inline auto assign( SparseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
640 {
642
643 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
644
645 assign( *lhs, rhs.vector_ );
646 (*lhs) *= rhs.scalar_;
647 }
649 //**********************************************************************************************
650
651 //**Addition assignment to dense vectors********************************************************
665 template< typename VT2 > // Type of the target dense vector
666 friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
667 -> EnableIf_t< UseAssign_v<VT2> >
668 {
670
674
675 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
676
677 const ResultType tmp( serial( rhs ) );
678 addAssign( *lhs, tmp );
679 }
681 //**********************************************************************************************
682
683 //**Addition assignment to sparse vectors*******************************************************
684 // No special implementation for the addition assignment to sparse vectors.
685 //**********************************************************************************************
686
687 //**Subtraction assignment to dense vectors*****************************************************
701 template< typename VT2 > // Type of the target dense vector
702 friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
703 -> EnableIf_t< UseAssign_v<VT2> >
704 {
706
710
711 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
712
713 const ResultType tmp( serial( rhs ) );
714 subAssign( *lhs, tmp );
715 }
717 //**********************************************************************************************
718
719 //**Subtraction assignment to sparse vectors****************************************************
720 // No special implementation for the subtraction assignment to sparse vectors.
721 //**********************************************************************************************
722
723 //**Multiplication assignment to dense vectors**************************************************
737 template< typename VT2 > // Type of the target dense vector
738 friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
739 -> EnableIf_t< UseAssign_v<VT2> >
740 {
742
746
747 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
748
749 const ResultType tmp( serial( rhs ) );
750 multAssign( *lhs, tmp );
751 }
753 //**********************************************************************************************
754
755 //**Multiplication assignment to sparse vectors*************************************************
756 // No special implementation for the multiplication assignment to sparse vectors.
757 //**********************************************************************************************
758
759 //**Division assignment to dense vectors********************************************************
773 template< typename VT2 > // Type of the target dense vector
774 friend inline auto divAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
775 -> EnableIf_t< UseAssign_v<VT2> >
776 {
778
782
783 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
784
785 const ResultType tmp( serial( rhs ) );
786 divAssign( *lhs, tmp );
787 }
789 //**********************************************************************************************
790
791 //**Division assignment to sparse vectors*******************************************************
792 // No special implementation for the division assignment to sparse vectors.
793 //**********************************************************************************************
794
795 //**SMP assignment to dense vectors*************************************************************
809 template< typename VT2 > // Type of the target dense vector
810 friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
811 -> EnableIf_t< UseSMPAssign_v<VT2> >
812 {
814
815 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
816
817 smpAssign( *lhs, rhs.vector_ );
818 smpAssign( *lhs, (*lhs) * rhs.scalar_ );
819 }
821 //**********************************************************************************************
822
823 //**SMP assignment to sparse vectors************************************************************
837 template< typename VT2 > // Type of the target sparse vector
838 friend inline auto smpAssign( SparseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
839 -> EnableIf_t< UseSMPAssign_v<VT2> >
840 {
842
843 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
844
845 smpAssign( *lhs, rhs.vector_ );
846 (*lhs) *= rhs.scalar_;
847 }
849 //**********************************************************************************************
850
851 //**SMP addition assignment to dense vectors****************************************************
865 template< typename VT2 > // Type of the target dense vector
866 friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
867 -> EnableIf_t< UseSMPAssign_v<VT2> >
868 {
870
874
875 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
876
877 const ResultType tmp( rhs );
878 smpAddAssign( *lhs, tmp );
879 }
881 //**********************************************************************************************
882
883 //**SMP addition assignment to sparse vectors***************************************************
884 // No special implementation for the SMP addition assignment to sparse vectors.
885 //**********************************************************************************************
886
887 //**SMP subtraction assignment to dense vectors*************************************************
901 template< typename VT2 > // Type of the target dense vector
902 friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
903 -> EnableIf_t< UseSMPAssign_v<VT2> >
904 {
906
910
911 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
912
913 const ResultType tmp( rhs );
914 smpSubAssign( *lhs, tmp );
915 }
917 //**********************************************************************************************
918
919 //**SMP subtraction assignment to sparse vectors************************************************
920 // No special implementation for the SMP subtraction assignment to sparse vectors.
921 //**********************************************************************************************
922
923 //**SMP multiplication assignment to dense vectors**********************************************
937 template< typename VT2 > // Type of the target dense vector
938 friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
939 -> EnableIf_t< UseSMPAssign_v<VT2> >
940 {
942
946
947 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
948
949 const ResultType tmp( rhs );
950 smpMultAssign( *lhs, tmp );
951 }
953 //**********************************************************************************************
954
955 //**SMP multiplication assignment to sparse vectors*********************************************
956 // No special implementation for the SMP multiplication assignment to sparse vectors.
957 //**********************************************************************************************
958
959 //**SMP division assignment to dense vectors****************************************************
973 template< typename VT2 > // Type of the target dense vector
974 friend inline auto smpDivAssign( DenseVector<VT2,TF>& lhs, const DVecScalarMultExpr& rhs )
975 -> EnableIf_t< UseSMPAssign_v<VT2> >
976 {
978
982
983 BLAZE_INTERNAL_ASSERT( (*lhs).size() == rhs.size(), "Invalid vector sizes" );
984
985 const ResultType tmp( rhs );
986 smpDivAssign( *lhs, tmp );
987 }
989 //**********************************************************************************************
990
991 //**SMP division assignment to sparse vectors***************************************************
992 // No special implementation for the SMP division assignment to sparse vectors.
993 //**********************************************************************************************
994
995 //**Compile time checks*************************************************************************
1002 //**********************************************************************************************
1003};
1004//*************************************************************************************************
1005
1006
1007
1008
1009//=================================================================================================
1010//
1011// GLOBAL UNARY ARITHMETIC OPERATORS
1012//
1013//=================================================================================================
1014
1015//*************************************************************************************************
1032template< typename VT // Type of the dense vector
1033 , bool TF > // Transpose flag
1034inline decltype(auto) operator-( const DenseVector<VT,TF>& dv )
1035{
1037
1038 using ScalarType = UnderlyingBuiltin_t<VT>;
1039 using ReturnType = const DVecScalarMultExpr<VT,ScalarType,TF>;
1040 return ReturnType( *dv, ScalarType(-1) );
1041}
1042//*************************************************************************************************
1043
1044
1045
1046
1047//=================================================================================================
1048//
1049// GLOBAL BINARY ARITHMETIC OPERATORS
1050//
1051//=================================================================================================
1052
1053//*************************************************************************************************
1075template< typename VT // Type of the left-hand side dense vector
1076 , typename ST // Type of the right-hand side scalar
1077 , bool TF // Transpose flag
1078 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1079inline decltype(auto) operator*( const DenseVector<VT,TF>& vec, ST scalar )
1080{
1082
1083 using ScalarType = MultTrait_t< UnderlyingBuiltin_t<VT>, ST >;
1084 using ReturnType = const DVecScalarMultExpr<VT,ScalarType,TF>;
1085 return ReturnType( *vec, scalar );
1086}
1087//*************************************************************************************************
1088
1089
1090//*************************************************************************************************
1112template< typename ST // Type of the left-hand side scalar
1113 , typename VT // Type of the right-hand side dense vector
1114 , bool TF // Transpose flag
1115 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1116inline decltype(auto) operator*( ST scalar, const DenseVector<VT,TF>& vec )
1117{
1119
1120 using ScalarType = MultTrait_t< ST, UnderlyingBuiltin_t<VT> >;
1121 using ReturnType = const DVecScalarMultExpr<VT,ScalarType,TF>;
1122 return ReturnType( *vec, scalar );
1123}
1124//*************************************************************************************************
1125
1126
1127
1128
1129//=================================================================================================
1130//
1131// GLOBAL FUNCTIONS
1132//
1133//=================================================================================================
1134
1135//*************************************************************************************************
1153template< typename VT // Type of the dense vector
1154 , bool TF > // Transpose flag
1155inline decltype(auto) normalize( const DenseVector<VT,TF>& vec )
1156{
1158
1159 const auto len ( l2Norm( *vec ) );
1160 auto ilen( !isZero(len) ? inv(len) : len );
1161
1162 using ReturnType = const DVecScalarMultExpr<VT,decltype(ilen),TF>;
1163 return ReturnType( *vec, ilen );
1164}
1165//*************************************************************************************************
1166
1167
1168
1169
1170//=================================================================================================
1171//
1172// ISALIGNED SPECIALIZATIONS
1173//
1174//=================================================================================================
1175
1176//*************************************************************************************************
1178template< typename VT, typename ST, bool TF >
1179struct IsAligned< DVecScalarMultExpr<VT,ST,TF> >
1180 : public IsAligned<VT>
1181{};
1183//*************************************************************************************************
1184
1185
1186
1187
1188//=================================================================================================
1189//
1190// ISPADDED SPECIALIZATIONS
1191//
1192//=================================================================================================
1193
1194//*************************************************************************************************
1196template< typename VT, typename ST, bool TF >
1197struct IsPadded< DVecScalarMultExpr<VT,ST,TF> >
1198 : public IsPadded<VT>
1199{};
1201//*************************************************************************************************
1202
1203} // namespace blaze
1204
1205#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.
decltype(auto) normalize(const DenseVector< VT, TF > &vec)
Normalization of the dense vector ( ).
Definition: DVecScalarMultExpr.h:1155
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 invert shim.
Header file for the IsAligned type trait.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the IsNumeric type trait.
Header file for the IsPadded type trait.
Header file for the IsScalar 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.
Data type constraint.
Constraint on the data type.
Header file for the UnderlyingBuiltin type trait.
Header file for the UnderlyingElement type trait.
Iterator over the elements of the dense vector.
Definition: DVecScalarMultExpr.h:189
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarMultExpr.h:193
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarMultExpr.h:199
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecScalarMultExpr.h:271
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarMultExpr.h:422
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecScalarMultExpr.h:379
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecScalarMultExpr.h:196
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarMultExpr.h:391
BLAZE_DEVICE_CALLABLE ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecScalarMultExpr.h:292
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarMultExpr.h:357
DifferenceType difference_type
Difference between two iterators.
Definition: DVecScalarMultExpr.h:203
ElementType * PointerType
Pointer return type.
Definition: DVecScalarMultExpr.h:194
ConstIterator_t< VT > IteratorType
ConstIterator type of the dense vector expression.
Definition: DVecScalarMultExpr.h:206
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarMultExpr.h:192
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecScalarMultExpr.h:250
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarMultExpr.h:313
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarMultExpr.h:302
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecScalarMultExpr.h:324
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarMultExpr.h:282
RightOperand scalar_
Scalar of the multiplication expression.
Definition: DVecScalarMultExpr.h:423
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarMultExpr.h:368
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarMultExpr.h:261
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarMultExpr.h:195
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarMultExpr.h:403
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarMultExpr.h:346
PointerType pointer
Pointer return type.
Definition: DVecScalarMultExpr.h:201
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarMultExpr.h:335
ValueType value_type
Type of the underlying elements.
Definition: DVecScalarMultExpr.h:200
ReferenceType reference
Reference return type.
Definition: DVecScalarMultExpr.h:202
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarMultExpr.h:227
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarMultExpr.h:415
BLAZE_DEVICE_CALLABLE ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarMultExpr.h:215
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecScalarMultExpr.h:239
Expression object for dense vector-scalar multiplications.
Definition: DVecScalarMultExpr.h:107
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarMultExpr.h:500
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecScalarMultExpr.h:530
LeftOperand vector_
Left-hand side dense vector of the multiplication expression.
Definition: DVecScalarMultExpr.h:591
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecScalarMultExpr.h:430
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecScalarMultExpr.h:461
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecScalarMultExpr.h:520
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DVecScalarMultExpr.h:540
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarMultExpr.h:584
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecScalarMultExpr.h:510
ReturnType_t< VT > RN
Return type of the dense vector expression.
Definition: DVecScalarMultExpr.h:111
CompositeType_t< VT > CT
Composite type of the dense vector expression.
Definition: DVecScalarMultExpr.h:113
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecScalarMultExpr.h:169
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecScalarMultExpr.h:440
ResultType_t< VT > RT
Result type of the dense vector expression.
Definition: DVecScalarMultExpr.h:110
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecScalarMultExpr.h:474
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecScalarMultExpr.h:123
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecScalarMultExpr.h:552
If_t< useAssign, const ResultType, const DVecScalarMultExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecScalarMultExpr.h:176
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarMultExpr.h:488
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecScalarMultExpr.h:179
ElementType_t< VT > ET
Element type of the dense vector expression.
Definition: DVecScalarMultExpr.h:112
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecScalarMultExpr.h:170
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecScalarMultExpr.h:435
DVecScalarMultExpr(const VT &vector, ST scalar) noexcept
Constructor for the DVecScalarMultExpr class.
Definition: DVecScalarMultExpr.h:449
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DVecScalarMultExpr.h:182
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecScalarMultExpr.h:574
MultTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DVecScalarMultExpr.h:168
decltype(std::declval< RN >() *std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarMultExpr.h:126
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecScalarMultExpr.h:564
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: DVecScalarMultExpr.h:592
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecScalarMultExpr.h:173
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the multiplication expression.
Definition: DVecScalarMultExpr.h:137
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse vectors.
Definition: SparseVector.h:72
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseMatrix base class.
Header file for the DenseVector base class.
Header file for the SparseMatrix base class.
Header file for the SparseVector base class.
Header file for the VecScalarMultExpr base class.
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.
Definition: SameType.h:71
decltype(auto) l2Norm(const DenseMatrix< MT, SO > &dm)
Computes the L2 norm for the given dense matrix.
Definition: DMatNormExpr.h:651
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) inv(const DenseMatrix< MT, SO > &dm)
Calculation of the inverse of the given dense matrix.
Definition: DMatInvExpr.h:405
bool isZero(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a zero matrix.
Definition: DenseMatrix.h:1819
#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_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
typename UnderlyingBuiltin< T >::Type UnderlyingBuiltin_t
Auxiliary alias declaration for the UnderlyingBuiltin type trait.
Definition: UnderlyingBuiltin.h:117
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
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
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#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 isZero shim.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all vector/scalar multiplication expression templates.
Definition: VecScalarMultExpr.h:76
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.