Blaze  3.6
DVecScalarDivExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECSCALARDIVEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECSCALARDIVEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
49 #include <blaze/math/Exception.h>
55 #include <blaze/math/SIMD.h>
71 #include <blaze/system/Inline.h>
73 #include <blaze/util/Assert.h>
77 #include <blaze/util/EnableIf.h>
79 #include <blaze/util/mpl/If.h>
80 #include <blaze/util/Types.h>
85 
86 
87 namespace blaze {
88 
89 //=================================================================================================
90 //
91 // CLASS DVECSCALARDIVEXPR
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
102 template< typename VT // Type of the left-hand side dense vector
103  , typename ST // Type of the right-hand side scalar value
104  , bool TF > // Transpose flag
106  : public VecScalarDivExpr< DenseVector< DVecScalarDivExpr<VT,ST,TF>, TF > >
107  , private Computation
108 {
109  private:
110  //**Type definitions****************************************************************************
115  //**********************************************************************************************
116 
117  //**Return type evaluation**********************************************************************
119 
124  static constexpr bool returnExpr = !IsTemporary_v<RN>;
125 
127  using ExprReturnType = decltype( std::declval<RN>() / std::declval<ST>() );
128  //**********************************************************************************************
129 
130  //**Serial evaluation strategy******************************************************************
132 
138  static constexpr bool useAssign = IsComputation_v<VT> && RequiresEvaluation_v<VT>;
139 
141  template< typename VT2 >
143  static constexpr bool UseAssign_v = useAssign;
145  //**********************************************************************************************
146 
147  //**Parallel evaluation strategy****************************************************************
149 
155  template< typename VT2 >
156  static constexpr bool UseSMPAssign_v =
157  ( ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign );
159  //**********************************************************************************************
160 
161  public:
162  //**Type definitions****************************************************************************
168 
171 
174 
176  using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
177 
179  using RightOperand = ST;
180  //**********************************************************************************************
181 
182  //**ConstIterator class definition**************************************************************
186  {
187  public:
188  //**Type definitions*************************************************************************
189  using IteratorCategory = std::random_access_iterator_tag;
194 
195  // STL iterator requirements
201 
204  //*******************************************************************************************
205 
206  //**Constructor******************************************************************************
212  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
213  : iterator_( iterator ) // Iterator to the current element
214  , scalar_ ( scalar ) // Scalar of the division expression
215  {}
216  //*******************************************************************************************
217 
218  //**Addition assignment operator*************************************************************
225  iterator_ += inc;
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Subtraction assignment operator**********************************************************
237  iterator_ -= dec;
238  return *this;
239  }
240  //*******************************************************************************************
241 
242  //**Prefix increment operator****************************************************************
248  ++iterator_;
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Postfix increment operator***************************************************************
259  return ConstIterator( iterator_++, scalar_ );
260  }
261  //*******************************************************************************************
262 
263  //**Prefix decrement operator****************************************************************
269  --iterator_;
270  return *this;
271  }
272  //*******************************************************************************************
273 
274  //**Postfix decrement operator***************************************************************
280  return ConstIterator( iterator_--, scalar_ );
281  }
282  //*******************************************************************************************
283 
284  //**Element access operator******************************************************************
289  inline ReturnType operator*() const {
290  return *iterator_ / scalar_;
291  }
292  //*******************************************************************************************
293 
294  //**Load function****************************************************************************
299  inline auto load() const noexcept {
300  return iterator_.load() / set( scalar_ );
301  }
302  //*******************************************************************************************
303 
304  //**Equality operator************************************************************************
310  inline bool operator==( const ConstIterator& rhs ) const {
311  return iterator_ == rhs.iterator_;
312  }
313  //*******************************************************************************************
314 
315  //**Inequality operator**********************************************************************
321  inline bool operator!=( const ConstIterator& rhs ) const {
322  return iterator_ != rhs.iterator_;
323  }
324  //*******************************************************************************************
325 
326  //**Less-than operator***********************************************************************
332  inline bool operator<( const ConstIterator& rhs ) const {
333  return iterator_ < rhs.iterator_;
334  }
335  //*******************************************************************************************
336 
337  //**Greater-than operator********************************************************************
343  inline bool operator>( const ConstIterator& rhs ) const {
344  return iterator_ > rhs.iterator_;
345  }
346  //*******************************************************************************************
347 
348  //**Less-or-equal-than operator**************************************************************
354  inline bool operator<=( const ConstIterator& rhs ) const {
355  return iterator_ <= rhs.iterator_;
356  }
357  //*******************************************************************************************
358 
359  //**Greater-or-equal-than operator***********************************************************
365  inline bool operator>=( const ConstIterator& rhs ) const {
366  return iterator_ >= rhs.iterator_;
367  }
368  //*******************************************************************************************
369 
370  //**Subtraction operator*********************************************************************
376  inline DifferenceType operator-( const ConstIterator& rhs ) const {
377  return iterator_ - rhs.iterator_;
378  }
379  //*******************************************************************************************
380 
381  //**Addition operator************************************************************************
388  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
389  return ConstIterator( it.iterator_ + inc, it.scalar_ );
390  }
391  //*******************************************************************************************
392 
393  //**Addition operator************************************************************************
400  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
401  return ConstIterator( it.iterator_ + inc, it.scalar_ );
402  }
403  //*******************************************************************************************
404 
405  //**Subtraction operator*********************************************************************
412  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
413  return ConstIterator( it.iterator_ - dec, it.scalar_ );
414  }
415  //*******************************************************************************************
416 
417  private:
418  //**Member variables*************************************************************************
421  //*******************************************************************************************
422  };
423  //**********************************************************************************************
424 
425  //**Compilation flags***************************************************************************
427  static constexpr bool simdEnabled =
428  ( VT::simdEnabled && IsNumeric_v<ET> &&
429  ( HasSIMDDiv_v<ET,ST> || HasSIMDDiv_v<UnderlyingElement_t<ET>,ST> ) );
430 
432  static constexpr bool smpAssignable = VT::smpAssignable;
433  //**********************************************************************************************
434 
435  //**SIMD properties*****************************************************************************
437  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
438  //**********************************************************************************************
439 
440  //**Constructor*********************************************************************************
446  explicit inline DVecScalarDivExpr( const VT& vector, ST scalar ) noexcept
447  : vector_( vector ) // Left-hand side dense vector of the division expression
448  , scalar_( scalar ) // Right-hand side scalar of the division expression
449  {}
450  //**********************************************************************************************
451 
452  //**Subscript operator**************************************************************************
458  inline ReturnType operator[]( size_t index ) const {
459  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
460  return vector_[index] / scalar_;
461  }
462  //**********************************************************************************************
463 
464  //**At function*********************************************************************************
471  inline ReturnType at( size_t index ) const {
472  if( index >= vector_.size() ) {
473  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
474  }
475  return (*this)[index];
476  }
477  //**********************************************************************************************
478 
479  //**Load function*******************************************************************************
485  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
486  BLAZE_INTERNAL_ASSERT( index < vector_.size() , "Invalid vector access index" );
487  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
488  return vector_.load( index ) / set( scalar_ );
489  }
490  //**********************************************************************************************
491 
492  //**Begin function******************************************************************************
497  inline ConstIterator begin() const {
498  return ConstIterator( vector_.begin(), scalar_ );
499  }
500  //**********************************************************************************************
501 
502  //**End function********************************************************************************
507  inline ConstIterator end() const {
508  return ConstIterator( vector_.end(), scalar_ );
509  }
510  //**********************************************************************************************
511 
512  //**Size function*******************************************************************************
517  inline size_t size() const noexcept {
518  return vector_.size();
519  }
520  //**********************************************************************************************
521 
522  //**Left operand access*************************************************************************
527  inline LeftOperand leftOperand() const noexcept {
528  return vector_;
529  }
530  //**********************************************************************************************
531 
532  //**Right operand access************************************************************************
537  inline RightOperand rightOperand() const noexcept {
538  return scalar_;
539  }
540  //**********************************************************************************************
541 
542  //**********************************************************************************************
548  template< typename T >
549  inline bool canAlias( const T* alias ) const noexcept {
550  return IsExpression_v<VT> && vector_.canAlias( alias );
551  }
552  //**********************************************************************************************
553 
554  //**********************************************************************************************
560  template< typename T >
561  inline bool isAliased( const T* alias ) const noexcept {
562  return vector_.isAliased( alias );
563  }
564  //**********************************************************************************************
565 
566  //**********************************************************************************************
571  inline bool isAligned() const noexcept {
572  return vector_.isAligned();
573  }
574  //**********************************************************************************************
575 
576  //**********************************************************************************************
581  inline bool canSMPAssign() const noexcept {
582  return vector_.canSMPAssign() || ( size() > SMP_DVECSCALARMULT_THRESHOLD );
583  }
584  //**********************************************************************************************
585 
586  private:
587  //**Member variables****************************************************************************
590  //**********************************************************************************************
591 
592  //**Assignment to dense vectors*****************************************************************
606  template< typename VT2 > // Type of the target dense vector
607  friend inline auto assign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
609  {
611 
612  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
613 
614  assign( ~lhs, rhs.vector_ );
615  assign( ~lhs, (~lhs) / rhs.scalar_ );
616  }
618  //**********************************************************************************************
619 
620  //**Assignment to sparse vectors****************************************************************
634  template< typename VT2 > // Type of the target sparse vector
635  friend inline auto assign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
637  {
639 
640  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
641 
642  assign( ~lhs, rhs.vector_ );
643  (~lhs) /= rhs.scalar_;
644  }
646  //**********************************************************************************************
647 
648  //**Addition assignment to dense vectors********************************************************
662  template< typename VT2 > // Type of the target dense vector
663  friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
664  -> EnableIf_t< UseAssign_v<VT2> >
665  {
667 
671 
672  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
673 
674  const ResultType tmp( serial( rhs ) );
675  addAssign( ~lhs, tmp );
676  }
678  //**********************************************************************************************
679 
680  //**Addition assignment to sparse vectors*******************************************************
681  // No special implementation for the addition assignment to sparse vectors.
682  //**********************************************************************************************
683 
684  //**Subtraction assignment to dense vectors*****************************************************
698  template< typename VT2 > // Type of the target dense vector
699  friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
700  -> EnableIf_t< UseAssign_v<VT2> >
701  {
703 
707 
708  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
709 
710  const ResultType tmp( serial( rhs ) );
711  subAssign( ~lhs, tmp );
712  }
714  //**********************************************************************************************
715 
716  //**Subtraction assignment to sparse vectors****************************************************
717  // No special implementation for the subtraction assignment to sparse vectors.
718  //**********************************************************************************************
719 
720  //**Multiplication assignment to dense vectors**************************************************
734  template< typename VT2 > // Type of the target dense vector
735  friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
736  -> EnableIf_t< UseAssign_v<VT2> >
737  {
739 
743 
744  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
745 
746  const ResultType tmp( serial( rhs ) );
747  multAssign( ~lhs, tmp );
748  }
750  //**********************************************************************************************
751 
752  //**Multiplication assignment to sparse vectors*************************************************
753  // No special implementation for the multiplication assignment to sparse vectors.
754  //**********************************************************************************************
755 
756  //**Division assignment to dense vectors********************************************************
770  template< typename VT2 > // Type of the target dense vector
771  friend inline auto divAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
772  -> EnableIf_t< UseAssign_v<VT2> >
773  {
775 
779 
780  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
781 
782  const ResultType tmp( serial( rhs ) );
783  divAssign( ~lhs, tmp );
784  }
786  //**********************************************************************************************
787 
788  //**Division assignment to sparse vectors*******************************************************
789  // No special implementation for the division assignment to sparse vectors.
790  //**********************************************************************************************
791 
792  //**SMP assignment to dense vectors*************************************************************
806  template< typename VT2 > // Type of the target dense vector
807  friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
808  -> EnableIf_t< UseSMPAssign_v<VT2> >
809  {
811 
812  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
813 
814  smpAssign( ~lhs, rhs.vector_ );
815  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
816  }
818  //**********************************************************************************************
819 
820  //**SMP assignment to sparse vectors************************************************************
834  template< typename VT2 > // Type of the target sparse vector
835  friend inline auto smpAssign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
836  -> EnableIf_t< UseSMPAssign_v<VT2> >
837  {
839 
840  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
841 
842  smpAssign( ~lhs, rhs.vector_ );
843  (~lhs) /= rhs.scalar_;
844  }
846  //**********************************************************************************************
847 
848  //**SMP addition assignment to dense vectors****************************************************
862  template< typename VT2 > // Type of the target dense vector
863  friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
864  -> EnableIf_t< UseSMPAssign_v<VT2> >
865  {
867 
871 
872  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
873 
874  const ResultType tmp( rhs );
875  smpAddAssign( ~lhs, tmp );
876  }
878  //**********************************************************************************************
879 
880  //**SMP addition assignment to sparse vectors***************************************************
881  // No special implementation for the SMP addition assignment to sparse vectors.
882  //**********************************************************************************************
883 
884  //**SMP subtraction assignment to dense vectors*************************************************
898  template< typename VT2 > // Type of the target dense vector
899  friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
900  -> EnableIf_t< UseSMPAssign_v<VT2> >
901  {
903 
907 
908  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
909 
910  const ResultType tmp( rhs );
911  smpSubAssign( ~lhs, tmp );
912  }
914  //**********************************************************************************************
915 
916  //**SMP subtraction assignment to sparse vectors************************************************
917  // No special implementation for the SMP subtraction assignment to sparse vectors.
918  //**********************************************************************************************
919 
920  //**SMP multiplication assignment to dense vectors**********************************************
934  template< typename VT2 > // Type of the target dense vector
935  friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
936  -> EnableIf_t< UseSMPAssign_v<VT2> >
937  {
939 
943 
944  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
945 
946  const ResultType tmp( rhs );
947  smpMultAssign( ~lhs, tmp );
948  }
950  //**********************************************************************************************
951 
952  //**SMP multiplication assignment to sparse vectors*********************************************
953  // No special implementation for the SMP multiplication assignment to sparse vectors.
954  //**********************************************************************************************
955 
956  //**SMP division assignment to dense vectors****************************************************
970  template< typename VT2 > // Type of the target dense vector
971  friend inline auto smpDivAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
972  -> EnableIf_t< UseSMPAssign_v<VT2> >
973  {
975 
979 
980  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
981 
982  const ResultType tmp( rhs );
983  smpDivAssign( ~lhs, tmp );
984  }
986  //**********************************************************************************************
987 
988  //**SMP division assignment to sparse vectors***************************************************
989  // No special implementation for the SMP division assignment to sparse vectors.
990  //**********************************************************************************************
991 
992  //**Compile time checks*************************************************************************
1001  //**********************************************************************************************
1002 };
1003 //*************************************************************************************************
1004 
1005 
1006 
1007 
1008 //=================================================================================================
1009 //
1010 // GLOBAL BINARY ARITHMETIC OPERATORS
1011 //
1012 //=================================================================================================
1013 
1014 //*************************************************************************************************
1019 template< typename VT // Type of the left-hand side dense vector
1020  , typename ST // Type of the right-hand side scalar
1021  , bool TF > // Transpose flag
1022 struct DVecScalarDivExprHelper
1023 {
1024  private:
1025  //**********************************************************************************************
1026  using ScalarType = If_t< IsFloatingPoint_v< UnderlyingBuiltin_t<VT> > ||
1027  IsFloatingPoint_v< UnderlyingBuiltin_t<ST> >
1028  , If_t< IsComplex_v< UnderlyingNumeric_t<VT> > && IsBuiltin_v<ST>
1029  , DivTrait_t< UnderlyingBuiltin_t<VT>, ST >
1030  , DivTrait_t< UnderlyingNumeric_t<VT>, ST > >
1031  , ST >;
1032  //**********************************************************************************************
1033 
1034  public:
1035  //**********************************************************************************************
1036  using Type = If_t< IsInvertible_v<ScalarType>
1037  , DVecScalarMultExpr<VT,ScalarType,TF>
1038  , DVecScalarDivExpr<VT,ScalarType,TF> >;
1039  //**********************************************************************************************
1040 };
1042 //*************************************************************************************************
1043 
1044 
1045 //*************************************************************************************************
1069 template< typename VT // Type of the left-hand side dense vector
1070  , typename ST // Type of the right-hand side scalar
1071  , bool TF // Transpose flag
1072  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1073 inline decltype(auto) operator/( const DenseVector<VT,TF>& vec, ST scalar )
1074 {
1076 
1077  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
1078 
1079  using ReturnType = typename DVecScalarDivExprHelper<VT,ST,TF>::Type;
1080  using ScalarType = RightOperand_t<ReturnType>;
1081 
1082  if( IsMultExpr_v<ReturnType> ) {
1083  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
1084  }
1085  else {
1086  return ReturnType( ~vec, scalar );
1087  }
1088 }
1089 //*************************************************************************************************
1090 
1091 
1092 
1093 
1094 //=================================================================================================
1095 //
1096 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
1097 //
1098 //=================================================================================================
1099 
1100 //*************************************************************************************************
1113 template< typename VT // Type of the dense vector of the left-hand side expression
1114  , typename ST1 // Type of the scalar of the left-hand side expression
1115  , bool TF // Transpose flag of the dense vector
1116  , typename ST2 // Type of the right-hand side scalar
1117  , EnableIf_t< IsNumeric_v<ST2> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
1118 inline decltype(auto) operator*( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1119 {
1121 
1122  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1123 }
1125 //*************************************************************************************************
1126 
1127 
1128 //*************************************************************************************************
1141 template< typename ST1 // Type of the left-hand side scalar
1142  , typename VT // Type of the dense vector of the right-hand side expression
1143  , typename ST2 // Type of the scalar of the right-hand side expression
1144  , bool TF // Transpose flag of the dense vector
1145  , EnableIf_t< IsNumeric_v<ST1> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
1146 inline decltype(auto) operator*( ST1 scalar, const DVecScalarDivExpr<VT,ST2,TF>& vec )
1147 {
1149 
1150  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1151 }
1153 //*************************************************************************************************
1154 
1155 
1156 //*************************************************************************************************
1169 template< typename VT // Type of the dense vector of the left-hand side expression
1170  , typename ST1 // Type of the scalar of the left-hand side expression
1171  , bool TF // Transpose flag of the dense vector
1172  , typename ST2 // Type of the right-hand side scalar
1173  , EnableIf_t< IsNumeric_v<ST2> >* = nullptr >
1174 inline decltype(auto) operator/( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1175 {
1177 
1178  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1179 
1180  using MultType = MultTrait_t<ST1,ST2>;
1181  using ReturnType = typename DVecScalarDivExprHelper<VT,MultType,TF>::Type;
1182  using ScalarType = RightOperand_t<ReturnType>;
1183 
1184  if( IsMultExpr_v<ReturnType> ) {
1185  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
1186  }
1187  else {
1188  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
1189  }
1190 }
1192 //*************************************************************************************************
1193 
1194 
1195 
1196 
1197 //=================================================================================================
1198 //
1199 // ISALIGNED SPECIALIZATIONS
1200 //
1201 //=================================================================================================
1202 
1203 //*************************************************************************************************
1205 template< typename VT, typename ST, bool TF >
1206 struct IsAligned< DVecScalarDivExpr<VT,ST,TF> >
1207  : public IsAligned<VT>
1208 {};
1210 //*************************************************************************************************
1211 
1212 
1213 
1214 
1215 //=================================================================================================
1216 //
1217 // ISPADDED SPECIALIZATIONS
1218 //
1219 //=================================================================================================
1220 
1221 //*************************************************************************************************
1223 template< typename VT, typename ST, bool TF >
1224 struct IsPadded< DVecScalarDivExpr<VT,ST,TF> >
1225  : public IsPadded<VT>
1226 {};
1228 //*************************************************************************************************
1229 
1230 } // namespace blaze
1231 
1232 #endif
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DVecScalarDivExpr.h:589
Header file for the UnderlyingNumeric type trait.
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Data type constraint.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecScalarDivExpr.h:571
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecScalarDivExpr.h:561
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecScalarDivExpr.h:427
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecScalarDivExpr.h:167
RightOperand scalar_
Scalar of the division expression.
Definition: DVecScalarDivExpr.h:420
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
LeftOperand vector_
Left-hand side dense vector of the division expression.
Definition: DVecScalarDivExpr.h:588
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.The DivTrait_t alias declaration provides...
Definition: DivTrait.h:239
ElementType * PointerType
Pointer return type.
Definition: DVecScalarDivExpr.h:191
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecScalarDivExpr.h:170
Header file for the VecScalarDivExpr base class.
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarDivExpr.h:212
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarDivExpr.h:189
Header file for the DenseVector base class.
PointerType pointer
Pointer return type.
Definition: DVecScalarDivExpr.h:198
DVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the DVecScalarDivExpr class.
Definition: DVecScalarDivExpr.h:446
Header file for the Computation base class.
Header file for the UnderlyingElement type trait.
Header file for the RequiresEvaluation type trait.
Base class for all vector/scalar division expression templates.The VecScalarDivExpr class serves as a...
Definition: VecScalarDivExpr.h:66
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DVecScalarDivExpr.h:179
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
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
ConstIterator_t< VT > IteratorType
ConstIterator type of the dense vector expression.
Definition: DVecScalarDivExpr.h:203
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarDivExpr.h:400
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
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecScalarDivExpr.h:527
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecScalarDivExpr.h:437
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
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.
Header file for the IsFloatingPoint type trait.
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecScalarDivExpr.h:458
Header file for the UnderlyingBuiltin type trait.
Header file for the IsMultExpr type trait class.
CompositeType_t< VT > CT
Composite type of the dense vector expression.
Definition: DVecScalarDivExpr.h:114
Iterator over the elements of the dense vector.
Definition: DVecScalarDivExpr.h:185
#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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecScalarDivExpr.h:376
ReferenceType reference
Reference return type.
Definition: DVecScalarDivExpr.h:199
Header file for all SIMD functionality.
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:485
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:71
ResultType_t< VT > RT
Result type of the dense vector expression.
Definition: DVecScalarDivExpr.h:111
Header file for the IsAligned type trait.
Constraint on the data type.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the division expression.
Definition: DVecScalarDivExpr.h:138
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:190
ReturnType operator *() const
Direct access to the element at the current iterator position.
Definition: DVecScalarDivExpr.h:289
Constraint on the data type.
Header file for the exception macros of the math module.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:343
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarDivExpr.h:419
Constraint on the data type.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:321
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecScalarDivExpr.h:193
Header file for the IsNumeric type trait.
If_t< IsExpression_v< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecScalarDivExpr.h:176
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecScalarDivExpr.h:517
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:299
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.
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
Header file for the division trait.
ElementType_t< VT > ET
Element type of the dense vector expression.
Definition: DVecScalarDivExpr.h:113
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:507
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:354
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:365
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecScalarDivExpr.h:124
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:497
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarDivExpr.h:196
Constraint on the data type.
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DVecScalarDivExpr.h:537
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarDivExpr.h:258
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
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
Header file for all forward declarations for expression class templates.
DivTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DVecScalarDivExpr.h:165
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
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:412
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
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecScalarDivExpr.h:247
Header file for the IsInvertible type trait.
If_t< useAssign, const ResultType, const DVecScalarDivExpr & > CompositeType
Data type for composite expression templates.
Definition: DVecScalarDivExpr.h:173
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is a floating point data type,...
Definition: FloatingPoint.h:81
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarDivExpr.h:279
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecScalarDivExpr.h:166
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
Expression object for divisions of a dense vector by a scalar.The DVecScalarDivExpr class represents ...
Definition: DVecScalarDivExpr.h:105
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecScalarDivExpr.h:268
#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
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecScalarDivExpr.h:236
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarDivExpr.h:224
Macro for CUDA compatibility.
Header file for the HasSIMDDiv type trait.
ReturnType_t< VT > RN
Return type of the dense vector expression.
Definition: DVecScalarDivExpr.h:112
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:388
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecScalarDivExpr.h:471
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
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
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecScalarDivExpr.h:549
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
decltype(std::declval< RN >()/std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarDivExpr.h:127
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarDivExpr.h:192
Header file for the IsComplex type trait.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarDivExpr.h:581
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:310
typename T::RightOperand RightOperand_t
Alias declaration for nested RightOperand type definitions.The RightOperand_t alias declaration provi...
Definition: Aliases.h:430
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecScalarDivExpr.h:432
System settings for the inline keywords.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:332
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
ValueType value_type
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:197
Header file for the IsExpression type trait class.
Header file for the function trace functionality.