DVecAbsExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECABSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECABSEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <cmath>
44 #include <iterator>
51 #include <blaze/math/Intrinsics.h>
67 #include <blaze/system/Inline.h>
68 #include <blaze/util/Assert.h>
70 #include <blaze/util/EnableIf.h>
71 #include <blaze/util/Exception.h>
72 #include <blaze/util/InvalidType.h>
74 #include <blaze/util/SelectType.h>
75 #include <blaze/util/Types.h>
77 
78 
79 namespace blaze {
80 
81 //=================================================================================================
82 //
83 // CLASS DVECABSEXPR
84 //
85 //=================================================================================================
86 
87 //*************************************************************************************************
94 template< typename VT // Type of the dense vector
95  , bool TF > // Transpose flag
96 class DVecAbsExpr : public DenseVector< DVecAbsExpr<VT,TF>, TF >
97  , private VecAbsExpr
98  , private Computation
99 {
100  private:
101  //**Type definitions****************************************************************************
102  typedef typename VT::ReturnType RN;
103  typedef typename VT::ElementType ET;
104  //**********************************************************************************************
105 
106  //**Return type evaluation**********************************************************************
108 
113  enum { returnExpr = !IsTemporary<RN>::value };
114 
117  //**********************************************************************************************
118 
119  //**Serial evaluation strategy******************************************************************
121 
127  enum { useAssign = RequiresEvaluation<VT>::value };
128 
130  template< typename VT2 >
132  struct UseAssign {
133  enum { value = useAssign };
134  };
136  //**********************************************************************************************
137 
138  //**Parallel evaluation strategy****************************************************************
140 
146  template< typename VT2 >
147  struct UseSMPAssign {
148  enum { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
149  };
151  //**********************************************************************************************
152 
153  public:
154  //**Type definitions****************************************************************************
156  typedef typename VT::ResultType ResultType;
157  typedef typename VT::TransposeType TransposeType;
158  typedef typename VT::ElementType ElementType;
160 
163 
166 
168  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type Operand;
169  //**********************************************************************************************
170 
171  //**ConstIterator class definition**************************************************************
175  {
176  public:
177  //**Type definitions*************************************************************************
178  typedef std::random_access_iterator_tag IteratorCategory;
179  typedef ElementType ValueType;
180  typedef ElementType* PointerType;
181  typedef ElementType& ReferenceType;
183 
184  // STL iterator requirements
185  typedef IteratorCategory iterator_category;
186  typedef ValueType value_type;
187  typedef PointerType pointer;
188  typedef ReferenceType reference;
189  typedef DifferenceType difference_type;
190 
192  typedef typename VT::ConstIterator IteratorType;
193  //*******************************************************************************************
194 
195  //**Constructor******************************************************************************
200  explicit inline ConstIterator( IteratorType it )
201  : it_( it ) // Iterator to the current vector element
202  {}
203  //*******************************************************************************************
204 
205  //**Addition assignment operator*************************************************************
211  inline ConstIterator& operator+=( size_t inc ) {
212  it_ += inc;
213  return *this;
214  }
215  //*******************************************************************************************
216 
217  //**Subtraction assignment operator**********************************************************
223  inline ConstIterator& operator-=( size_t dec ) {
224  it_ -= dec;
225  return *this;
226  }
227  //*******************************************************************************************
228 
229  //**Prefix increment operator****************************************************************
235  ++it_;
236  return *this;
237  }
238  //*******************************************************************************************
239 
240  //**Postfix increment operator***************************************************************
245  inline const ConstIterator operator++( int ) {
246  return ConstIterator( it_++ );
247  }
248  //*******************************************************************************************
249 
250  //**Prefix decrement operator****************************************************************
256  --it_;
257  return *this;
258  }
259  //*******************************************************************************************
260 
261  //**Postfix decrement operator***************************************************************
266  inline const ConstIterator operator--( int ) {
267  return ConstIterator( it_-- );
268  }
269  //*******************************************************************************************
270 
271  //**Element access operator******************************************************************
276  inline ReturnType operator*() const {
277  using std::abs;
278  return abs( *it_ );
279  }
280  //*******************************************************************************************
281 
282  //**Load function****************************************************************************
287  inline IntrinsicType load() const {
288  return abs( it_.load() );
289  }
290  //*******************************************************************************************
291 
292  //**Equality operator************************************************************************
298  inline bool operator==( const ConstIterator& rhs ) const {
299  return it_ == rhs.it_;
300  }
301  //*******************************************************************************************
302 
303  //**Inequality operator**********************************************************************
309  inline bool operator!=( const ConstIterator& rhs ) const {
310  return it_ != rhs.it_;
311  }
312  //*******************************************************************************************
313 
314  //**Less-than operator***********************************************************************
320  inline bool operator<( const ConstIterator& rhs ) const {
321  return it_ < rhs.it_;
322  }
323  //*******************************************************************************************
324 
325  //**Greater-than operator********************************************************************
331  inline bool operator>( const ConstIterator& rhs ) const {
332  return it_ > rhs.it_;
333  }
334  //*******************************************************************************************
335 
336  //**Less-or-equal-than operator**************************************************************
342  inline bool operator<=( const ConstIterator& rhs ) const {
343  return it_ <= rhs.it_;
344  }
345  //*******************************************************************************************
346 
347  //**Greater-or-equal-than operator***********************************************************
353  inline bool operator>=( const ConstIterator& rhs ) const {
354  return it_ >= rhs.it_;
355  }
356  //*******************************************************************************************
357 
358  //**Subtraction operator*********************************************************************
364  inline DifferenceType operator-( const ConstIterator& rhs ) const {
365  return it_ - rhs.it_;
366  }
367  //*******************************************************************************************
368 
369  //**Addition operator************************************************************************
376  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
377  return ConstIterator( it.it_ + inc );
378  }
379  //*******************************************************************************************
380 
381  //**Addition operator************************************************************************
388  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
389  return ConstIterator( it.it_ + inc );
390  }
391  //*******************************************************************************************
392 
393  //**Subtraction operator*********************************************************************
400  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
401  return ConstIterator( it.it_ - dec );
402  }
403  //*******************************************************************************************
404 
405  private:
406  //**Member variables*************************************************************************
407  IteratorType it_;
408  //*******************************************************************************************
409  };
410  //**********************************************************************************************
411 
412  //**Compilation flags***************************************************************************
414  enum { vectorizable = VT::vectorizable &&
416 
418  enum { smpAssignable = VT::smpAssignable };
419  //**********************************************************************************************
420 
421  //**Constructor*********************************************************************************
426  explicit inline DVecAbsExpr( const VT& dv )
427  : dv_( dv ) // Dense vector of the absolute value expression
428  {}
429  //**********************************************************************************************
430 
431  //**Subscript operator**************************************************************************
437  inline ReturnType operator[]( size_t index ) const {
438  using std::abs;
439  BLAZE_INTERNAL_ASSERT( index < dv_.size(), "Invalid vector access index" );
440  return abs( dv_[index] );
441  }
442  //**********************************************************************************************
443 
444  //**At function*********************************************************************************
451  inline ReturnType at( size_t index ) const {
452  if( index >= dv_.size() ) {
453  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
454  }
455  return (*this)[index];
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 < dv_.size() , "Invalid vector access index" );
468  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
469  return abs( dv_.load( index ) );
470  }
471  //**********************************************************************************************
472 
473  //**Begin function******************************************************************************
478  inline ConstIterator begin() const {
479  return ConstIterator( dv_.begin() );
480  }
481  //**********************************************************************************************
482 
483  //**End function********************************************************************************
488  inline ConstIterator end() const {
489  return ConstIterator( dv_.end() );
490  }
491  //**********************************************************************************************
492 
493  //**Size function*******************************************************************************
498  inline size_t size() const {
499  return dv_.size();
500  }
501  //**********************************************************************************************
502 
503  //**Operand access******************************************************************************
508  inline Operand operand() const {
509  return dv_;
510  }
511  //**********************************************************************************************
512 
513  //**********************************************************************************************
519  template< typename T >
520  inline bool canAlias( const T* alias ) const {
521  return IsComputation<VT>::value && dv_.canAlias( alias );
522  }
523  //**********************************************************************************************
524 
525  //**********************************************************************************************
531  template< typename T >
532  inline bool isAliased( const T* alias ) const {
533  return dv_.isAliased( alias );
534  }
535  //**********************************************************************************************
536 
537  //**********************************************************************************************
542  inline bool isAligned() const {
543  return dv_.isAligned();
544  }
545  //**********************************************************************************************
546 
547  //**********************************************************************************************
552  inline bool canSMPAssign() const {
553  return dv_.canSMPAssign();
554  }
555  //**********************************************************************************************
556 
557  private:
558  //**Member variables****************************************************************************
559  Operand dv_;
560  //**********************************************************************************************
561 
562  //**Assignment to dense vectors*****************************************************************
576  template< typename VT2 > // Type of the target dense vector
577  friend inline typename EnableIf< UseAssign<VT2> >::Type
578  assign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
579  {
581 
582  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
583 
584  assign( ~lhs, rhs.dv_ );
585  assign( ~lhs, abs( ~lhs ) );
586  }
588  //**********************************************************************************************
589 
590  //**Assignment to sparse vectors****************************************************************
604  template< typename VT2 > // Type of the target sparse vector
605  friend inline typename EnableIf< UseAssign<VT2> >::Type
606  assign( SparseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
607  {
609 
613 
614  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
615 
616  const ResultType tmp( serial( rhs ) );
617  assign( ~lhs, tmp );
618  }
620  //**********************************************************************************************
621 
622  //**Addition assignment to dense vectors********************************************************
636  template< typename VT2 > // Type of the target dense vector
637  friend inline typename EnableIf< UseAssign<VT2> >::Type
638  addAssign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
639  {
641 
645 
646  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
647 
648  const ResultType tmp( serial( rhs ) );
649  addAssign( ~lhs, tmp );
650  }
652  //**********************************************************************************************
653 
654  //**Addition assignment to sparse vectors*******************************************************
655  // No special implementation for the addition assignment to sparse vectors.
656  //**********************************************************************************************
657 
658  //**Subtraction assignment to dense vectors*****************************************************
672  template< typename VT2 > // Type of the target dense vector
673  friend inline typename EnableIf< UseAssign<VT2> >::Type
674  subAssign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
675  {
677 
681 
682  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
683 
684  const ResultType tmp( serial( rhs ) );
685  subAssign( ~lhs, tmp );
686  }
688  //**********************************************************************************************
689 
690  //**Subtraction assignment to sparse vectors****************************************************
691  // No special implementation for the subtraction assignment to sparse vectors.
692  //**********************************************************************************************
693 
694  //**Multiplication assignment to dense vectors**************************************************
708  template< typename VT2 > // Type of the target dense vector
709  friend inline typename EnableIf< UseAssign<VT2> >::Type
710  multAssign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
711  {
713 
717 
718  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
719 
720  const ResultType tmp( serial( rhs ) );
721  multAssign( ~lhs, tmp );
722  }
724  //**********************************************************************************************
725 
726  //**Multiplication assignment to sparse vectors*************************************************
727  // No special implementation for the multiplication assignment to sparse vectors.
728  //**********************************************************************************************
729 
730  //**SMP assignment to dense vectors*************************************************************
744  template< typename VT2 > // Type of the target dense vector
745  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
746  smpAssign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
747  {
749 
750  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
751 
752  smpAssign( ~lhs, rhs.dv_ );
753  smpAssign( ~lhs, abs( ~lhs ) );
754  }
756  //**********************************************************************************************
757 
758  //**SMP assignment to sparse vectors************************************************************
772  template< typename VT2 > // Type of the target sparse vector
773  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
774  smpAssign( SparseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
775  {
777 
781 
782  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
783 
784  const ResultType tmp( rhs );
785  smpAssign( ~lhs, tmp );
786  }
788  //**********************************************************************************************
789 
790  //**SMP addition assignment to dense vectors****************************************************
804  template< typename VT2 > // Type of the target dense vector
805  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
806  smpAddAssign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
807  {
809 
813 
814  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
815 
816  const ResultType tmp( rhs );
817  smpAddAssign( ~lhs, tmp );
818  }
820  //**********************************************************************************************
821 
822  //**SMP addition assignment to sparse vectors***************************************************
823  // No special implementation for the SMP addition assignment to sparse vectors.
824  //**********************************************************************************************
825 
826  //**SMP subtraction assignment to dense vectors*************************************************
840  template< typename VT2 > // Type of the target dense vector
841  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
842  smpSubAssign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
843  {
845 
849 
850  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
851 
852  const ResultType tmp( rhs );
853  smpSubAssign( ~lhs, tmp );
854  }
856  //**********************************************************************************************
857 
858  //**SMP subtraction assignment to sparse vectors************************************************
859  // No special implementation for the SMP subtraction assignment to sparse vectors.
860  //**********************************************************************************************
861 
862  //**SMP multiplication assignment to dense vectors**********************************************
876  template< typename VT2 > // Type of the target dense vector
877  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
878  smpMultAssign( DenseVector<VT2,TF>& lhs, const DVecAbsExpr& rhs )
879  {
881 
885 
886  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
887 
888  const ResultType tmp( rhs );
889  smpMultAssign( ~lhs, tmp );
890  }
892  //**********************************************************************************************
893 
894  //**SMP multiplication assignment to sparse vectors*********************************************
895  // No special implementation for the SMP multiplication assignment to sparse vectors.
896  //**********************************************************************************************
897 
898  //**Compile time checks*************************************************************************
903  //**********************************************************************************************
904 };
905 //*************************************************************************************************
906 
907 
908 
909 
910 //=================================================================================================
911 //
912 // GLOBAL FUNCTIONS
913 //
914 //=================================================================================================
915 
916 //*************************************************************************************************
933 template< typename VT // Type of the dense vector
934  , bool TF > // Transpose flag
935 inline const DVecAbsExpr<VT,TF> abs( const DenseVector<VT,TF>& dv )
936 {
938 
939  return DVecAbsExpr<VT,TF>( ~dv );
940 }
941 //*************************************************************************************************
942 
943 
944 
945 
946 //=================================================================================================
947 //
948 // GLOBAL RESTRUCTURING FUNCTIONS
949 //
950 //=================================================================================================
951 
952 //*************************************************************************************************
963 template< typename VT // Type of the dense vector
964  , bool TF > // Transpose flag
965 inline const DVecAbsExpr<VT,TF>& abs( const DVecAbsExpr<VT,TF>& dv )
966 {
968 
969  return dv;
970 }
972 //*************************************************************************************************
973 
974 
975 
976 
977 //=================================================================================================
978 //
979 // SIZE SPECIALIZATIONS
980 //
981 //=================================================================================================
982 
983 //*************************************************************************************************
985 template< typename VT, bool TF >
986 struct Size< DVecAbsExpr<VT,TF> > : public Size<VT>
987 {};
989 //*************************************************************************************************
990 
991 
992 
993 
994 //=================================================================================================
995 //
996 // ISALIGNED SPECIALIZATIONS
997 //
998 //=================================================================================================
999 
1000 //*************************************************************************************************
1002 template< typename VT, bool TF >
1003 struct IsAligned< DVecAbsExpr<VT,TF> > : public IsTrue< IsAligned<VT>::value >
1004 {};
1006 //*************************************************************************************************
1007 
1008 
1009 
1010 
1011 //=================================================================================================
1012 //
1013 // ISPADDED SPECIALIZATIONS
1014 //
1015 //=================================================================================================
1016 
1017 //*************************************************************************************************
1019 template< typename VT, bool TF >
1020 struct IsPadded< DVecAbsExpr<VT,TF> > : public IsTrue< IsPadded<VT>::value >
1021 {};
1023 //*************************************************************************************************
1024 
1025 
1026 
1027 
1028 //=================================================================================================
1029 //
1030 // EXPRESSION TRAIT SPECIALIZATIONS
1031 //
1032 //=================================================================================================
1033 
1034 //*************************************************************************************************
1036 template< typename VT >
1037 struct DVecAbsExprTrait< DVecAbsExpr<VT,false> >
1038 {
1039  public:
1040  //**********************************************************************************************
1041  typedef typename SelectType< IsDenseVector<VT>::value && IsColumnVector<VT>::value
1042  , DVecAbsExpr<VT,false>
1043  , INVALID_TYPE >::Type Type;
1044  //**********************************************************************************************
1045 };
1047 //*************************************************************************************************
1048 
1049 
1050 //*************************************************************************************************
1052 template< typename VT >
1053 struct TDVecAbsExprTrait< DVecAbsExpr<VT,true> >
1054 {
1055  public:
1056  //**********************************************************************************************
1057  typedef typename SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value
1058  , DVecAbsExpr<VT,true>
1059  , INVALID_TYPE >::Type Type;
1060  //**********************************************************************************************
1061 };
1063 //*************************************************************************************************
1064 
1065 
1066 //*************************************************************************************************
1068 template< typename VT, bool TF, bool AF >
1069 struct SubvectorExprTrait< DVecAbsExpr<VT,TF>, AF >
1070 {
1071  public:
1072  //**********************************************************************************************
1073  typedef typename AbsExprTrait< typename SubvectorExprTrait<const VT,AF>::Type >::Type Type;
1074  //**********************************************************************************************
1075 };
1077 //*************************************************************************************************
1078 
1079 } // namespace blaze
1080 
1081 #endif
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecAbsExpr.h:478
Pointer difference type of the Blaze library.
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Access to the intrinsic elements of the vector.
Definition: DVecAbsExpr.h:465
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
DVecAbsExpr(const VT &dv)
Constructor for the DVecAbsExpr class.
Definition: DVecAbsExpr.h:426
VT::ResultType ResultType
Result type for expression template evaluations.
Definition: DVecAbsExpr.h:156
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
Header file for the IsRowVector type trait.
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecAbsExpr.h:388
Header file for the DenseVector base class.
const DMatAbsExpr< MT, SO > abs(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the absolute values of each single element of dm.
Definition: DMatAbsExpr.h:938
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecAbsExpr.h:376
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecAbsExpr.h:437
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecAbsExpr.h:178
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecAbsExpr.h:520
Header file for the Computation base class.
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecAbsExpr.h:266
Expression object for the dense vector abs() function.The DVecAbsExpr class represents the compile ti...
Definition: DVecAbsExpr.h:96
Header file for the RequiresEvaluation type trait.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecAbsExpr.h:488
Header file for the TDVecAbsExprTrait class template.
Constraint on the data type.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecAbsExpr.h:298
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:261
DifferenceType difference_type
Difference between two iterators.
Definition: DVecAbsExpr.h:189
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecAbsExpr.h:498
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.
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
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecAbsExpr.h:400
IteratorType it_
Iterator to the current vector element.
Definition: DVecAbsExpr.h:407
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecAbsExpr.h:451
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecAbsExpr.h:320
Header file for the DVecAbsExprTrait class template.
SelectType< useAssign, const ResultType, const DVecAbsExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DVecAbsExpr.h:165
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Header file for the IsAligned type trait.
Header file for the VecAbsExpr base class.
Constraint on the data type.
#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
IntrinsicType load() const
Access to the intrinsic elements of the vector.
Definition: DVecAbsExpr.h:287
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
Constraint on the data type.
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type Operand
Composite data type of the dense vector expression.
Definition: DVecAbsExpr.h:168
Base class for all vector absolute value expression templates.The VecAbsExpr class serves as a tag fo...
Definition: VecAbsExpr.h:65
IteratorCategory iterator_category
The iterator category.
Definition: DVecAbsExpr.h:185
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
Header file for the serial shim.
Operand dv_
Dense vector of the absolute value expression.
Definition: DVecAbsExpr.h:559
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecAbsExpr.h:353
ReferenceType reference
Reference return type.
Definition: DVecAbsExpr.h:188
ElementType * PointerType
Pointer return type.
Definition: DVecAbsExpr.h:180
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:2587
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
IntrinsicTrait< ET >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DVecAbsExpr.h:159
Header file for run time assertion macros.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecAbsExpr.h:223
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
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecAbsExpr.h:211
Utility type for generic codes.
DVecAbsExpr< VT, TF > This
Type of this DVecAbsExpr instance.
Definition: DVecAbsExpr.h:155
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DVecAbsExpr.h:552
VT::ElementType ElementType
Resulting element type.
Definition: DVecAbsExpr.h:158
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecAbsExpr.h:532
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecAbsExpr.h:331
ValueType value_type
Type of the underlying elements.
Definition: DVecAbsExpr.h:186
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecAbsExpr.h:309
ElementType ValueType
Type of the underlying elements.
Definition: DVecAbsExpr.h:179
ConstIterator & operator++()
Pre-increment operator.
Definition: DVecAbsExpr.h:234
VT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecAbsExpr.h:157
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: DVecAbsExpr.h:200
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecAbsExpr.h:276
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DVecAbsExpr.h:542
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecAbsExpr.h:182
Header file for the IsDenseVector type trait.
Header file for all intrinsic functionality.
#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
PointerType pointer
Pointer return type.
Definition: DVecAbsExpr.h:187
Iterator over the elements of the dense vector.
Definition: DVecAbsExpr.h:174
Header file for the IsComputation type trait class.
Operand operand() const
Returns the dense vector operand.
Definition: DVecAbsExpr.h:508
AbsExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecAbsExpr.h:116
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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecAbsExpr.h:364
const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecAbsExpr.h:245
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#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:2583
Header file for the IsTrue value trait.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecAbsExpr.h:162
Header file for the SubvectorExprTrait class template.
ElementType & ReferenceType
Reference return type.
Definition: DVecAbsExpr.h:181
ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecAbsExpr.h:255
Header file for exception macros.
Header file for the AbsExprTrait class template.
Header file for the IsColumnVector type trait.
Evaluation of the return type of an absolute value expression.Via this type trait it is possible to e...
Definition: AbsExprTrait.h:88
VT::ConstIterator IteratorType
ConstIterator type of the left-hand side dense vector expression.
Definition: DVecAbsExpr.h:192
const DVecAbsExpr< VT, TF > abs(const DenseVector< VT, TF > &dv)
Returns a vector containing the absolute values of each single element of dv.
Definition: DVecAbsExpr.h:935
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecAbsExpr.h:342
VT::ReturnType RN
Return type of the dense vector expression.
Definition: DVecAbsExpr.h:102
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:81
#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
VT::ElementType ET
Element type of the dense vector expression.
Definition: DVecAbsExpr.h:103
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.