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 <blaze/math/Aliases.h>
48 #include <blaze/math/Exception.h>
54 #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/And.h>
80 #include <blaze/util/mpl/If.h>
81 #include <blaze/util/mpl/Or.h>
82 #include <blaze/util/Types.h>
87 
88 
89 namespace blaze {
90 
91 //=================================================================================================
92 //
93 // CLASS DVECSCALARDIVEXPR
94 //
95 //=================================================================================================
96 
97 //*************************************************************************************************
104 template< typename VT // Type of the left-hand side dense vector
105  , typename ST // Type of the right-hand side scalar value
106  , bool TF > // Transpose flag
108  : public VecScalarDivExpr< DenseVector< DVecScalarDivExpr<VT,ST,TF>, TF > >
109  , private Computation
110 {
111  private:
112  //**Type definitions****************************************************************************
113  using RT = ResultType_<VT>;
114  using RN = ReturnType_<VT>;
117  //**********************************************************************************************
118 
119  //**Return type evaluation**********************************************************************
121 
126  enum : bool { returnExpr = !IsTemporary<RN>::value };
127 
130  //**********************************************************************************************
131 
132  //**Serial evaluation strategy******************************************************************
134 
140  enum : bool { useAssign = IsComputation<VT>::value && RequiresEvaluation<VT>::value };
141 
143  template< typename VT2 >
145  struct UseAssign {
146  enum : bool { value = useAssign };
147  };
149  //**********************************************************************************************
150 
151  //**Parallel evaluation strategy****************************************************************
153 
159  template< typename VT2 >
160  struct UseSMPAssign {
161  enum : bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
162  };
164  //**********************************************************************************************
165 
166  public:
167  //**Type definitions****************************************************************************
172 
175 
178 
180  using LeftOperand = If_< IsExpression<VT>, const VT, const VT& >;
181 
183  using RightOperand = ST;
184  //**********************************************************************************************
185 
186  //**ConstIterator class definition**************************************************************
190  {
191  public:
192  //**Type definitions*************************************************************************
193  using IteratorCategory = std::random_access_iterator_tag;
198 
199  // STL iterator requirements
205 
208  //*******************************************************************************************
209 
210  //**Constructor******************************************************************************
216  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
217  : iterator_( iterator ) // Iterator to the current element
218  , scalar_ ( scalar ) // Scalar of the division expression
219  {}
220  //*******************************************************************************************
221 
222  //**Addition assignment operator*************************************************************
228  inline ConstIterator& operator+=( size_t inc ) {
229  iterator_ += inc;
230  return *this;
231  }
232  //*******************************************************************************************
233 
234  //**Subtraction assignment operator**********************************************************
240  inline ConstIterator& operator-=( size_t dec ) {
241  iterator_ -= dec;
242  return *this;
243  }
244  //*******************************************************************************************
245 
246  //**Prefix increment operator****************************************************************
252  ++iterator_;
253  return *this;
254  }
255  //*******************************************************************************************
256 
257  //**Postfix increment operator***************************************************************
262  inline const ConstIterator operator++( int ) {
263  return ConstIterator( iterator_++ );
264  }
265  //*******************************************************************************************
266 
267  //**Prefix decrement operator****************************************************************
273  --iterator_;
274  return *this;
275  }
276  //*******************************************************************************************
277 
278  //**Postfix decrement operator***************************************************************
283  inline const ConstIterator operator--( int ) {
284  return ConstIterator( iterator_-- );
285  }
286  //*******************************************************************************************
287 
288  //**Element access operator******************************************************************
293  inline ReturnType operator*() const {
294  return *iterator_ / scalar_;
295  }
296  //*******************************************************************************************
297 
298  //**Load function****************************************************************************
303  inline auto load() const noexcept {
304  return iterator_.load() / set( scalar_ );
305  }
306  //*******************************************************************************************
307 
308  //**Equality operator************************************************************************
314  inline bool operator==( const ConstIterator& rhs ) const {
315  return iterator_ == rhs.iterator_;
316  }
317  //*******************************************************************************************
318 
319  //**Inequality operator**********************************************************************
325  inline bool operator!=( const ConstIterator& rhs ) const {
326  return iterator_ != rhs.iterator_;
327  }
328  //*******************************************************************************************
329 
330  //**Less-than operator***********************************************************************
336  inline bool operator<( const ConstIterator& rhs ) const {
337  return iterator_ < rhs.iterator_;
338  }
339  //*******************************************************************************************
340 
341  //**Greater-than operator********************************************************************
347  inline bool operator>( const ConstIterator& rhs ) const {
348  return iterator_ > rhs.iterator_;
349  }
350  //*******************************************************************************************
351 
352  //**Less-or-equal-than operator**************************************************************
358  inline bool operator<=( const ConstIterator& rhs ) const {
359  return iterator_ <= rhs.iterator_;
360  }
361  //*******************************************************************************************
362 
363  //**Greater-or-equal-than operator***********************************************************
369  inline bool operator>=( const ConstIterator& rhs ) const {
370  return iterator_ >= rhs.iterator_;
371  }
372  //*******************************************************************************************
373 
374  //**Subtraction operator*********************************************************************
380  inline DifferenceType operator-( const ConstIterator& rhs ) const {
381  return iterator_ - rhs.iterator_;
382  }
383  //*******************************************************************************************
384 
385  //**Addition operator************************************************************************
392  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
393  return ConstIterator( it.iterator_ + inc );
394  }
395  //*******************************************************************************************
396 
397  //**Addition operator************************************************************************
404  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
405  return ConstIterator( it.iterator_ + inc );
406  }
407  //*******************************************************************************************
408 
409  //**Subtraction operator*********************************************************************
416  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
417  return ConstIterator( it.iterator_ - dec );
418  }
419  //*******************************************************************************************
420 
421  private:
422  //**Member variables*************************************************************************
425  //*******************************************************************************************
426  };
427  //**********************************************************************************************
428 
429  //**Compilation flags***************************************************************************
431  enum : bool { simdEnabled = VT::simdEnabled &&
434  HasSIMDDiv<UnderlyingElement_<ET>,ST>::value ) };
435 
437  enum : bool { smpAssignable = VT::smpAssignable };
438  //**********************************************************************************************
439 
440  //**SIMD properties*****************************************************************************
442  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
443  //**********************************************************************************************
444 
445  //**Constructor*********************************************************************************
451  explicit inline DVecScalarDivExpr( const VT& vector, ST scalar ) noexcept
452  : vector_( vector ) // Left-hand side dense vector of the division expression
453  , scalar_( scalar ) // Right-hand side scalar of the division expression
454  {}
455  //**********************************************************************************************
456 
457  //**Subscript operator**************************************************************************
463  inline ReturnType operator[]( size_t index ) const {
464  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
465  return vector_[index] / scalar_;
466  }
467  //**********************************************************************************************
468 
469  //**At function*********************************************************************************
476  inline ReturnType at( size_t index ) const {
477  if( index >= vector_.size() ) {
478  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
479  }
480  return (*this)[index];
481  }
482  //**********************************************************************************************
483 
484  //**Load function*******************************************************************************
490  BLAZE_ALWAYS_INLINE auto load( size_t index ) const noexcept {
491  BLAZE_INTERNAL_ASSERT( index < vector_.size() , "Invalid vector access index" );
492  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
493  return vector_.load( index ) / set( scalar_ );
494  }
495  //**********************************************************************************************
496 
497  //**Begin function******************************************************************************
502  inline ConstIterator begin() const {
503  return ConstIterator( vector_.begin(), scalar_ );
504  }
505  //**********************************************************************************************
506 
507  //**End function********************************************************************************
512  inline ConstIterator end() const {
513  return ConstIterator( vector_.end(), scalar_ );
514  }
515  //**********************************************************************************************
516 
517  //**Size function*******************************************************************************
522  inline size_t size() const noexcept {
523  return vector_.size();
524  }
525  //**********************************************************************************************
526 
527  //**Left operand access*************************************************************************
532  inline LeftOperand leftOperand() const noexcept {
533  return vector_;
534  }
535  //**********************************************************************************************
536 
537  //**Right operand access************************************************************************
542  inline RightOperand rightOperand() const noexcept {
543  return scalar_;
544  }
545  //**********************************************************************************************
546 
547  //**********************************************************************************************
553  template< typename T >
554  inline bool canAlias( const T* alias ) const noexcept {
555  return IsExpression<VT>::value && vector_.canAlias( alias );
556  }
557  //**********************************************************************************************
558 
559  //**********************************************************************************************
565  template< typename T >
566  inline bool isAliased( const T* alias ) const noexcept {
567  return vector_.isAliased( alias );
568  }
569  //**********************************************************************************************
570 
571  //**********************************************************************************************
576  inline bool isAligned() const noexcept {
577  return vector_.isAligned();
578  }
579  //**********************************************************************************************
580 
581  //**********************************************************************************************
586  inline bool canSMPAssign() const noexcept {
587  return vector_.canSMPAssign() || ( size() > SMP_DVECSCALARMULT_THRESHOLD );
588  }
589  //**********************************************************************************************
590 
591  private:
592  //**Member variables****************************************************************************
595  //**********************************************************************************************
596 
597  //**Assignment to dense vectors*****************************************************************
611  template< typename VT2 > // Type of the target dense vector
612  friend inline EnableIf_< UseAssign<VT2> >
613  assign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
614  {
616 
617  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
618 
619  assign( ~lhs, rhs.vector_ );
620  assign( ~lhs, (~lhs) / rhs.scalar_ );
621  }
623  //**********************************************************************************************
624 
625  //**Assignment to sparse vectors****************************************************************
639  template< typename VT2 > // Type of the target sparse vector
640  friend inline EnableIf_< UseAssign<VT2> >
641  assign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
642  {
644 
645  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
646 
647  assign( ~lhs, rhs.vector_ );
648  (~lhs) /= rhs.scalar_;
649  }
651  //**********************************************************************************************
652 
653  //**Addition assignment to dense vectors********************************************************
667  template< typename VT2 > // Type of the target dense vector
668  friend inline EnableIf_< UseAssign<VT2> >
669  addAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
670  {
672 
676 
677  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
678 
679  const ResultType tmp( serial( rhs ) );
680  addAssign( ~lhs, tmp );
681  }
683  //**********************************************************************************************
684 
685  //**Addition assignment to sparse vectors*******************************************************
686  // No special implementation for the addition assignment to sparse vectors.
687  //**********************************************************************************************
688 
689  //**Subtraction assignment to dense vectors*****************************************************
703  template< typename VT2 > // Type of the target dense vector
704  friend inline EnableIf_< UseAssign<VT2> >
705  subAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
706  {
708 
712 
713  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
714 
715  const ResultType tmp( serial( rhs ) );
716  subAssign( ~lhs, tmp );
717  }
719  //**********************************************************************************************
720 
721  //**Subtraction assignment to sparse vectors****************************************************
722  // No special implementation for the subtraction assignment to sparse vectors.
723  //**********************************************************************************************
724 
725  //**Multiplication assignment to dense vectors**************************************************
739  template< typename VT2 > // Type of the target dense vector
740  friend inline EnableIf_< UseAssign<VT2> >
741  multAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
742  {
744 
748 
749  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
750 
751  const ResultType tmp( serial( rhs ) );
752  multAssign( ~lhs, tmp );
753  }
755  //**********************************************************************************************
756 
757  //**Multiplication assignment to sparse vectors*************************************************
758  // No special implementation for the multiplication assignment to sparse vectors.
759  //**********************************************************************************************
760 
761  //**Division assignment to dense vectors********************************************************
775  template< typename VT2 > // Type of the target dense vector
776  friend inline EnableIf_< UseAssign<VT2> >
777  divAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
778  {
780 
784 
785  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
786 
787  const ResultType tmp( serial( rhs ) );
788  divAssign( ~lhs, tmp );
789  }
791  //**********************************************************************************************
792 
793  //**Division assignment to sparse vectors*******************************************************
794  // No special implementation for the division assignment to sparse vectors.
795  //**********************************************************************************************
796 
797  //**SMP assignment to dense vectors*************************************************************
811  template< typename VT2 > // Type of the target dense vector
812  friend inline EnableIf_< UseSMPAssign<VT2> >
814  {
816 
817  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
818 
819  smpAssign( ~lhs, rhs.vector_ );
820  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
821  }
823  //**********************************************************************************************
824 
825  //**SMP assignment to sparse vectors************************************************************
839  template< typename VT2 > // Type of the target sparse vector
840  friend inline EnableIf_< UseSMPAssign<VT2> >
842  {
844 
845  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
846 
847  smpAssign( ~lhs, rhs.vector_ );
848  (~lhs) /= rhs.scalar_;
849  }
851  //**********************************************************************************************
852 
853  //**SMP addition assignment to dense vectors****************************************************
867  template< typename VT2 > // Type of the target dense vector
868  friend inline EnableIf_< UseSMPAssign<VT2> >
870  {
872 
876 
877  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
878 
879  const ResultType tmp( rhs );
880  smpAddAssign( ~lhs, tmp );
881  }
883  //**********************************************************************************************
884 
885  //**SMP addition assignment to sparse vectors***************************************************
886  // No special implementation for the SMP addition assignment to sparse vectors.
887  //**********************************************************************************************
888 
889  //**SMP subtraction assignment to dense vectors*************************************************
903  template< typename VT2 > // Type of the target dense vector
904  friend inline EnableIf_< UseSMPAssign<VT2> >
906  {
908 
912 
913  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
914 
915  const ResultType tmp( rhs );
916  smpSubAssign( ~lhs, tmp );
917  }
919  //**********************************************************************************************
920 
921  //**SMP subtraction assignment to sparse vectors************************************************
922  // No special implementation for the SMP subtraction assignment to sparse vectors.
923  //**********************************************************************************************
924 
925  //**SMP multiplication assignment to dense vectors**********************************************
939  template< typename VT2 > // Type of the target dense vector
940  friend inline EnableIf_< UseSMPAssign<VT2> >
942  {
944 
948 
949  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
950 
951  const ResultType tmp( rhs );
952  smpMultAssign( ~lhs, tmp );
953  }
955  //**********************************************************************************************
956 
957  //**SMP multiplication assignment to sparse vectors*********************************************
958  // No special implementation for the SMP multiplication assignment to sparse vectors.
959  //**********************************************************************************************
960 
961  //**SMP division assignment to dense vectors****************************************************
975  template< typename VT2 > // Type of the target dense vector
976  friend inline EnableIf_< UseSMPAssign<VT2> >
978  {
980 
984 
985  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
986 
987  const ResultType tmp( rhs );
988  smpDivAssign( ~lhs, tmp );
989  }
991  //**********************************************************************************************
992 
993  //**SMP division assignment to sparse vectors***************************************************
994  // No special implementation for the SMP division assignment to sparse vectors.
995  //**********************************************************************************************
996 
997  //**Compile time checks*************************************************************************
1006  //**********************************************************************************************
1007 };
1008 //*************************************************************************************************
1009 
1010 
1011 
1012 
1013 //=================================================================================================
1014 //
1015 // GLOBAL BINARY ARITHMETIC OPERATORS
1016 //
1017 //=================================================================================================
1018 
1019 //*************************************************************************************************
1024 template< typename VT // Type of the left-hand side dense vector
1025  , typename ST // Type of the right-hand side scalar
1026  , bool TF > // Transpose flag
1027 struct DVecScalarDivExprHelper
1028 {
1029  private:
1030  //**********************************************************************************************
1034  , IsBuiltin<ST> >
1037  , ST >;
1038  //**********************************************************************************************
1039 
1040  public:
1041  //**********************************************************************************************
1042  using Type = If_< IsInvertible<ScalarType>
1045  //**********************************************************************************************
1046 };
1048 //*************************************************************************************************
1049 
1050 
1051 //*************************************************************************************************
1075 template< typename VT // Type of the left-hand side dense vector
1076  , typename ST // Type of the right-hand side scalar
1077  , bool TF // Transpose flag
1078  , typename = EnableIf_< IsNumeric<ST> > >
1079 inline decltype(auto) operator/( const DenseVector<VT,TF>& vec, ST scalar )
1080 {
1082 
1083  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
1084 
1085  using ReturnType = typename DVecScalarDivExprHelper<VT,ST,TF>::Type;
1086  using ScalarType = RightOperand_<ReturnType>;
1087 
1089  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
1090  }
1091  else {
1092  return ReturnType( ~vec, scalar );
1093  }
1094 }
1095 //*************************************************************************************************
1096 
1097 
1098 
1099 
1100 //=================================================================================================
1101 //
1102 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
1103 //
1104 //=================================================================================================
1105 
1106 //*************************************************************************************************
1119 template< typename VT // Type of the dense vector of the left-hand side expression
1120  , typename ST1 // Type of the scalar of the left-hand side expression
1121  , bool TF // Transpose flag of the dense vector
1122  , typename ST2 // Type of the right-hand side scalar
1124 inline decltype(auto) operator*( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1125 {
1127 
1128  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1129 }
1131 //*************************************************************************************************
1132 
1133 
1134 //*************************************************************************************************
1147 template< typename ST1 // Type of the left-hand side scalar
1148  , typename VT // Type of the dense vector of the right-hand side expression
1149  , typename ST2 // Type of the scalar of the right-hand side expression
1150  , bool TF // Transpose flag of the dense vector
1151  , typename = EnableIf_< And< IsNumeric<ST1>, Or< IsInvertible<ST1>, IsInvertible<ST2> > > > >
1152 inline decltype(auto) operator*( ST1 scalar, const DVecScalarDivExpr<VT,ST2,TF>& vec )
1153 {
1155 
1156  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1157 }
1159 //*************************************************************************************************
1160 
1161 
1162 //*************************************************************************************************
1175 template< typename VT // Type of the dense vector of the left-hand side expression
1176  , typename ST1 // Type of the scalar of the left-hand side expression
1177  , bool TF // Transpose flag of the dense vector
1178  , typename ST2 // Type of the right-hand side scalar
1179  , typename = EnableIf_< IsNumeric<ST2> > >
1180 inline decltype(auto) operator/( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1181 {
1183 
1184  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1185 
1186  using MultType = MultTrait_<ST1,ST2>;
1187  using ReturnType = typename DVecScalarDivExprHelper<VT,MultType,TF>::Type;
1188  using ScalarType = RightOperand_<ReturnType>;
1189 
1191  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
1192  }
1193  else {
1194  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
1195  }
1196 }
1198 //*************************************************************************************************
1199 
1200 
1201 
1202 
1203 //=================================================================================================
1204 //
1205 // SIZE SPECIALIZATIONS
1206 //
1207 //=================================================================================================
1208 
1209 //*************************************************************************************************
1211 template< typename VT, typename ST, bool TF >
1212 struct Size< DVecScalarDivExpr<VT,ST,TF>, 0UL >
1213  : public Size<VT,0UL>
1214 {};
1216 //*************************************************************************************************
1217 
1218 
1219 
1220 
1221 //=================================================================================================
1222 //
1223 // ISALIGNED SPECIALIZATIONS
1224 //
1225 //=================================================================================================
1226 
1227 //*************************************************************************************************
1229 template< typename VT, typename ST, bool TF >
1230 struct IsAligned< DVecScalarDivExpr<VT,ST,TF> >
1231  : public IsAligned<VT>
1232 {};
1234 //*************************************************************************************************
1235 
1236 
1237 
1238 
1239 //=================================================================================================
1240 //
1241 // ISPADDED SPECIALIZATIONS
1242 //
1243 //=================================================================================================
1244 
1245 //*************************************************************************************************
1247 template< typename VT, typename ST, bool TF >
1248 struct IsPadded< DVecScalarDivExpr<VT,ST,TF> >
1249  : public IsPadded<VT>
1250 {};
1252 //*************************************************************************************************
1253 
1254 } // namespace blaze
1255 
1256 #endif
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DVecScalarDivExpr.h:594
Header file for the UnderlyingNumeric type trait.
Pointer difference type of the Blaze library.
IfTrue_< useAssign, const ResultType, const DVecScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: DVecScalarDivExpr.h:177
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:576
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:71
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
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
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:69
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecScalarDivExpr.h:566
Header file for basic type definitions.
Compile time check whether the given type is a multiplication expression template.This type trait class tests whether or not the given type Type is a multiplication expression template (i.e. an expression representing an element-wise vector multiplication, a matrix/vector multiplication, a vector/matrix multiplication, or a matrix multiplication). In order to qualify as a valid multiplication expression template, the given type has to derive publicly from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:97
decltype(auto) operator/(const DenseMatrix< MT, SO > &mat, ST scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:1070
RightOperand scalar_
Scalar of the division expression.
Definition: DVecScalarDivExpr.h:424
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
Header file for the serial shim.
LeftOperand vector_
Left-hand side dense vector of the division expression.
Definition: DVecScalarDivExpr.h:593
ElementType * PointerType
Pointer return type.
Definition: DVecScalarDivExpr.h:195
Header file for the VecScalarDivExpr base class.
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarDivExpr.h:216
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarDivExpr.h:193
Header file for the And class template.
Header file for the DenseVector base class.
PointerType pointer
Pointer return type.
Definition: DVecScalarDivExpr.h:202
DVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the DVecScalarDivExpr class.
Definition: DVecScalarDivExpr.h:451
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
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:183
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecScalarDivExpr.h:251
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
ResultType_< VT > RT
Result type of the dense vector expression.
Definition: DVecScalarDivExpr.h:113
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
Header file for the DivExprTrait class template.
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarDivExpr.h:404
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarDivExpr.h:262
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecScalarDivExpr.h:532
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:71
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ReturnType_< VT > RN
Return type of the dense vector expression.
Definition: DVecScalarDivExpr.h:114
Header file for the IsTemporary type trait class.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecScalarDivExpr.h:170
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:463
Header file for the UnderlyingBuiltin type trait.
Header file for the IsMultExpr type trait class.
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Header file for the Or class template.
Iterator over the elements of the dense vector.
Definition: DVecScalarDivExpr.h:189
#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:380
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
ReferenceType reference
Reference return type.
Definition: DVecScalarDivExpr.h:203
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
Availability of a SIMD division for the given data types.Depending on the available instruction set (...
Definition: HasSIMDDiv.h:150
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:490
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
Header file for the IsAligned type trait.
Constraint on the data type.
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:194
Constraint on the data type.
Header file for the exception macros of the math module.
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:75
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarDivExpr.h:228
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:347
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarDivExpr.h:423
ConstIterator_< VT > IteratorType
ConstIterator type of the dense vector expression.
Definition: DVecScalarDivExpr.h:207
Constraint on the data type.
ElementType_< VT > ET
Element type of the dense vector expression.
Definition: DVecScalarDivExpr.h:115
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:325
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarDivExpr.h:129
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:292
Header file for the IsNumeric type trait.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecScalarDivExpr.h:522
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecScalarDivExpr.h:303
Header file for run time assertion macros.
Header file for the division trait.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:512
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:358
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:369
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:502
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarDivExpr.h:200
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
Constraint on the data type.
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DVecScalarDivExpr.h:542
#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:272
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
#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
If_< IsExpression< VT >, const VT, const VT &> LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecScalarDivExpr.h:180
Compile time check for built-in data types.This type trait tests whether or not the given template pa...
Definition: IsBuiltin.h:75
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:416
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsInvertible.h:82
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
#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:293
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
DivTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DVecScalarDivExpr.h:169
#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
CompositeType_< VT > CT
Composite type of the dense vector expression.
Definition: DVecScalarDivExpr.h:116
Expression object for divisions of a dense vector by a scalar.The DVecScalarDivExpr class represents ...
Definition: DVecScalarDivExpr.h:107
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
#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:240
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecScalarDivExpr.h:174
Header file for the HasSIMDDiv type trait.
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:392
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecScalarDivExpr.h:476
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
Expression object for dense vector-scalar multiplications.The DVecScalarMultExpr class represents the...
Definition: DVecScalarMultExpr.h:104
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecScalarDivExpr.h:554
typename DivExprTrait< T1, T2 >::Type DivExprTrait_
Auxiliary alias declaration for the DivExprTrait class template.The DivExprTrait_ alias declaration p...
Definition: DivExprTrait.h:112
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
Compile time logical &#39;or&#39; evaluation.The Or alias declaration performs at compile time a logical &#39;or&#39;...
Definition: Or.h:76
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarDivExpr.h:196
Header file for the IsComplex type trait.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarDivExpr.h:586
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarDivExpr.h:283
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:314
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:383
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
System settings for the inline keywords.
Header file for the Size type trait.
#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:336
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:95
ValueType value_type
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:201
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DVecScalarDivExpr.h:171