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>
70 #include <blaze/system/Inline.h>
72 #include <blaze/util/Assert.h>
76 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS DVECSCALARDIVEXPR
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
101 template< 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 VecScalarDivExpr< DenseVector< DVecScalarDivExpr<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 
140  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 =
158  //**********************************************************************************************
159 
160  public:
161  //**Type definitions****************************************************************************
167 
170 
173 
175  using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
176 
178  using RightOperand = ST;
179  //**********************************************************************************************
180 
181  //**ConstIterator class definition**************************************************************
185  {
186  public:
187  //**Type definitions*************************************************************************
188  using IteratorCategory = std::random_access_iterator_tag;
193 
194  // STL iterator requirements
200 
203  //*******************************************************************************************
204 
205  //**Constructor******************************************************************************
211  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
212  : iterator_( iterator ) // Iterator to the current element
213  , scalar_ ( scalar ) // Scalar of the division expression
214  {}
215  //*******************************************************************************************
216 
217  //**Addition assignment operator*************************************************************
223  inline ConstIterator& operator+=( size_t inc ) {
224  iterator_ += inc;
225  return *this;
226  }
227  //*******************************************************************************************
228 
229  //**Subtraction assignment operator**********************************************************
235  inline ConstIterator& operator-=( size_t dec ) {
236  iterator_ -= dec;
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Prefix increment operator****************************************************************
247  ++iterator_;
248  return *this;
249  }
250  //*******************************************************************************************
251 
252  //**Postfix increment operator***************************************************************
257  inline const ConstIterator operator++( int ) {
258  return ConstIterator( iterator_++ );
259  }
260  //*******************************************************************************************
261 
262  //**Prefix decrement operator****************************************************************
268  --iterator_;
269  return *this;
270  }
271  //*******************************************************************************************
272 
273  //**Postfix decrement operator***************************************************************
278  inline const ConstIterator operator--( int ) {
279  return ConstIterator( iterator_-- );
280  }
281  //*******************************************************************************************
282 
283  //**Element access operator******************************************************************
288  inline ReturnType operator*() const {
289  return *iterator_ / scalar_;
290  }
291  //*******************************************************************************************
292 
293  //**Load function****************************************************************************
298  inline auto load() const noexcept {
299  return iterator_.load() / set( scalar_ );
300  }
301  //*******************************************************************************************
302 
303  //**Equality operator************************************************************************
309  inline bool operator==( const ConstIterator& rhs ) const {
310  return iterator_ == rhs.iterator_;
311  }
312  //*******************************************************************************************
313 
314  //**Inequality operator**********************************************************************
320  inline bool operator!=( const ConstIterator& rhs ) const {
321  return iterator_ != rhs.iterator_;
322  }
323  //*******************************************************************************************
324 
325  //**Less-than operator***********************************************************************
331  inline bool operator<( const ConstIterator& rhs ) const {
332  return iterator_ < rhs.iterator_;
333  }
334  //*******************************************************************************************
335 
336  //**Greater-than operator********************************************************************
342  inline bool operator>( const ConstIterator& rhs ) const {
343  return iterator_ > rhs.iterator_;
344  }
345  //*******************************************************************************************
346 
347  //**Less-or-equal-than operator**************************************************************
353  inline bool operator<=( const ConstIterator& rhs ) const {
354  return iterator_ <= rhs.iterator_;
355  }
356  //*******************************************************************************************
357 
358  //**Greater-or-equal-than operator***********************************************************
364  inline bool operator>=( const ConstIterator& rhs ) const {
365  return iterator_ >= rhs.iterator_;
366  }
367  //*******************************************************************************************
368 
369  //**Subtraction operator*********************************************************************
375  inline DifferenceType operator-( const ConstIterator& rhs ) const {
376  return iterator_ - rhs.iterator_;
377  }
378  //*******************************************************************************************
379 
380  //**Addition operator************************************************************************
387  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
388  return ConstIterator( it.iterator_ + inc );
389  }
390  //*******************************************************************************************
391 
392  //**Addition operator************************************************************************
399  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
400  return ConstIterator( it.iterator_ + inc );
401  }
402  //*******************************************************************************************
403 
404  //**Subtraction operator*********************************************************************
411  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
412  return ConstIterator( it.iterator_ - dec );
413  }
414  //*******************************************************************************************
415 
416  private:
417  //**Member variables*************************************************************************
420  //*******************************************************************************************
421  };
422  //**********************************************************************************************
423 
424  //**Compilation flags***************************************************************************
426  static constexpr bool simdEnabled =
427  ( VT::simdEnabled && IsNumeric_v<ET> &&
428  ( HasSIMDDiv_v<ET,ST> || HasSIMDDiv_v<UnderlyingElement_t<ET>,ST> ) );
429 
431  static constexpr bool smpAssignable = VT::smpAssignable;
432  //**********************************************************************************************
433 
434  //**SIMD properties*****************************************************************************
436  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
437  //**********************************************************************************************
438 
439  //**Constructor*********************************************************************************
445  explicit inline DVecScalarDivExpr( const VT& vector, ST scalar ) noexcept
446  : vector_( vector ) // Left-hand side dense vector of the division expression
447  , scalar_( scalar ) // Right-hand side scalar of the division expression
448  {}
449  //**********************************************************************************************
450 
451  //**Subscript operator**************************************************************************
457  inline ReturnType operator[]( size_t index ) const {
458  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
459  return vector_[index] / scalar_;
460  }
461  //**********************************************************************************************
462 
463  //**At function*********************************************************************************
470  inline ReturnType at( size_t index ) const {
471  if( index >= vector_.size() ) {
472  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
473  }
474  return (*this)[index];
475  }
476  //**********************************************************************************************
477 
478  //**Load function*******************************************************************************
484  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
485  BLAZE_INTERNAL_ASSERT( index < vector_.size() , "Invalid vector access index" );
486  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
487  return vector_.load( index ) / set( scalar_ );
488  }
489  //**********************************************************************************************
490 
491  //**Begin function******************************************************************************
496  inline ConstIterator begin() const {
497  return ConstIterator( vector_.begin(), scalar_ );
498  }
499  //**********************************************************************************************
500 
501  //**End function********************************************************************************
506  inline ConstIterator end() const {
507  return ConstIterator( vector_.end(), scalar_ );
508  }
509  //**********************************************************************************************
510 
511  //**Size function*******************************************************************************
516  inline size_t size() const noexcept {
517  return vector_.size();
518  }
519  //**********************************************************************************************
520 
521  //**Left operand access*************************************************************************
526  inline LeftOperand leftOperand() const noexcept {
527  return vector_;
528  }
529  //**********************************************************************************************
530 
531  //**Right operand access************************************************************************
536  inline RightOperand rightOperand() const noexcept {
537  return scalar_;
538  }
539  //**********************************************************************************************
540 
541  //**********************************************************************************************
547  template< typename T >
548  inline bool canAlias( const T* alias ) const noexcept {
549  return IsExpression_v<VT> && vector_.canAlias( alias );
550  }
551  //**********************************************************************************************
552 
553  //**********************************************************************************************
559  template< typename T >
560  inline bool isAliased( const T* alias ) const noexcept {
561  return vector_.isAliased( alias );
562  }
563  //**********************************************************************************************
564 
565  //**********************************************************************************************
570  inline bool isAligned() const noexcept {
571  return vector_.isAligned();
572  }
573  //**********************************************************************************************
574 
575  //**********************************************************************************************
580  inline bool canSMPAssign() const noexcept {
581  return vector_.canSMPAssign() || ( size() > SMP_DVECSCALARMULT_THRESHOLD );
582  }
583  //**********************************************************************************************
584 
585  private:
586  //**Member variables****************************************************************************
589  //**********************************************************************************************
590 
591  //**Assignment to dense vectors*****************************************************************
605  template< typename VT2 > // Type of the target dense vector
606  friend inline auto assign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
608  {
610 
611  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
612 
613  assign( ~lhs, rhs.vector_ );
614  assign( ~lhs, (~lhs) / rhs.scalar_ );
615  }
617  //**********************************************************************************************
618 
619  //**Assignment to sparse vectors****************************************************************
633  template< typename VT2 > // Type of the target sparse vector
634  friend inline auto assign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
636  {
638 
639  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
640 
641  assign( ~lhs, rhs.vector_ );
642  (~lhs) /= rhs.scalar_;
643  }
645  //**********************************************************************************************
646 
647  //**Addition assignment to dense vectors********************************************************
661  template< typename VT2 > // Type of the target dense vector
662  friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
663  -> EnableIf_t< UseAssign_v<VT2> >
664  {
666 
670 
671  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
672 
673  const ResultType tmp( serial( rhs ) );
674  addAssign( ~lhs, tmp );
675  }
677  //**********************************************************************************************
678 
679  //**Addition assignment to sparse vectors*******************************************************
680  // No special implementation for the addition assignment to sparse vectors.
681  //**********************************************************************************************
682 
683  //**Subtraction assignment to dense vectors*****************************************************
697  template< typename VT2 > // Type of the target dense vector
698  friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
699  -> EnableIf_t< UseAssign_v<VT2> >
700  {
702 
706 
707  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
708 
709  const ResultType tmp( serial( rhs ) );
710  subAssign( ~lhs, tmp );
711  }
713  //**********************************************************************************************
714 
715  //**Subtraction assignment to sparse vectors****************************************************
716  // No special implementation for the subtraction assignment to sparse vectors.
717  //**********************************************************************************************
718 
719  //**Multiplication assignment to dense vectors**************************************************
733  template< typename VT2 > // Type of the target dense vector
734  friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
735  -> EnableIf_t< UseAssign_v<VT2> >
736  {
738 
742 
743  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
744 
745  const ResultType tmp( serial( rhs ) );
746  multAssign( ~lhs, tmp );
747  }
749  //**********************************************************************************************
750 
751  //**Multiplication assignment to sparse vectors*************************************************
752  // No special implementation for the multiplication assignment to sparse vectors.
753  //**********************************************************************************************
754 
755  //**Division assignment to dense vectors********************************************************
769  template< typename VT2 > // Type of the target dense vector
770  friend inline auto divAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
771  -> EnableIf_t< UseAssign_v<VT2> >
772  {
774 
778 
779  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
780 
781  const ResultType tmp( serial( rhs ) );
782  divAssign( ~lhs, tmp );
783  }
785  //**********************************************************************************************
786 
787  //**Division assignment to sparse vectors*******************************************************
788  // No special implementation for the division assignment to sparse vectors.
789  //**********************************************************************************************
790 
791  //**SMP assignment to dense vectors*************************************************************
805  template< typename VT2 > // Type of the target dense vector
806  friend inline auto smpAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
807  -> EnableIf_t< UseSMPAssign_v<VT2> >
808  {
810 
811  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
812 
813  smpAssign( ~lhs, rhs.vector_ );
814  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
815  }
817  //**********************************************************************************************
818 
819  //**SMP assignment to sparse vectors************************************************************
833  template< typename VT2 > // Type of the target sparse vector
834  friend inline auto smpAssign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
835  -> EnableIf_t< UseSMPAssign_v<VT2> >
836  {
838 
839  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
840 
841  smpAssign( ~lhs, rhs.vector_ );
842  (~lhs) /= rhs.scalar_;
843  }
845  //**********************************************************************************************
846 
847  //**SMP addition assignment to dense vectors****************************************************
861  template< typename VT2 > // Type of the target dense vector
862  friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
863  -> EnableIf_t< UseSMPAssign_v<VT2> >
864  {
866 
870 
871  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
872 
873  const ResultType tmp( rhs );
874  smpAddAssign( ~lhs, tmp );
875  }
877  //**********************************************************************************************
878 
879  //**SMP addition assignment to sparse vectors***************************************************
880  // No special implementation for the SMP addition assignment to sparse vectors.
881  //**********************************************************************************************
882 
883  //**SMP subtraction assignment to dense vectors*************************************************
897  template< typename VT2 > // Type of the target dense vector
898  friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
899  -> EnableIf_t< UseSMPAssign_v<VT2> >
900  {
902 
906 
907  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
908 
909  const ResultType tmp( rhs );
910  smpSubAssign( ~lhs, tmp );
911  }
913  //**********************************************************************************************
914 
915  //**SMP subtraction assignment to sparse vectors************************************************
916  // No special implementation for the SMP subtraction assignment to sparse vectors.
917  //**********************************************************************************************
918 
919  //**SMP multiplication assignment to dense vectors**********************************************
933  template< typename VT2 > // Type of the target dense vector
934  friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
935  -> EnableIf_t< UseSMPAssign_v<VT2> >
936  {
938 
942 
943  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
944 
945  const ResultType tmp( rhs );
946  smpMultAssign( ~lhs, tmp );
947  }
949  //**********************************************************************************************
950 
951  //**SMP multiplication assignment to sparse vectors*********************************************
952  // No special implementation for the SMP multiplication assignment to sparse vectors.
953  //**********************************************************************************************
954 
955  //**SMP division assignment to dense vectors****************************************************
969  template< typename VT2 > // Type of the target dense vector
970  friend inline auto smpDivAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
971  -> EnableIf_t< UseSMPAssign_v<VT2> >
972  {
974 
978 
979  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
980 
981  const ResultType tmp( rhs );
982  smpDivAssign( ~lhs, tmp );
983  }
985  //**********************************************************************************************
986 
987  //**SMP division assignment to sparse vectors***************************************************
988  // No special implementation for the SMP division assignment to sparse vectors.
989  //**********************************************************************************************
990 
991  //**Compile time checks*************************************************************************
1000  //**********************************************************************************************
1001 };
1002 //*************************************************************************************************
1003 
1004 
1005 
1006 
1007 //=================================================================================================
1008 //
1009 // GLOBAL BINARY ARITHMETIC OPERATORS
1010 //
1011 //=================================================================================================
1012 
1013 //*************************************************************************************************
1018 template< typename VT // Type of the left-hand side dense vector
1019  , typename ST // Type of the right-hand side scalar
1020  , bool TF > // Transpose flag
1021 struct DVecScalarDivExprHelper
1022 {
1023  private:
1024  //**********************************************************************************************
1025  using ScalarType = If_t< IsFloatingPoint_v< UnderlyingBuiltin_t<VT> > ||
1026  IsFloatingPoint_v< UnderlyingBuiltin_t<ST> >
1027  , If_t< IsComplex_v< UnderlyingNumeric_t<VT> > && IsBuiltin_v<ST>
1028  , DivTrait_t< UnderlyingBuiltin_t<VT>, ST >
1029  , DivTrait_t< UnderlyingNumeric_t<VT>, ST > >
1030  , ST >;
1031  //**********************************************************************************************
1032 
1033  public:
1034  //**********************************************************************************************
1035  using Type = If_t< IsInvertible_v<ScalarType>
1036  , DVecScalarMultExpr<VT,ScalarType,TF>
1037  , DVecScalarDivExpr<VT,ScalarType,TF> >;
1038  //**********************************************************************************************
1039 };
1041 //*************************************************************************************************
1042 
1043 
1044 //*************************************************************************************************
1068 template< typename VT // Type of the left-hand side dense vector
1069  , typename ST // Type of the right-hand side scalar
1070  , bool TF // Transpose flag
1071  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
1072 inline decltype(auto) operator/( const DenseVector<VT,TF>& vec, ST scalar )
1073 {
1075 
1076  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
1077 
1078  using ReturnType = typename DVecScalarDivExprHelper<VT,ST,TF>::Type;
1079  using ScalarType = RightOperand_t<ReturnType>;
1080 
1081  if( IsMultExpr_v<ReturnType> ) {
1082  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
1083  }
1084  else {
1085  return ReturnType( ~vec, scalar );
1086  }
1087 }
1088 //*************************************************************************************************
1089 
1090 
1091 
1092 
1093 //=================================================================================================
1094 //
1095 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
1096 //
1097 //=================================================================================================
1098 
1099 //*************************************************************************************************
1112 template< typename VT // Type of the dense vector of the left-hand side expression
1113  , typename ST1 // Type of the scalar of the left-hand side expression
1114  , bool TF // Transpose flag of the dense vector
1115  , typename ST2 // Type of the right-hand side scalar
1116  , EnableIf_t< IsNumeric_v<ST2> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
1117 inline decltype(auto) operator*( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1118 {
1120 
1121  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1122 }
1124 //*************************************************************************************************
1125 
1126 
1127 //*************************************************************************************************
1140 template< typename ST1 // Type of the left-hand side scalar
1141  , typename VT // Type of the dense vector of the right-hand side expression
1142  , typename ST2 // Type of the scalar of the right-hand side expression
1143  , bool TF // Transpose flag of the dense vector
1144  , EnableIf_t< IsNumeric_v<ST1> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
1145 inline decltype(auto) operator*( ST1 scalar, const DVecScalarDivExpr<VT,ST2,TF>& vec )
1146 {
1148 
1149  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1150 }
1152 //*************************************************************************************************
1153 
1154 
1155 //*************************************************************************************************
1168 template< typename VT // Type of the dense vector of the left-hand side expression
1169  , typename ST1 // Type of the scalar of the left-hand side expression
1170  , bool TF // Transpose flag of the dense vector
1171  , typename ST2 // Type of the right-hand side scalar
1172  , EnableIf_t< IsNumeric_v<ST2> >* = nullptr >
1173 inline decltype(auto) operator/( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1174 {
1176 
1177  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1178 
1179  using MultType = MultTrait_t<ST1,ST2>;
1180  using ReturnType = typename DVecScalarDivExprHelper<VT,MultType,TF>::Type;
1181  using ScalarType = RightOperand_t<ReturnType>;
1182 
1183  if( IsMultExpr_v<ReturnType> ) {
1184  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
1185  }
1186  else {
1187  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
1188  }
1189 }
1191 //*************************************************************************************************
1192 
1193 
1194 
1195 
1196 //=================================================================================================
1197 //
1198 // ISALIGNED SPECIALIZATIONS
1199 //
1200 //=================================================================================================
1201 
1202 //*************************************************************************************************
1204 template< typename VT, typename ST, bool TF >
1205 struct IsAligned< DVecScalarDivExpr<VT,ST,TF> >
1206  : public IsAligned<VT>
1207 {};
1209 //*************************************************************************************************
1210 
1211 
1212 
1213 
1214 //=================================================================================================
1215 //
1216 // ISPADDED SPECIALIZATIONS
1217 //
1218 //=================================================================================================
1219 
1220 //*************************************************************************************************
1222 template< typename VT, typename ST, bool TF >
1223 struct IsPadded< DVecScalarDivExpr<VT,ST,TF> >
1224  : public IsPadded<VT>
1225 {};
1227 //*************************************************************************************************
1228 
1229 } // namespace blaze
1230 
1231 #endif
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DVecScalarDivExpr.h:588
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:570
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, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
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:560
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecScalarDivExpr.h:426
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecScalarDivExpr.h:166
RightOperand scalar_
Scalar of the division expression.
Definition: DVecScalarDivExpr.h:419
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:587
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:190
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecScalarDivExpr.h:169
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the VecScalarDivExpr base class.
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarDivExpr.h:211
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarDivExpr.h:188
Header file for the DenseVector base class.
PointerType pointer
Pointer return type.
Definition: DVecScalarDivExpr.h:197
DVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the DVecScalarDivExpr class.
Definition: DVecScalarDivExpr.h:445
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:178
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 & operator++()
Pre-increment operator.
Definition: DVecScalarDivExpr.h:246
ConstIterator_t< VT > IteratorType
ConstIterator type of the dense vector expression.
Definition: DVecScalarDivExpr.h:202
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarDivExpr.h:399
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarDivExpr.h:257
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:526
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DVecScalarDivExpr.h:436
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:457
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:113
Iterator over the elements of the dense vector.
Definition: DVecScalarDivExpr.h:184
#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:375
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
ReferenceType reference
Reference return type.
Definition: DVecScalarDivExpr.h:198
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:484
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:110
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:137
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:189
Constraint on the data type.
Header file for the exception macros of the math module.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarDivExpr.h:223
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:342
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarDivExpr.h:418
Constraint on the data type.
Header file for all forward declarations for expression class templates.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:320
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecScalarDivExpr.h:192
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:175
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecScalarDivExpr.h:516
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:298
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:112
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:506
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:353
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:364
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecScalarDivExpr.h:123
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:496
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarDivExpr.h:195
Constraint on the data type.
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DVecScalarDivExpr.h:536
#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
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecScalarDivExpr.h:267
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
DivTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DVecScalarDivExpr.h:164
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:411
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
Header file for the IsInvertible type trait.
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecScalarDivExpr.h:288
If_t< useAssign, const ResultType, const DVecScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecScalarDivExpr.h:172
#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
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecScalarDivExpr.h:165
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:104
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecScalarDivExpr.h:235
Header file for the HasSIMDDiv type trait.
ReturnType_t< VT > RN
Return type of the dense vector expression.
Definition: DVecScalarDivExpr.h:111
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:387
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecScalarDivExpr.h:470
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:548
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:138
decltype(std::declval< RN >()/std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarDivExpr.h:126
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarDivExpr.h:191
Header file for the IsComplex type trait.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarDivExpr.h:580
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarDivExpr.h:278
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:309
typename T::RightOperand RightOperand_t
Alias declaration for nested RightOperand type definitions.The RightOperand_t alias declaration provi...
Definition: Aliases.h:430
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecScalarDivExpr.h:431
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:331
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:196
Header file for the IsExpression type trait class.
Header file for the function trace functionality.