All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
50 #include <blaze/math/Intrinsics.h>
67 #include <blaze/util/Assert.h>
72 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/InvalidType.h>
75 #include <blaze/util/SelectType.h>
76 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS DVECSCALARDIVEXPR
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
97 template< typename VT // Type of the left-hand side dense vector
98  , typename ST // Type of the right-hand side scalar value
99  , bool TF > // Transpose flag
100 class DVecScalarDivExpr : public DenseVector< DVecScalarDivExpr<VT,ST,TF>, TF >
101  , private VecScalarDivExpr
102  , private Computation
103 {
104  private:
105  //**Type definitions****************************************************************************
106  typedef typename VT::ResultType RT;
107  typedef typename VT::ReturnType RN;
108  typedef typename VT::ElementType ET;
109  typedef typename VT::CompositeType CT;
110  //**********************************************************************************************
111 
112  //**Return type evaluation**********************************************************************
114 
119  enum { returnExpr = !IsTemporary<RN>::value };
120 
123  //**********************************************************************************************
124 
125  //**Serial evaluation strategy******************************************************************
127 
134 
136  template< typename VT2 >
138  struct UseAssign {
139  enum { value = useAssign };
140  };
142  //**********************************************************************************************
143 
144  //**Parallel evaluation strategy****************************************************************
146 
152  template< typename VT2 >
153  struct UseSMPAssign {
154  enum { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
155  };
157  //**********************************************************************************************
158 
159  public:
160  //**Type definitions****************************************************************************
166 
169 
172 
174  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
175 
177  typedef ST RightOperand;
178  //**********************************************************************************************
179 
180  //**ConstIterator class definition**************************************************************
184  {
185  public:
186  //**Type definitions*************************************************************************
187  typedef std::random_access_iterator_tag IteratorCategory;
192 
193  // STL iterator requirements
199 
201  typedef typename VT::ConstIterator IteratorType;
202  //*******************************************************************************************
203 
204  //**Constructor******************************************************************************
210  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
211  : iterator_( iterator ) // Iterator to the current element
212  , scalar_ ( scalar ) // Scalar of the division expression
213  {}
214  //*******************************************************************************************
215 
216  //**Addition assignment operator*************************************************************
222  inline ConstIterator& operator+=( size_t inc ) {
223  iterator_ += inc;
224  return *this;
225  }
226  //*******************************************************************************************
227 
228  //**Subtraction assignment operator**********************************************************
234  inline ConstIterator& operator-=( size_t dec ) {
235  iterator_ -= dec;
236  return *this;
237  }
238  //*******************************************************************************************
239 
240  //**Prefix increment operator****************************************************************
246  ++iterator_;
247  return *this;
248  }
249  //*******************************************************************************************
250 
251  //**Postfix increment operator***************************************************************
256  inline const ConstIterator operator++( int ) {
257  return ConstIterator( iterator_++ );
258  }
259  //*******************************************************************************************
260 
261  //**Prefix decrement operator****************************************************************
267  --iterator_;
268  return *this;
269  }
270  //*******************************************************************************************
271 
272  //**Postfix decrement operator***************************************************************
277  inline const ConstIterator operator--( int ) {
278  return ConstIterator( iterator_-- );
279  }
280  //*******************************************************************************************
281 
282  //**Element access operator******************************************************************
287  inline ReturnType operator*() const {
288  return *iterator_ / scalar_;
289  }
290  //*******************************************************************************************
291 
292  //**Load function****************************************************************************
297  inline IntrinsicType load() const {
298  return iterator_.load() / set( scalar_ );
299  }
300  //*******************************************************************************************
301 
302  //**Equality operator************************************************************************
308  inline bool operator==( const ConstIterator& rhs ) const {
309  return iterator_ == rhs.iterator_;
310  }
311  //*******************************************************************************************
312 
313  //**Inequality operator**********************************************************************
319  inline bool operator!=( const ConstIterator& rhs ) const {
320  return iterator_ != rhs.iterator_;
321  }
322  //*******************************************************************************************
323 
324  //**Less-than operator***********************************************************************
330  inline bool operator<( const ConstIterator& rhs ) const {
331  return iterator_ < rhs.iterator_;
332  }
333  //*******************************************************************************************
334 
335  //**Greater-than operator********************************************************************
341  inline bool operator>( const ConstIterator& rhs ) const {
342  return iterator_ > rhs.iterator_;
343  }
344  //*******************************************************************************************
345 
346  //**Less-or-equal-than operator**************************************************************
352  inline bool operator<=( const ConstIterator& rhs ) const {
353  return iterator_ <= rhs.iterator_;
354  }
355  //*******************************************************************************************
356 
357  //**Greater-or-equal-than operator***********************************************************
363  inline bool operator>=( const ConstIterator& rhs ) const {
364  return iterator_ >= rhs.iterator_;
365  }
366  //*******************************************************************************************
367 
368  //**Subtraction operator*********************************************************************
374  inline DifferenceType operator-( const ConstIterator& rhs ) const {
375  return iterator_ - rhs.iterator_;
376  }
377  //*******************************************************************************************
378 
379  //**Addition operator************************************************************************
386  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
387  return ConstIterator( it.iterator_ + inc );
388  }
389  //*******************************************************************************************
390 
391  //**Addition operator************************************************************************
398  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
399  return ConstIterator( it.iterator_ + inc );
400  }
401  //*******************************************************************************************
402 
403  //**Subtraction operator*********************************************************************
410  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
411  return ConstIterator( it.iterator_ - dec );
412  }
413  //*******************************************************************************************
414 
415  private:
416  //**Member variables*************************************************************************
419  //*******************************************************************************************
420  };
421  //**********************************************************************************************
422 
423  //**Compilation flags***************************************************************************
425  enum { vectorizable = VT::vectorizable &&
428 
430  enum { smpAssignable = VT::smpAssignable };
431  //**********************************************************************************************
432 
433  //**Constructor*********************************************************************************
439  explicit inline DVecScalarDivExpr( const VT& vector, ST scalar )
440  : vector_( vector ) // Left-hand side dense vector of the division expression
441  , scalar_( scalar ) // Right-hand side scalar of the division expression
442  {}
443  //**********************************************************************************************
444 
445  //**Subscript operator**************************************************************************
451  inline ReturnType operator[]( size_t index ) const {
452  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
453  return vector_[index] / scalar_;
454  }
455  //**********************************************************************************************
456 
457  //**Load function*******************************************************************************
463  inline IntrinsicType load( size_t index ) const {
464  typedef IntrinsicTrait<ElementType> IT;
465  BLAZE_INTERNAL_ASSERT( index < vector_.size() , "Invalid vector access index" );
466  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
467  const IntrinsicType xmm1( vector_.load( index ) );
468  const IntrinsicType xmm2( set( scalar_ ) );
469  return xmm1 / xmm2;
470  }
471  //**********************************************************************************************
472 
473  //**Begin function******************************************************************************
478  inline ConstIterator begin() const {
479  return ConstIterator( vector_.begin(), scalar_ );
480  }
481  //**********************************************************************************************
482 
483  //**End function********************************************************************************
488  inline ConstIterator end() const {
489  return ConstIterator( vector_.end(), scalar_ );
490  }
491  //**********************************************************************************************
492 
493  //**Size function*******************************************************************************
498  inline size_t size() const {
499  return vector_.size();
500  }
501  //**********************************************************************************************
502 
503  //**Left operand access*************************************************************************
508  inline LeftOperand leftOperand() const {
509  return vector_;
510  }
511  //**********************************************************************************************
512 
513  //**Right operand access************************************************************************
518  inline RightOperand rightOperand() const {
519  return scalar_;
520  }
521  //**********************************************************************************************
522 
523  //**********************************************************************************************
529  template< typename T >
530  inline bool canAlias( const T* alias ) const {
531  return IsComputation<VT>::value && vector_.canAlias( alias );
532  }
533  //**********************************************************************************************
534 
535  //**********************************************************************************************
541  template< typename T >
542  inline bool isAliased( const T* alias ) const {
543  return vector_.isAliased( alias );
544  }
545  //**********************************************************************************************
546 
547  //**********************************************************************************************
552  inline bool isAligned() const {
553  return vector_.isAligned();
554  }
555  //**********************************************************************************************
556 
557  //**********************************************************************************************
562  inline bool canSMPAssign() const {
563  return vector_.canSMPAssign() || ( size() > SMP_DVECSCALARMULT_THRESHOLD );
564  }
565  //**********************************************************************************************
566 
567  private:
568  //**Member variables****************************************************************************
571  //**********************************************************************************************
572 
573  //**Assignment to dense vectors*****************************************************************
587  template< typename VT2 > // Type of the target dense vector
588  friend inline typename EnableIf< UseAssign<VT2> >::Type
589  assign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
590  {
592 
593  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
594 
595  assign( ~lhs, rhs.vector_ );
596  assign( ~lhs, (~lhs) / rhs.scalar_ );
597  }
599  //**********************************************************************************************
600 
601  //**Assignment to sparse vectors****************************************************************
615  template< typename VT2 > // Type of the target sparse vector
616  friend inline typename EnableIf< UseAssign<VT2> >::Type
617  assign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
618  {
620 
621  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
622 
623  assign( ~lhs, rhs.vector_ );
624  (~lhs) /= rhs.scalar_;
625  }
627  //**********************************************************************************************
628 
629  //**Addition assignment to dense vectors********************************************************
643  template< typename VT2 > // Type of the target dense vector
644  friend inline typename EnableIf< UseAssign<VT2> >::Type
645  addAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
646  {
648 
652 
653  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
654 
655  const ResultType tmp( serial( rhs ) );
656  addAssign( ~lhs, tmp );
657  }
659  //**********************************************************************************************
660 
661  //**Addition assignment to sparse vectors*******************************************************
662  // No special implementation for the addition assignment to sparse vectors.
663  //**********************************************************************************************
664 
665  //**Subtraction assignment to dense vectors*****************************************************
679  template< typename VT2 > // Type of the target dense vector
680  friend inline typename EnableIf< UseAssign<VT2> >::Type
681  subAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
682  {
684 
688 
689  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
690 
691  const ResultType tmp( serial( rhs ) );
692  subAssign( ~lhs, tmp );
693  }
695  //**********************************************************************************************
696 
697  //**Subtraction assignment to sparse vectors****************************************************
698  // No special implementation for the subtraction assignment to sparse vectors.
699  //**********************************************************************************************
700 
701  //**Multiplication assignment to dense vectors**************************************************
715  template< typename VT2 > // Type of the target dense vector
716  friend inline typename EnableIf< UseAssign<VT2> >::Type
717  multAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
718  {
720 
724 
725  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
726 
727  const ResultType tmp( serial( rhs ) );
728  multAssign( ~lhs, tmp );
729  }
731  //**********************************************************************************************
732 
733  //**Multiplication assignment to sparse vectors*************************************************
734  // No special implementation for the multiplication assignment to sparse vectors.
735  //**********************************************************************************************
736 
737  //**SMP assignment to dense vectors*************************************************************
751  template< typename VT2 > // Type of the target dense vector
752  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
753  smpAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
754  {
756 
757  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
758 
759  smpAssign( ~lhs, rhs.vector_ );
760  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
761  }
763  //**********************************************************************************************
764 
765  //**SMP assignment to sparse vectors************************************************************
779  template< typename VT2 > // Type of the target sparse vector
780  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
781  smpAssign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
782  {
784 
785  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
786 
787  smpAssign( ~lhs, rhs.vector_ );
788  (~lhs) /= rhs.scalar_;
789  }
791  //**********************************************************************************************
792 
793  //**SMP addition assignment to dense vectors****************************************************
807  template< typename VT2 > // Type of the target dense vector
808  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
809  smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
810  {
812 
816 
817  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
818 
819  const ResultType tmp( rhs );
820  smpAddAssign( ~lhs, tmp );
821  }
823  //**********************************************************************************************
824 
825  //**SMP addition assignment to sparse vectors***************************************************
826  // No special implementation for the SMP addition assignment to sparse vectors.
827  //**********************************************************************************************
828 
829  //**SMP subtraction assignment to dense vectors*************************************************
843  template< typename VT2 > // Type of the target dense vector
844  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
845  smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
846  {
848 
852 
853  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
854 
855  const ResultType tmp( rhs );
856  smpSubAssign( ~lhs, tmp );
857  }
859  //**********************************************************************************************
860 
861  //**SMP subtraction assignment to sparse vectors************************************************
862  // No special implementation for the SMP subtraction assignment to sparse vectors.
863  //**********************************************************************************************
864 
865  //**SMP multiplication assignment to dense vectors**********************************************
879  template< typename VT2 > // Type of the target dense vector
880  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
881  smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
882  {
884 
888 
889  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
890 
891  const ResultType tmp( rhs );
892  smpMultAssign( ~lhs, tmp );
893  }
895  //**********************************************************************************************
896 
897  //**SMP multiplication assignment to sparse vectors*********************************************
898  // No special implementation for the SMP multiplication assignment to sparse vectors.
899  //**********************************************************************************************
900 
901  //**Compile time checks*************************************************************************
910  //**********************************************************************************************
911 };
912 //*************************************************************************************************
913 
914 
915 
916 
917 //=================================================================================================
918 //
919 // GLOBAL BINARY ARITHMETIC OPERATORS
920 //
921 //=================================================================================================
922 
923 //*************************************************************************************************
947 template< typename T1 // Type of the left-hand side dense vector
948  , typename T2 // Type of the right-hand side scalar
949  , bool TF > // Transpose flag
950 inline const typename EnableIf< IsNumeric<T2>, typename DivExprTrait<T1,T2>::Type >::Type
951  operator/( const DenseVector<T1,TF>& vec, T2 scalar )
952 {
954 
955  BLAZE_USER_ASSERT( scalar != T2(0), "Division by zero detected" );
956 
957  typedef typename DivExprTrait<T1,T2>::Type ReturnType;
958  typedef typename ReturnType::RightOperand ScalarType;
959 
961  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
962  }
963  else {
964  return ReturnType( ~vec, scalar );
965  }
966 }
967 //*************************************************************************************************
968 
969 
970 
971 
972 //=================================================================================================
973 //
974 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
975 //
976 //=================================================================================================
977 
978 //*************************************************************************************************
991 template< typename VT // Type of the dense vector of the left-hand side expression
992  , typename ST1 // Type of the scalar of the left-hand side expression
993  , bool TF // Transpose flag of the dense vector
994  , typename ST2 > // Type of the right-hand side scalar
995 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST2,ST1>::Type >
996  , typename MultExprTrait< DVecScalarDivExpr<VT,ST1,TF>, ST2 >::Type >::Type
997  operator*( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
998 {
1000 
1001  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1002 }
1004 //*************************************************************************************************
1005 
1006 
1007 //*************************************************************************************************
1020 template< typename ST1 // Type of the left-hand side scalar
1021  , typename VT // Type of the dense vector of the right-hand side expression
1022  , typename ST2 // Type of the scalar of the right-hand side expression
1023  , bool TF > // Transpose flag of the dense vector
1024 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST1,ST2>::Type >
1025  , typename MultExprTrait< ST1, DVecScalarDivExpr<VT,ST2,TF> >::Type >::Type
1026  operator*( ST1 scalar, const DVecScalarDivExpr<VT,ST2,TF>& vec )
1027 {
1029 
1030  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1031 }
1033 //*************************************************************************************************
1034 
1035 
1036 //*************************************************************************************************
1049 template< typename VT // Type of the dense vector of the left-hand side expression
1050  , typename ST1 // Type of the scalar of the left-hand side expression
1051  , bool TF // Transpose flag of the dense vector
1052  , typename ST2 > // Type of the right-hand side scalar
1053 inline const typename EnableIf< IsNumeric<ST2>
1054  , typename DivExprTrait<VT,typename MultTrait<ST1,ST2>::Type>::Type >::Type
1055  operator/( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1056 {
1058 
1059  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1060 
1061  typedef typename MultTrait<ST1,ST2>::Type MultType;
1062  typedef typename DivExprTrait<VT,MultType>::Type ReturnType;
1063  typedef typename ReturnType::RightOperand ScalarType;
1064 
1065  if( IsMultExpr<ReturnType>::value ) {
1066  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
1067  }
1068  else {
1069  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
1070  }
1071 }
1073 //*************************************************************************************************
1074 
1075 
1076 
1077 
1078 //=================================================================================================
1079 //
1080 // DVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1081 //
1082 //=================================================================================================
1083 
1084 //*************************************************************************************************
1086 template< typename VT, typename ST1, typename ST2 >
1087 struct DVecScalarMultExprTrait< DVecScalarDivExpr<VT,ST1,false>, ST2 >
1088 {
1089  private:
1090  //**********************************************************************************************
1091  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1092  //**********************************************************************************************
1093 
1094  //**********************************************************************************************
1095  typedef typename DVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1096  typedef DVecScalarMultExpr< DVecScalarDivExpr<VT,ST1,false>, ST2, false > T2;
1097  //**********************************************************************************************
1098 
1099  public:
1100  //**********************************************************************************************
1101  typedef typename SelectType< IsDenseVector<VT>::value && IsColumnVector<VT>::value &&
1102  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1103  , typename SelectType<condition,T1,T2>::Type
1104  , INVALID_TYPE >::Type Type;
1105  //**********************************************************************************************
1106 };
1108 //*************************************************************************************************
1109 
1110 
1111 
1112 
1113 //=================================================================================================
1114 //
1115 // TDVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1116 //
1117 //=================================================================================================
1118 
1119 //*************************************************************************************************
1121 template< typename VT, typename ST1, typename ST2 >
1122 struct TDVecScalarMultExprTrait< DVecScalarDivExpr<VT,ST1,true>, ST2 >
1123 {
1124  private:
1125  //**********************************************************************************************
1126  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1127  //**********************************************************************************************
1128 
1129  //**********************************************************************************************
1130  typedef typename DVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1131  typedef DVecScalarMultExpr< DVecScalarDivExpr<VT,ST1,true>, ST2, true > T2;
1132  //**********************************************************************************************
1133 
1134  public:
1135  //**********************************************************************************************
1136  typedef typename SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value &&
1137  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1138  , typename SelectType<condition,T1,T2>::Type
1139  , INVALID_TYPE >::Type Type;
1140  //**********************************************************************************************
1141 };
1143 //*************************************************************************************************
1144 
1145 
1146 
1147 
1148 //=================================================================================================
1149 //
1150 // SUBVECTOREXPRTRAIT SPECIALIZATIONS
1151 //
1152 //=================================================================================================
1153 
1154 //*************************************************************************************************
1156 template< typename VT, typename ST, bool TF, bool AF >
1157 struct SubvectorExprTrait< DVecScalarDivExpr<VT,ST,TF>, AF >
1158 {
1159  public:
1160  //**********************************************************************************************
1161  typedef typename DivExprTrait< typename SubvectorExprTrait<const VT,AF>::Type, ST >::Type Type;
1162  //**********************************************************************************************
1163 };
1165 //*************************************************************************************************
1166 
1167 } // namespace blaze
1168 
1169 #endif
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DVecScalarDivExpr.h:570
Pointer difference type of the Blaze library.
Data type constraint.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
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:87
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecScalarDivExpr.h:163
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4329
const EnableIf< IsNumeric< T2 >, typename DivExprTrait< T1, T2 >::Type >::Type operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:930
VT::ReturnType RN
Return type of the dense vector expression.
Definition: DVecScalarDivExpr.h:107
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 or privately) from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:90
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:488
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarDivExpr.h:190
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecScalarDivExpr.h:530
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
RightOperand scalar_
Scalar of the division expression.
Definition: DVecScalarDivExpr.h:418
LeftOperand vector_
Left-hand side dense vector of the division expression.
Definition: DVecScalarDivExpr.h:569
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
void smpMultAssign(DenseVector< 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:179
Header file for the IsSame and IsStrictlySame type traits.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Header file for the IsRowVector type trait.
Header file for the VecScalarDivExpr base class.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecScalarDivExpr.h:191
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarDivExpr.h:210
Header file for the DenseVector base class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:158
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:65
DivTrait< RT, ST >::Type ResultType
Result type for expression template evaluations.
Definition: DVecScalarDivExpr.h:162
RightOperand rightOperand() const
Returns the right-hand side scalar operand.
Definition: DVecScalarDivExpr.h:518
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:308
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecScalarDivExpr.h:245
Constraint on the data type.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarDivExpr.h:187
Header file for the DivExprTrait class template.
Evaluation of the resulting expression type of a division.Via this type trait it is possible to evalu...
Definition: DivExprTrait.h:87
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarDivExpr.h:398
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:352
DifferenceType difference_type
Difference between two iterators.
Definition: DVecScalarDivExpr.h:198
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarDivExpr.h:256
Header file for the MultExprTrait class template.
void smpAddAssign(DenseMatrix< 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:122
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:253
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecScalarDivExpr.h:552
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
VT::ConstIterator IteratorType
ConstIterator type of the dense vector expression.
Definition: DVecScalarDivExpr.h:201
Header file for the IsFloatingPoint type trait.
Header file for the IsMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
Iterator over the elements of the dense vector.
Definition: DVecScalarDivExpr.h:183
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecScalarDivExpr.h:164
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:188
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:271
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#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:89
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DVecScalarDivExpr.h:177
Constraint on the data type.
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecScalarDivExpr.h:498
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecScalarDivExpr.h:451
VT::CompositeType CT
Composite type of the dense vector expression.
Definition: DVecScalarDivExpr.h:109
Constraint on the data type.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarDivExpr.h:222
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecScalarDivExpr.h:542
void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:361
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarDivExpr.h:562
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarDivExpr.h:417
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
ValueType value_type
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:195
Header file for the EnableIf class template.
Header file for the serial shim.
Header file for the BaseElementType type trait.
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
Header file for the IsNumeric type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecScalarDivExpr.h:508
PointerType pointer
Pointer return type.
Definition: DVecScalarDivExpr.h:196
Header file for run time assertion macros.
Utility type for generic codes.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:478
DVecScalarDivExpr< VT, ST, TF > This
Type of this DVecScalarDivExpr instance.
Definition: DVecScalarDivExpr.h:161
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:363
Header file for the division trait.
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:301
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Constraint on the data type.
#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:79
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecScalarDivExpr.h:266
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarDivExpr.h:194
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:331
VT::ElementType ET
Element type of the dense vector expression.
Definition: DVecScalarDivExpr.h:108
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:410
const size_t SMP_DVECSCALARMULT_THRESHOLD
SMP dense vector/scalar multiplication/division threshold.This threshold specifies when a dense vecto...
Definition: Thresholds.h:299
IntrinsicType load(size_t index) const
Access to the intrinsic elements of the vector.
Definition: DVecScalarDivExpr.h:463
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecScalarDivExpr.h:165
Base template for the DivTrait class.
Definition: DivTrait.h:141
Header file for the IsDenseVector type trait.
#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:118
Header file for all intrinsic functionality.
Expression object for divisions of a dense vector by a scalar.The DVecScalarDivExpr class represents ...
Definition: DVecScalarDivExpr.h:100
#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:79
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecScalarDivExpr.h:234
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecScalarDivExpr.h:168
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:386
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecScalarDivExpr.h:287
Header file for the IsComputation type trait class.
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
IntrinsicType load() const
Access to the intrinsic elements of the vector.
Definition: DVecScalarDivExpr.h:297
ElementType * PointerType
Pointer return type.
Definition: DVecScalarDivExpr.h:189
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:319
Header file for basic type definitions.
Header file for the SubvectorExprTrait class template.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarDivExpr.h:277
DivExprTrait< RN, ST >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarDivExpr.h:122
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecScalarDivExpr.h:374
Header file for the IsColumnVector type trait.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:341
DVecScalarDivExpr(const VT &vector, ST scalar)
Constructor for the DVecScalarDivExpr class.
Definition: DVecScalarDivExpr.h:439
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecScalarDivExpr.h:174
#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:238
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:330
EnableIf< IsIntegral< T >, Set< T, sizeof(T)> >::Type::Type set(T value)
Sets all values in the vector to the given integral value.
Definition: Set.h:209
SelectType< useAssign, const ResultType, const DVecScalarDivExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecScalarDivExpr.h:171
Header file for the IsExpression type trait class.
VT::ResultType RT
Result type of the dense vector expression.
Definition: DVecScalarDivExpr.h:106
ReferenceType reference
Reference return type.
Definition: DVecScalarDivExpr.h:197
Header file for the FunctionTrace class.