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/system/Inline.h>
69 #include <blaze/util/Assert.h>
74 #include <blaze/util/EnableIf.h>
75 #include <blaze/util/InvalidType.h>
77 #include <blaze/util/SelectType.h>
78 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS DVECSCALARDIVEXPR
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< typename VT // Type of the left-hand side dense vector
100  , typename ST // Type of the right-hand side scalar value
101  , bool TF > // Transpose flag
102 class DVecScalarDivExpr : public DenseVector< DVecScalarDivExpr<VT,ST,TF>, TF >
103  , private VecScalarDivExpr
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
108  typedef typename VT::ResultType RT;
109  typedef typename VT::ReturnType RN;
110  typedef typename VT::ElementType ET;
111  typedef typename VT::CompositeType CT;
112  //**********************************************************************************************
113 
114  //**Return type evaluation**********************************************************************
116 
121  enum { returnExpr = !IsTemporary<RN>::value };
122 
125  //**********************************************************************************************
126 
127  //**Serial evaluation strategy******************************************************************
129 
136 
138  template< typename VT2 >
140  struct UseAssign {
141  enum { value = useAssign };
142  };
144  //**********************************************************************************************
145 
146  //**Parallel evaluation strategy****************************************************************
148 
154  template< typename VT2 >
155  struct UseSMPAssign {
156  enum { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
157  };
159  //**********************************************************************************************
160 
161  public:
162  //**Type definitions****************************************************************************
168 
171 
174 
176  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
177 
179  typedef ST RightOperand;
180  //**********************************************************************************************
181 
182  //**ConstIterator class definition**************************************************************
186  {
187  public:
188  //**Type definitions*************************************************************************
189  typedef std::random_access_iterator_tag IteratorCategory;
190  typedef ElementType ValueType;
191  typedef ElementType* PointerType;
192  typedef ElementType& ReferenceType;
194 
195  // STL iterator requirements
196  typedef IteratorCategory iterator_category;
197  typedef ValueType value_type;
198  typedef PointerType pointer;
199  typedef ReferenceType reference;
200  typedef DifferenceType difference_type;
201 
203  typedef typename VT::ConstIterator IteratorType;
204  //*******************************************************************************************
205 
206  //**Constructor******************************************************************************
212  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
213  : iterator_( iterator ) // Iterator to the current element
214  , scalar_ ( scalar ) // Scalar of the division expression
215  {}
216  //*******************************************************************************************
217 
218  //**Addition assignment operator*************************************************************
224  inline ConstIterator& operator+=( size_t inc ) {
225  iterator_ += inc;
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Subtraction assignment operator**********************************************************
236  inline ConstIterator& operator-=( size_t dec ) {
237  iterator_ -= dec;
238  return *this;
239  }
240  //*******************************************************************************************
241 
242  //**Prefix increment operator****************************************************************
248  ++iterator_;
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Postfix increment operator***************************************************************
258  inline const ConstIterator operator++( int ) {
259  return ConstIterator( iterator_++ );
260  }
261  //*******************************************************************************************
262 
263  //**Prefix decrement operator****************************************************************
269  --iterator_;
270  return *this;
271  }
272  //*******************************************************************************************
273 
274  //**Postfix decrement operator***************************************************************
279  inline const ConstIterator operator--( int ) {
280  return ConstIterator( iterator_-- );
281  }
282  //*******************************************************************************************
283 
284  //**Element access operator******************************************************************
289  inline ReturnType operator*() const {
290  return *iterator_ / scalar_;
291  }
292  //*******************************************************************************************
293 
294  //**Load function****************************************************************************
299  inline IntrinsicType load() const {
300  return iterator_.load() / set( scalar_ );
301  }
302  //*******************************************************************************************
303 
304  //**Equality operator************************************************************************
310  inline bool operator==( const ConstIterator& rhs ) const {
311  return iterator_ == rhs.iterator_;
312  }
313  //*******************************************************************************************
314 
315  //**Inequality operator**********************************************************************
321  inline bool operator!=( const ConstIterator& rhs ) const {
322  return iterator_ != rhs.iterator_;
323  }
324  //*******************************************************************************************
325 
326  //**Less-than operator***********************************************************************
332  inline bool operator<( const ConstIterator& rhs ) const {
333  return iterator_ < rhs.iterator_;
334  }
335  //*******************************************************************************************
336 
337  //**Greater-than operator********************************************************************
343  inline bool operator>( const ConstIterator& rhs ) const {
344  return iterator_ > rhs.iterator_;
345  }
346  //*******************************************************************************************
347 
348  //**Less-or-equal-than operator**************************************************************
354  inline bool operator<=( const ConstIterator& rhs ) const {
355  return iterator_ <= rhs.iterator_;
356  }
357  //*******************************************************************************************
358 
359  //**Greater-or-equal-than operator***********************************************************
365  inline bool operator>=( const ConstIterator& rhs ) const {
366  return iterator_ >= rhs.iterator_;
367  }
368  //*******************************************************************************************
369 
370  //**Subtraction operator*********************************************************************
376  inline DifferenceType operator-( const ConstIterator& rhs ) const {
377  return iterator_ - rhs.iterator_;
378  }
379  //*******************************************************************************************
380 
381  //**Addition operator************************************************************************
388  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
389  return ConstIterator( it.iterator_ + inc );
390  }
391  //*******************************************************************************************
392 
393  //**Addition operator************************************************************************
400  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
401  return ConstIterator( it.iterator_ + inc );
402  }
403  //*******************************************************************************************
404 
405  //**Subtraction operator*********************************************************************
412  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
413  return ConstIterator( it.iterator_ - dec );
414  }
415  //*******************************************************************************************
416 
417  private:
418  //**Member variables*************************************************************************
419  IteratorType iterator_;
420  RightOperand scalar_;
421  //*******************************************************************************************
422  };
423  //**********************************************************************************************
424 
425  //**Compilation flags***************************************************************************
427  enum { vectorizable = VT::vectorizable &&
430 
432  enum { smpAssignable = VT::smpAssignable };
433  //**********************************************************************************************
434 
435  //**Constructor*********************************************************************************
441  explicit inline DVecScalarDivExpr( const VT& vector, ST scalar )
442  : vector_( vector ) // Left-hand side dense vector of the division expression
443  , scalar_( scalar ) // Right-hand side scalar of the division expression
444  {}
445  //**********************************************************************************************
446 
447  //**Subscript operator**************************************************************************
453  inline ReturnType operator[]( size_t index ) const {
454  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
455  return vector_[index] / scalar_;
456  }
457  //**********************************************************************************************
458 
459  //**Load function*******************************************************************************
465  BLAZE_ALWAYS_INLINE IntrinsicType load( size_t index ) const {
466  typedef IntrinsicTrait<ElementType> IT;
467  BLAZE_INTERNAL_ASSERT( index < vector_.size() , "Invalid vector access index" );
468  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
469  const IntrinsicType xmm1( vector_.load( index ) );
470  const IntrinsicType xmm2( set( scalar_ ) );
471  return xmm1 / xmm2;
472  }
473  //**********************************************************************************************
474 
475  //**Begin function******************************************************************************
480  inline ConstIterator begin() const {
481  return ConstIterator( vector_.begin(), scalar_ );
482  }
483  //**********************************************************************************************
484 
485  //**End function********************************************************************************
490  inline ConstIterator end() const {
491  return ConstIterator( vector_.end(), scalar_ );
492  }
493  //**********************************************************************************************
494 
495  //**Size function*******************************************************************************
500  inline size_t size() const {
501  return vector_.size();
502  }
503  //**********************************************************************************************
504 
505  //**Left operand access*************************************************************************
510  inline LeftOperand leftOperand() const {
511  return vector_;
512  }
513  //**********************************************************************************************
514 
515  //**Right operand access************************************************************************
520  inline RightOperand rightOperand() const {
521  return scalar_;
522  }
523  //**********************************************************************************************
524 
525  //**********************************************************************************************
531  template< typename T >
532  inline bool canAlias( const T* alias ) const {
533  return IsComputation<VT>::value && vector_.canAlias( alias );
534  }
535  //**********************************************************************************************
536 
537  //**********************************************************************************************
543  template< typename T >
544  inline bool isAliased( const T* alias ) const {
545  return vector_.isAliased( alias );
546  }
547  //**********************************************************************************************
548 
549  //**********************************************************************************************
554  inline bool isAligned() const {
555  return vector_.isAligned();
556  }
557  //**********************************************************************************************
558 
559  //**********************************************************************************************
564  inline bool canSMPAssign() const {
565  return vector_.canSMPAssign() || ( size() > SMP_DVECSCALARMULT_THRESHOLD );
566  }
567  //**********************************************************************************************
568 
569  private:
570  //**Member variables****************************************************************************
571  LeftOperand vector_;
572  RightOperand scalar_;
573  //**********************************************************************************************
574 
575  //**Assignment to dense vectors*****************************************************************
589  template< typename VT2 > // Type of the target dense vector
590  friend inline typename EnableIf< UseAssign<VT2> >::Type
591  assign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
592  {
594 
595  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
596 
597  assign( ~lhs, rhs.vector_ );
598  assign( ~lhs, (~lhs) / rhs.scalar_ );
599  }
601  //**********************************************************************************************
602 
603  //**Assignment to sparse vectors****************************************************************
617  template< typename VT2 > // Type of the target sparse vector
618  friend inline typename EnableIf< UseAssign<VT2> >::Type
619  assign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
620  {
622 
623  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
624 
625  assign( ~lhs, rhs.vector_ );
626  (~lhs) /= rhs.scalar_;
627  }
629  //**********************************************************************************************
630 
631  //**Addition assignment to dense vectors********************************************************
645  template< typename VT2 > // Type of the target dense vector
646  friend inline typename EnableIf< UseAssign<VT2> >::Type
647  addAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
648  {
650 
654 
655  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
656 
657  const ResultType tmp( serial( rhs ) );
658  addAssign( ~lhs, tmp );
659  }
661  //**********************************************************************************************
662 
663  //**Addition assignment to sparse vectors*******************************************************
664  // No special implementation for the addition assignment to sparse vectors.
665  //**********************************************************************************************
666 
667  //**Subtraction assignment to dense vectors*****************************************************
681  template< typename VT2 > // Type of the target dense vector
682  friend inline typename EnableIf< UseAssign<VT2> >::Type
683  subAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
684  {
686 
690 
691  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
692 
693  const ResultType tmp( serial( rhs ) );
694  subAssign( ~lhs, tmp );
695  }
697  //**********************************************************************************************
698 
699  //**Subtraction assignment to sparse vectors****************************************************
700  // No special implementation for the subtraction assignment to sparse vectors.
701  //**********************************************************************************************
702 
703  //**Multiplication assignment to dense vectors**************************************************
717  template< typename VT2 > // Type of the target dense vector
718  friend inline typename EnableIf< UseAssign<VT2> >::Type
719  multAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
720  {
722 
726 
727  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
728 
729  const ResultType tmp( serial( rhs ) );
730  multAssign( ~lhs, tmp );
731  }
733  //**********************************************************************************************
734 
735  //**Multiplication assignment to sparse vectors*************************************************
736  // No special implementation for the multiplication assignment to sparse vectors.
737  //**********************************************************************************************
738 
739  //**SMP assignment to dense vectors*************************************************************
753  template< typename VT2 > // Type of the target dense vector
754  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
755  smpAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
756  {
758 
759  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
760 
761  smpAssign( ~lhs, rhs.vector_ );
762  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
763  }
765  //**********************************************************************************************
766 
767  //**SMP assignment to sparse vectors************************************************************
781  template< typename VT2 > // Type of the target sparse vector
782  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
783  smpAssign( SparseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
784  {
786 
787  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
788 
789  smpAssign( ~lhs, rhs.vector_ );
790  (~lhs) /= rhs.scalar_;
791  }
793  //**********************************************************************************************
794 
795  //**SMP addition assignment to dense vectors****************************************************
809  template< typename VT2 > // Type of the target dense vector
810  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
811  smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
812  {
814 
818 
819  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
820 
821  const ResultType tmp( rhs );
822  smpAddAssign( ~lhs, tmp );
823  }
825  //**********************************************************************************************
826 
827  //**SMP addition assignment to sparse vectors***************************************************
828  // No special implementation for the SMP addition assignment to sparse vectors.
829  //**********************************************************************************************
830 
831  //**SMP subtraction assignment to dense vectors*************************************************
845  template< typename VT2 > // Type of the target dense vector
846  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
847  smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
848  {
850 
854 
855  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
856 
857  const ResultType tmp( rhs );
858  smpSubAssign( ~lhs, tmp );
859  }
861  //**********************************************************************************************
862 
863  //**SMP subtraction assignment to sparse vectors************************************************
864  // No special implementation for the SMP subtraction assignment to sparse vectors.
865  //**********************************************************************************************
866 
867  //**SMP multiplication assignment to dense vectors**********************************************
881  template< typename VT2 > // Type of the target dense vector
882  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
883  smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecScalarDivExpr& rhs )
884  {
886 
890 
891  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
892 
893  const ResultType tmp( rhs );
894  smpMultAssign( ~lhs, tmp );
895  }
897  //**********************************************************************************************
898 
899  //**SMP multiplication assignment to sparse vectors*********************************************
900  // No special implementation for the SMP multiplication assignment to sparse vectors.
901  //**********************************************************************************************
902 
903  //**Compile time checks*************************************************************************
910  BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ST, RightOperand );
912  //**********************************************************************************************
913 };
914 //*************************************************************************************************
915 
916 
917 
918 
919 //=================================================================================================
920 //
921 // GLOBAL BINARY ARITHMETIC OPERATORS
922 //
923 //=================================================================================================
924 
925 //*************************************************************************************************
949 template< typename T1 // Type of the left-hand side dense vector
950  , typename T2 // Type of the right-hand side scalar
951  , bool TF > // Transpose flag
952 inline const typename EnableIf< IsNumeric<T2>, typename DivExprTrait<T1,T2>::Type >::Type
953  operator/( const DenseVector<T1,TF>& vec, T2 scalar )
954 {
956 
957  BLAZE_USER_ASSERT( scalar != T2(0), "Division by zero detected" );
958 
959  typedef typename DivExprTrait<T1,T2>::Type ReturnType;
960  typedef typename ReturnType::RightOperand ScalarType;
961 
963  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
964  }
965  else {
966  return ReturnType( ~vec, scalar );
967  }
968 }
969 //*************************************************************************************************
970 
971 
972 
973 
974 //=================================================================================================
975 //
976 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
977 //
978 //=================================================================================================
979 
980 //*************************************************************************************************
993 template< typename VT // Type of the dense vector of the left-hand side expression
994  , typename ST1 // Type of the scalar of the left-hand side expression
995  , bool TF // Transpose flag of the dense vector
996  , typename ST2 > // Type of the right-hand side scalar
997 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST2,ST1>::Type >
998  , typename MultExprTrait< DVecScalarDivExpr<VT,ST1,TF>, ST2 >::Type >::Type
999  operator*( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1000 {
1002 
1003  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1004 }
1006 //*************************************************************************************************
1007 
1008 
1009 //*************************************************************************************************
1022 template< typename ST1 // Type of the left-hand side scalar
1023  , typename VT // Type of the dense vector of the right-hand side expression
1024  , typename ST2 // Type of the scalar of the right-hand side expression
1025  , bool TF > // Transpose flag of the dense vector
1026 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST1,ST2>::Type >
1027  , typename MultExprTrait< ST1, DVecScalarDivExpr<VT,ST2,TF> >::Type >::Type
1028  operator*( ST1 scalar, const DVecScalarDivExpr<VT,ST2,TF>& vec )
1029 {
1031 
1032  return vec.leftOperand() * ( scalar / vec.rightOperand() );
1033 }
1035 //*************************************************************************************************
1036 
1037 
1038 //*************************************************************************************************
1051 template< typename VT // Type of the dense vector of the left-hand side expression
1052  , typename ST1 // Type of the scalar of the left-hand side expression
1053  , bool TF // Transpose flag of the dense vector
1054  , typename ST2 > // Type of the right-hand side scalar
1055 inline const typename EnableIf< IsNumeric<ST2>
1056  , typename DivExprTrait<VT,typename MultTrait<ST1,ST2>::Type>::Type >::Type
1057  operator/( const DVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1058 {
1060 
1061  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1062 
1063  typedef typename MultTrait<ST1,ST2>::Type MultType;
1064  typedef typename DivExprTrait<VT,MultType>::Type ReturnType;
1065  typedef typename ReturnType::RightOperand ScalarType;
1066 
1067  if( IsMultExpr<ReturnType>::value ) {
1068  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
1069  }
1070  else {
1071  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
1072  }
1073 }
1075 //*************************************************************************************************
1076 
1077 
1078 
1079 
1080 //=================================================================================================
1081 //
1082 // SIZE SPECIALIZATIONS
1083 //
1084 //=================================================================================================
1085 
1086 //*************************************************************************************************
1088 template< typename VT, typename ST, bool TF >
1089 struct Size< DVecScalarDivExpr<VT,ST,TF> >
1090  : public Size<VT>
1091 {};
1093 //*************************************************************************************************
1094 
1095 
1096 
1097 
1098 //=================================================================================================
1099 //
1100 // DVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1101 //
1102 //=================================================================================================
1103 
1104 //*************************************************************************************************
1106 template< typename VT, typename ST1, typename ST2 >
1107 struct DVecScalarMultExprTrait< DVecScalarDivExpr<VT,ST1,false>, ST2 >
1108 {
1109  private:
1110  //**********************************************************************************************
1111  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1112  //**********************************************************************************************
1113 
1114  //**********************************************************************************************
1115  typedef typename DVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1116  typedef DVecScalarMultExpr< DVecScalarDivExpr<VT,ST1,false>, ST2, false > T2;
1117  //**********************************************************************************************
1118 
1119  public:
1120  //**********************************************************************************************
1121  typedef typename SelectType< IsDenseVector<VT>::value && IsColumnVector<VT>::value &&
1122  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1123  , typename SelectType<condition,T1,T2>::Type
1124  , INVALID_TYPE >::Type Type;
1125  //**********************************************************************************************
1126 };
1128 //*************************************************************************************************
1129 
1130 
1131 
1132 
1133 //=================================================================================================
1134 //
1135 // TDVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
1136 //
1137 //=================================================================================================
1138 
1139 //*************************************************************************************************
1141 template< typename VT, typename ST1, typename ST2 >
1142 struct TDVecScalarMultExprTrait< DVecScalarDivExpr<VT,ST1,true>, ST2 >
1143 {
1144  private:
1145  //**********************************************************************************************
1146  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1147  //**********************************************************************************************
1148 
1149  //**********************************************************************************************
1150  typedef typename DVecScalarMultExprTrait<VT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1151  typedef DVecScalarMultExpr< DVecScalarDivExpr<VT,ST1,true>, ST2, true > T2;
1152  //**********************************************************************************************
1153 
1154  public:
1155  //**********************************************************************************************
1156  typedef typename SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value &&
1157  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1158  , typename SelectType<condition,T1,T2>::Type
1159  , INVALID_TYPE >::Type Type;
1160  //**********************************************************************************************
1161 };
1163 //*************************************************************************************************
1164 
1165 
1166 
1167 
1168 //=================================================================================================
1169 //
1170 // SUBVECTOREXPRTRAIT SPECIALIZATIONS
1171 //
1172 //=================================================================================================
1173 
1174 //*************************************************************************************************
1176 template< typename VT, typename ST, bool TF, bool AF >
1177 struct SubvectorExprTrait< DVecScalarDivExpr<VT,ST,TF>, AF >
1178 {
1179  public:
1180  //**********************************************************************************************
1181  typedef typename DivExprTrait< typename SubvectorExprTrait<const VT,AF>::Type, ST >::Type Type;
1182  //**********************************************************************************************
1183 };
1185 //*************************************************************************************************
1186 
1187 } // namespace blaze
1188 
1189 #endif
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DVecScalarDivExpr.h:572
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.
BLAZE_ALWAYS_INLINE 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:879
#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:165
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:8247
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:939
Header file for basic type definitions.
VT::ReturnType RN
Return type of the dense vector expression.
Definition: DVecScalarDivExpr.h:109
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:490
ElementType & ReferenceType
Reference return type.
Definition: DVecScalarDivExpr.h:192
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecScalarDivExpr.h:532
RightOperand scalar_
Scalar of the division expression.
Definition: DVecScalarDivExpr.h:420
LeftOperand vector_
Left-hand side dense vector of the division expression.
Definition: DVecScalarDivExpr.h:571
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
Header file for the IsSame and IsStrictlySame type traits.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
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:261
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecScalarDivExpr.h:193
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DVecScalarDivExpr.h:212
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:699
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:164
RightOperand rightOperand() const
Returns the right-hand side scalar operand.
Definition: DVecScalarDivExpr.h:520
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:310
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecScalarDivExpr.h:247
Constraint on the data type.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecScalarDivExpr.h:189
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:88
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecScalarDivExpr.h:400
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:354
DifferenceType difference_type
Difference between two iterators.
Definition: DVecScalarDivExpr.h:200
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecScalarDivExpr.h:258
Header file for the MultExprTrait class template.
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:263
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecScalarDivExpr.h:554
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:203
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
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:2511
Iterator over the elements of the dense vector.
Definition: DVecScalarDivExpr.h:185
BLAZE_ALWAYS_INLINE 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:635
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecScalarDivExpr.h:166
ElementType ValueType
Type of the underlying elements.
Definition: DVecScalarDivExpr.h:190
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:179
Constraint on the data type.
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecScalarDivExpr.h:500
#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:453
VT::CompositeType CT
Composite type of the dense vector expression.
Definition: DVecScalarDivExpr.h:111
Constraint on the data type.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecScalarDivExpr.h:224
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecScalarDivExpr.h:544
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecScalarDivExpr.h:564
IteratorType iterator_
Iterator to the current element.
Definition: DVecScalarDivExpr.h:419
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:197
Header file for the EnableIf class template.
Header file for the serial shim.
Header file for the BaseElementType type trait.
Header file for the IsNumeric type trait.
EnableIf< IsDenseMatrix< MT1 > >::Type 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:160
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecScalarDivExpr.h:510
PointerType pointer
Pointer return type.
Definition: DVecScalarDivExpr.h:198
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type 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:98
Utility type for generic codes.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecScalarDivExpr.h:480
DVecScalarDivExpr< VT, ST, TF > This
Type of this DVecScalarDivExpr instance.
Definition: DVecScalarDivExpr.h:163
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:365
BLAZE_ALWAYS_INLINE 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:742
Header file for the division trait.
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:268
IteratorCategory iterator_category
The iterator category.
Definition: DVecScalarDivExpr.h:196
VT::ElementType ET
Element type of the dense vector expression.
Definition: DVecScalarDivExpr.h:110
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:412
const size_t SMP_DVECSCALARMULT_THRESHOLD
SMP dense vector/scalar multiplication/division threshold.This threshold specifies when a dense vecto...
Definition: Thresholds.h:299
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecScalarDivExpr.h:167
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Access to the intrinsic elements of the vector.
Definition: DVecScalarDivExpr.h:465
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
Base template for the DivTrait class.
Definition: DivTrait.h:150
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:102
#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:236
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecScalarDivExpr.h:170
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecScalarDivExpr.h:388
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecScalarDivExpr.h:289
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
EnableIf< IsDenseMatrix< MT1 > >::Type 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:129
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:2502
IntrinsicType load() const
Access to the intrinsic elements of the vector.
Definition: DVecScalarDivExpr.h:299
ElementType * PointerType
Pointer return type.
Definition: DVecScalarDivExpr.h:191
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:321
Header file for the SubvectorExprTrait class template.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecScalarDivExpr.h:279
DivExprTrait< RN, ST >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecScalarDivExpr.h:124
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecScalarDivExpr.h:376
Header file for the IsColumnVector type trait.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecScalarDivExpr.h:343
DVecScalarDivExpr(const VT &vector, ST scalar)
Constructor for the DVecScalarDivExpr class.
Definition: DVecScalarDivExpr.h:441
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecScalarDivExpr.h:176
System settings for the inline keywords.
EnableIf< IsDenseVector< VT1 > >::Type 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:189
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: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:332
SelectType< useAssign, const ResultType, const DVecScalarDivExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecScalarDivExpr.h:173
Header file for the IsExpression type trait class.
VT::ResultType RT
Result type of the dense vector expression.
Definition: DVecScalarDivExpr.h:108
ReferenceType reference
Reference return type.
Definition: DVecScalarDivExpr.h:199
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE 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:849