SVecAbsExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECABSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECABSEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <cmath>
44 #include <iterator>
66 #include <blaze/util/Assert.h>
68 #include <blaze/util/EnableIf.h>
69 #include <blaze/util/InvalidType.h>
71 #include <blaze/util/SelectType.h>
72 #include <blaze/util/Types.h>
74 
75 
76 namespace blaze {
77 
78 //=================================================================================================
79 //
80 // CLASS SVECABSEXPR
81 //
82 //=================================================================================================
83 
84 //*************************************************************************************************
91 template< typename VT // Type of the sparse vector
92  , bool TF > // Transpose flag
93 class SVecAbsExpr : public SparseVector< SVecAbsExpr<VT,TF>, TF >
94  , private VecAbsExpr
95  , private Computation
96 {
97  private:
98  //**Type definitions****************************************************************************
99  typedef typename VT::ResultType RT;
100  typedef typename VT::ReturnType RN;
101  typedef typename VT::CompositeType CT;
102  typedef typename VT::TransposeType TT;
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 RT ResultType;
157  typedef TT TransposeType;
158  typedef ET ElementType;
159 
162 
165 
167  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type Operand;
168  //**********************************************************************************************
169 
170  //**Compilation flags***************************************************************************
172  enum { smpAssignable = VT::smpAssignable };
173  //**********************************************************************************************
174 
175  //**ConstIterator class definition**************************************************************
179  {
180  public:
181  //**Type definitions*************************************************************************
184 
187 
188  typedef std::forward_iterator_tag IteratorCategory;
189  typedef Element ValueType;
190  typedef ValueType* PointerType;
191  typedef ValueType& ReferenceType;
193 
194  // STL iterator requirements
195  typedef IteratorCategory iterator_category;
196  typedef ValueType value_type;
197  typedef PointerType pointer;
198  typedef ReferenceType reference;
199  typedef DifferenceType difference_type;
200  //*******************************************************************************************
201 
202  //**Constructor******************************************************************************
205  inline ConstIterator( IteratorType it )
206  : it_( it ) // Iterator over the elements of the sparse vector expression
207  {}
208  //*******************************************************************************************
209 
210  //**Prefix increment operator****************************************************************
216  ++it_;
217  return *this;
218  }
219  //*******************************************************************************************
220 
221  //**Element access operator******************************************************************
226  inline const Element operator*() const {
227  using std::abs;
228  return Element( abs( it_->value() ), it_->index() );
229  }
230  //*******************************************************************************************
231 
232  //**Element access operator******************************************************************
237  inline const ConstIterator* operator->() const {
238  return this;
239  }
240  //*******************************************************************************************
241 
242  //**Value function***************************************************************************
247  inline ReturnType value() const {
248  using std::abs;
249  return abs( it_->value() );
250  }
251  //*******************************************************************************************
252 
253  //**Index function***************************************************************************
258  inline size_t index() const {
259  return it_->index();
260  }
261  //*******************************************************************************************
262 
263  //**Equality operator************************************************************************
269  inline bool operator==( const ConstIterator& rhs ) const {
270  return it_ == rhs.it_;
271  }
272  //*******************************************************************************************
273 
274  //**Inequality operator**********************************************************************
280  inline bool operator!=( const ConstIterator& rhs ) const {
281  return it_ != rhs.it_;
282  }
283  //*******************************************************************************************
284 
285  //**Subtraction operator*********************************************************************
291  inline DifferenceType operator-( const ConstIterator& rhs ) const {
292  return it_ - rhs.it_;
293  }
294  //*******************************************************************************************
295 
296  private:
297  //**Member variables*************************************************************************
298  IteratorType it_;
299  //*******************************************************************************************
300  };
301  //**********************************************************************************************
302 
303  //**Constructor*********************************************************************************
308  explicit inline SVecAbsExpr( const VT& sv )
309  : sv_( sv ) // Sparse vector of the absolute value expression
310  {}
311  //**********************************************************************************************
312 
313  //**Subscript operator**************************************************************************
319  inline ReturnType operator[]( size_t index ) const {
320  using std::abs;
321  BLAZE_INTERNAL_ASSERT( index < sv_.size(), "Invalid vector access index" );
322  return abs( sv_[index] );
323  }
324  //**********************************************************************************************
325 
326  //**Begin function******************************************************************************
331  inline ConstIterator begin() const {
332  return ConstIterator( sv_.begin() );
333  }
334  //**********************************************************************************************
335 
336  //**End function********************************************************************************
341  inline ConstIterator end() const {
342  return ConstIterator( sv_.end() );
343  }
344  //**********************************************************************************************
345 
346  //**Size function*******************************************************************************
351  inline size_t size() const {
352  return sv_.size();
353  }
354  //**********************************************************************************************
355 
356  //**NonZeros function***************************************************************************
361  inline size_t nonZeros() const {
362  return sv_.nonZeros();
363  }
364  //**********************************************************************************************
365 
366  //**Find function*******************************************************************************
372  inline ConstIterator find( size_t index ) const {
374  return ConstIterator( sv_.find( index ) );
375  }
376  //**********************************************************************************************
377 
378  //**LowerBound function*************************************************************************
384  inline ConstIterator lowerBound( size_t index ) const {
386  return ConstIterator( sv_.lowerBound( index ) );
387  }
388  //**********************************************************************************************
389 
390  //**UpperBound function*************************************************************************
396  inline ConstIterator upperBound( size_t index ) const {
398  return ConstIterator( sv_.upperBound( index ) );
399  }
400  //**********************************************************************************************
401 
402  //**Operand access******************************************************************************
407  inline Operand operand() const {
408  return sv_;
409  }
410  //**********************************************************************************************
411 
412  //**********************************************************************************************
418  template< typename T >
419  inline bool canAlias( const T* alias ) const {
420  return sv_.canAlias( alias );
421  }
422  //**********************************************************************************************
423 
424  //**********************************************************************************************
430  template< typename T >
431  inline bool isAliased( const T* alias ) const {
432  return sv_.isAliased( alias );
433  }
434  //**********************************************************************************************
435 
436  //**********************************************************************************************
441  inline bool canSMPAssign() const {
442  return sv_.canSMPAssign();
443  }
444  //**********************************************************************************************
445 
446  private:
447  //**Member variables****************************************************************************
448  Operand sv_;
449  //**********************************************************************************************
450 
451  //**Assignment to dense vectors*****************************************************************
465  template< typename VT2 > // Type of the target dense vector
466  friend inline typename EnableIf< UseAssign<VT2> >::Type
467  assign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
468  {
470 
471  using std::abs;
472 
473  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
474 
475  assign( ~lhs, rhs.sv_ );
476  assign( ~lhs, abs( ~lhs ) );
477  }
479  //**********************************************************************************************
480 
481  //**Assignment to sparse vectors****************************************************************
495  template< typename VT2 > // Type of the target sparse vector
496  friend inline typename EnableIf< UseAssign<VT2> >::Type
497  assign( SparseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
498  {
500 
501  using std::abs;
502 
503  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
504 
505  typedef typename VT2::Iterator Iterator;
506 
507  assign( ~lhs, rhs.sv_ );
508 
509  const Iterator end( (~lhs).end() );
510  for( Iterator element=(~lhs).begin(); element!=end; ++element ) {
511  element->value() = abs( element->value() );
512  }
513  }
515  //**********************************************************************************************
516 
517  //**Addition assignment to dense vectors********************************************************
531  template< typename VT2 > // Type of the target dense vector
532  friend inline typename EnableIf< UseAssign<VT2> >::Type
533  addAssign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
534  {
536 
540 
541  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
542 
543  const ResultType tmp( serial( rhs ) );
544  addAssign( ~lhs, tmp );
545  }
547  //**********************************************************************************************
548 
549  //**Addition assignment to sparse vectors*******************************************************
550  // No special implementation for the addition assignment to sparse vectors.
551  //**********************************************************************************************
552 
553  //**Subtraction assignment to dense vectors*****************************************************
567  template< typename VT2 > // Type of the target dense vector
568  friend inline typename EnableIf< UseAssign<VT2> >::Type
569  subAssign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
570  {
572 
576 
577  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
578 
579  const ResultType tmp( serial( rhs ) );
580  subAssign( ~lhs, tmp );
581  }
583  //**********************************************************************************************
584 
585  //**Subtraction assignment to sparse vectors****************************************************
586  // No special implementation for the subtraction assignment to sparse vectors.
587  //**********************************************************************************************
588 
589  //**Multiplication assignment to dense vectors**************************************************
603  template< typename VT2 > // Type of the target dense vector
604  friend inline typename EnableIf< UseAssign<VT2> >::Type
605  multAssign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
606  {
608 
612 
613  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
614 
615  const ResultType tmp( serial( rhs ) );
616  multAssign( ~lhs, tmp );
617  }
619  //**********************************************************************************************
620 
621  //**Multiplication assignment to sparse vectors*************************************************
622  // No special implementation for the multiplication assignment to sparse vectors.
623  //**********************************************************************************************
624 
625  //**SMP assignment to dense vectors*************************************************************
639  template< typename VT2 > // Type of the target dense vector
640  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
641  smpAssign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
642  {
644 
645  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
646 
647  smpAssign( ~lhs, rhs.sv_ );
648  smpAssign( ~lhs, abs( ~lhs ) );
649  }
651  //**********************************************************************************************
652 
653  //**SMP assignment to sparse vectors************************************************************
654  // No special implementation for the SMP assignment to sparse vectors.
655  //**********************************************************************************************
656 
657  //**SMP addition assignment to dense vectors****************************************************
671  template< typename VT2 > // Type of the target dense vector
672  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
673  smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
674  {
676 
680 
681  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
682 
683  const ResultType tmp( rhs );
684  smpAddAssign( ~lhs, tmp );
685  }
687  //**********************************************************************************************
688 
689  //**SMP addition assignment to sparse vectors***************************************************
690  // No special implementation for the SMP addition assignment to sparse vectors.
691  //**********************************************************************************************
692 
693  //**SMP subtraction assignment to dense vectors*************************************************
707  template< typename VT2 > // Type of the target dense vector
708  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
709  smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
710  {
712 
716 
717  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
718 
719  const ResultType tmp( rhs );
720  smpSubAssign( ~lhs, tmp );
721  }
723  //**********************************************************************************************
724 
725  //**SMP subtraction assignment to sparse vectors************************************************
726  // No special implementation for the SMP subtraction assignment to sparse vectors.
727  //**********************************************************************************************
728 
729  //**SMP multiplication assignment to dense vectors**********************************************
743  template< typename VT2 > // Type of the target dense vector
744  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
745  smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecAbsExpr& rhs )
746  {
748 
752 
753  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
754 
755  const ResultType tmp( rhs );
756  smpMultAssign( ~lhs, tmp );
757  }
759  //**********************************************************************************************
760 
761  //**SMP multiplication assignment to sparse vectors*********************************************
762  // No special implementation for the SMP multiplication assignment to sparse vectors.
763  //**********************************************************************************************
764 
765  //**Compile time checks*************************************************************************
770  //**********************************************************************************************
771 };
772 //*************************************************************************************************
773 
774 
775 
776 
777 //=================================================================================================
778 //
779 // GLOBAL FUNCTIONS
780 //
781 //=================================================================================================
782 
783 //*************************************************************************************************
800 template< typename VT // Type of the sparse vector
801  , bool TF > // Transpose flag
802 inline const SVecAbsExpr<VT,TF> abs( const SparseVector<VT,TF>& sv )
803 {
805 
806  return SVecAbsExpr<VT,TF>( ~sv );
807 }
808 //*************************************************************************************************
809 
810 
811 
812 
813 //=================================================================================================
814 //
815 // GLOBAL RESTRUCTURING FUNCTIONS
816 //
817 //=================================================================================================
818 
819 //*************************************************************************************************
830 template< typename VT // Type of the sparse vector
831  , bool TF > // Transpose flag
832 inline const SVecAbsExpr<VT,TF>& abs( const SVecAbsExpr<VT,TF>& sv )
833 {
835 
836  return sv;
837 }
839 //*************************************************************************************************
840 
841 
842 
843 
844 //=================================================================================================
845 //
846 // SIZE SPECIALIZATIONS
847 //
848 //=================================================================================================
849 
850 //*************************************************************************************************
852 template< typename VT, bool TF >
853 struct Size< SVecAbsExpr<VT,TF> >
854  : public Size<VT>
855 {};
857 //*************************************************************************************************
858 
859 
860 
861 
862 //=================================================================================================
863 //
864 // EXPRESSION TRAIT SPECIALIZATIONS
865 //
866 //=================================================================================================
867 
868 //*************************************************************************************************
870 template< typename VT >
871 struct SVecAbsExprTrait< SVecAbsExpr<VT,false> >
872 {
873  public:
874  //**********************************************************************************************
875  typedef typename SelectType< IsSparseVector<VT>::value && IsColumnVector<VT>::value
876  , SVecAbsExpr<VT,false>
877  , INVALID_TYPE >::Type Type;
878  //**********************************************************************************************
879 };
881 //*************************************************************************************************
882 
883 
884 //*************************************************************************************************
886 template< typename VT >
887 struct TSVecAbsExprTrait< SVecAbsExpr<VT,true> >
888 {
889  public:
890  //**********************************************************************************************
891  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value
892  , SVecAbsExpr<VT,true>
893  , INVALID_TYPE >::Type Type;
894  //**********************************************************************************************
895 };
897 //*************************************************************************************************
898 
899 
900 //*************************************************************************************************
902 template< typename VT, bool TF, bool AF >
903 struct SubvectorExprTrait< SVecAbsExpr<VT,TF>, AF >
904 {
905  public:
906  //**********************************************************************************************
907  typedef typename AbsExprTrait< typename SubvectorExprTrait<const VT,AF>::Type >::Type Type;
908  //**********************************************************************************************
909 };
911 //*************************************************************************************************
912 
913 } // namespace blaze
914 
915 #endif
Pointer difference type of the Blaze library.
ValueType * PointerType
Pointer return type.
Definition: SVecAbsExpr.h:190
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
Header file for the TSVecAbsExprTrait class template.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecAbsExpr.h:331
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.
Header file for the SparseVector base class.
IteratorType it_
Iterator over the elements of the sparse vector expression.
Definition: SVecAbsExpr.h:298
size_t index() const
Access to the current index of the sparse element.
Definition: SVecAbsExpr.h:258
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecAbsExpr.h:396
ValueType & ReferenceType
Reference return type.
Definition: SVecAbsExpr.h:191
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecAbsExpr.h:226
VT::TransposeType TT
Transpose type of the sparse vector expression.
Definition: SVecAbsExpr.h:102
SelectType< useAssign, const ResultType, const SVecAbsExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SVecAbsExpr.h:164
const SVecAbsExpr< VT, TF > abs(const SparseVector< VT, TF > &sv)
Returns a vector containing the absolute values of each single element of sv.
Definition: SVecAbsExpr.h:802
VT::ResultType RT
Result type of the sparse vector expression.
Definition: SVecAbsExpr.h:99
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
Header file for the IsRowVector type trait.
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:914
Element ValueType
Type of the underlying pointers.
Definition: SVecAbsExpr.h:189
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.
SVecAbsExpr< VT, TF > This
Type of this SVecAbsExpr instance.
Definition: SVecAbsExpr.h:155
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecAbsExpr.h:215
Header file for the SVecAbsExprTrait class template.
Header file for the RequiresEvaluation type trait.
SVecAbsExpr(const VT &sv)
Constructor for the SVecAbsExpr class.
Definition: SVecAbsExpr.h:308
AbsExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SVecAbsExpr.h:116
IteratorCategory iterator_category
The iterator category.
Definition: SVecAbsExpr.h:195
Expression object for the sparse vector abs() function.The SVecAbsExpr class represents the compile t...
Definition: Forward.h:109
VT::ReturnType RN
Return type of the sparse vector expression.
Definition: SVecAbsExpr.h:100
Constraint on the data type.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecAbsExpr.h:419
RemoveReference< Operand >::Type::ConstIterator IteratorType
Iterator type of the sparse vector expression.
Definition: SVecAbsExpr.h:186
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
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecAbsExpr.h:341
Header file for the ValueIndexPair class.
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
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecAbsExpr.h:361
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecAbsExpr.h:384
ET ElementType
Resulting element type.
Definition: SVecAbsExpr.h:158
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
DifferenceType difference_type
Difference between two iterators.
Definition: SVecAbsExpr.h:199
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
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecAbsExpr.h:372
VT::ElementType ET
Element type of the sparse vector expression.
Definition: SVecAbsExpr.h:103
ValueType value_type
Type of the underlying pointers.
Definition: SVecAbsExpr.h:196
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SVecAbsExpr.h:441
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_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:79
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecAbsExpr.h:269
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
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecAbsExpr.h:183
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2504
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecAbsExpr.h:319
TT TransposeType
Transpose type for expression template evaluations.
Definition: SVecAbsExpr.h:157
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
Constraint on the data type.
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the serial shim.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecAbsExpr.h:188
Operand operand() const
Returns the sparse vector operand.
Definition: SVecAbsExpr.h:407
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
Header file for the IsSparseVector type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Iterator over the elements of the sparse vector absolute value expression.
Definition: SVecAbsExpr.h:178
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SVecAbsExpr.h:161
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.
Operand sv_
Sparse vector of the absolute value expression.
Definition: SVecAbsExpr.h:448
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
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SVecAbsExpr.h:205
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecAbsExpr.h:192
VT::CompositeType CT
Composite type of the sparse vector expression.
Definition: SVecAbsExpr.h:101
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecAbsExpr.h:237
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
Header file for the RemoveReference type trait.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecAbsExpr.h:247
PointerType pointer
Pointer return type.
Definition: SVecAbsExpr.h:197
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecAbsExpr.h:291
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecAbsExpr.h:280
Header file for the IsComputation type trait class.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecAbsExpr.h:431
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecAbsExpr.h:351
RT ResultType
Result type for expression template evaluations.
Definition: SVecAbsExpr.h:156
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
ReferenceType reference
Reference return type.
Definition: SVecAbsExpr.h:198
Header file for the SubvectorExprTrait class template.
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type Operand
Composite data type of the sparse vector expression.
Definition: SVecAbsExpr.h:167
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:87
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
#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
Header file for the IsExpression type trait class.
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