All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SMatAbsExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATABSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATABSEXPR_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 SMATABSEXPR
81 //
82 //=================================================================================================
83 
84 //*************************************************************************************************
91 template< typename MT // Type of the sparse matrix
92  , bool SO > // Storage order
93 class SMatAbsExpr : public SparseMatrix< SMatAbsExpr<MT,SO>, SO >
94  , private MatAbsExpr
95  , private Computation
96 {
97  private:
98  //**Type definitions****************************************************************************
99  typedef typename MT::ResultType RT;
100  typedef typename MT::ReturnType RN;
101  typedef typename MT::CompositeType CT;
102  //**********************************************************************************************
103 
104  //**Return type evaluation**********************************************************************
106 
111  enum { returnExpr = !IsTemporary<RN>::value };
112 
115  //**********************************************************************************************
116 
117  //**Serial evaluation strategy******************************************************************
119 
125  enum { useAssign = RequiresEvaluation<MT>::value };
126 
128  template< typename MT2 >
130  struct UseAssign {
131  enum { value = useAssign };
132  };
134  //**********************************************************************************************
135 
136  //**Parallel evaluation strategy****************************************************************
138 
144  template< typename MT2 >
145  struct UseSMPAssign {
146  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
147  };
149  //**********************************************************************************************
150 
151  public:
152  //**Type definitions****************************************************************************
154  typedef typename MT::ResultType ResultType;
155  typedef typename MT::OppositeType OppositeType;
156  typedef typename MT::TransposeType TransposeType;
157  typedef typename MT::ElementType ElementType;
158 
161 
164 
166  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type Operand;
167  //**********************************************************************************************
168 
169  //**ConstIterator class definition**************************************************************
173  {
174  public:
175  //**Type definitions*************************************************************************
178 
181 
182  typedef std::forward_iterator_tag IteratorCategory;
183  typedef Element ValueType;
187 
188  // STL iterator requirements
194  //*******************************************************************************************
195 
196  //**Constructor******************************************************************************
200  : it_( it ) // Iterator over the elements of the sparse matrix expression
201  {}
202  //*******************************************************************************************
203 
204  //**Prefix increment operator****************************************************************
210  ++it_;
211  return *this;
212  }
213  //*******************************************************************************************
214 
215  //**Element access operator******************************************************************
220  inline const Element operator*() const {
221  using std::abs;
222  return Element( abs( it_->value() ), it_->index() );
223  }
224  //*******************************************************************************************
225 
226  //**Element access operator******************************************************************
231  inline const ConstIterator* operator->() const {
232  return this;
233  }
234  //*******************************************************************************************
235 
236  //**Value function***************************************************************************
241  inline ReturnType value() const {
242  using std::abs;
243  return abs( it_->value() );
244  }
245  //*******************************************************************************************
246 
247  //**Index function***************************************************************************
252  inline size_t index() const {
253  return it_->index();
254  }
255  //*******************************************************************************************
256 
257  //**Equality operator************************************************************************
263  inline bool operator==( const ConstIterator& rhs ) const {
264  return it_ == rhs.it_;
265  }
266  //*******************************************************************************************
267 
268  //**Inequality operator**********************************************************************
274  inline bool operator!=( const ConstIterator& rhs ) const {
275  return it_ != rhs.it_;
276  }
277  //*******************************************************************************************
278 
279  //**Subtraction operator*********************************************************************
285  inline DifferenceType operator-( const ConstIterator& rhs ) const {
286  return it_ - rhs.it_;
287  }
288  //*******************************************************************************************
289 
290  private:
291  //**Member variables*************************************************************************
293  //*******************************************************************************************
294  };
295  //**********************************************************************************************
296 
297  //**Compilation flags***************************************************************************
299  enum { smpAssignable = MT::smpAssignable };
300  //**********************************************************************************************
301 
302  //**Constructor*********************************************************************************
307  explicit inline SMatAbsExpr( const MT& sm )
308  : sm_( sm ) // Sparse matrix of the absolute value expression
309  {}
310  //**********************************************************************************************
311 
312  //**Access operator*****************************************************************************
319  inline ReturnType operator()( size_t i, size_t j ) const {
320  using std::abs;
321  BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
322  BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
323  return abs( sm_(i,j) );
324  }
325  //**********************************************************************************************
326 
327  //**Begin function******************************************************************************
333  inline ConstIterator begin( size_t i ) const {
334  return ConstIterator( sm_.begin(i) );
335  }
336  //**********************************************************************************************
337 
338  //**End function********************************************************************************
344  inline ConstIterator end( size_t i ) const {
345  return ConstIterator( sm_.end(i) );
346  }
347  //**********************************************************************************************
348 
349  //**Rows function*******************************************************************************
354  inline size_t rows() const {
355  return sm_.rows();
356  }
357  //**********************************************************************************************
358 
359  //**Columns function****************************************************************************
364  inline size_t columns() const {
365  return sm_.columns();
366  }
367  //**********************************************************************************************
368 
369  //**NonZeros function***************************************************************************
374  inline size_t nonZeros() const {
375  return sm_.nonZeros();
376  }
377  //**********************************************************************************************
378 
379  //**NonZeros function***************************************************************************
385  inline size_t nonZeros( size_t i ) const {
386  return sm_.nonZeros(i);
387  }
388  //**********************************************************************************************
389 
390  //**Operand access******************************************************************************
395  inline Operand operand() const {
396  return sm_;
397  }
398  //**********************************************************************************************
399 
400  //**********************************************************************************************
406  template< typename T >
407  inline bool canAlias( const T* alias ) const {
408  return sm_.canAlias( alias );
409  }
410  //**********************************************************************************************
411 
412  //**********************************************************************************************
418  template< typename T >
419  inline bool isAliased( const T* alias ) const {
420  return sm_.isAliased( alias );
421  }
422  //**********************************************************************************************
423 
424  //**********************************************************************************************
429  inline bool canSMPAssign() const {
430  return sm_.canSMPAssign();
431  }
432  //**********************************************************************************************
433 
434  private:
435  //**Member variables****************************************************************************
437  //**********************************************************************************************
438 
439  //**Assignment to dense matrices****************************************************************
453  template< typename MT2 // Type of the target dense matrix
454  , bool SO2 > // Storage order of the target dense matrix
455  friend inline typename EnableIf< UseAssign<MT2> >::Type
456  assign( DenseMatrix<MT2,SO2>& lhs, const SMatAbsExpr& rhs )
457  {
459 
460  using std::abs;
461 
462  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
463  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
464 
465  assign( ~lhs, rhs.sm_ );
466  assign( ~lhs, abs( ~lhs ) );
467  }
469  //**********************************************************************************************
470 
471  //**Assignment to row-major sparse matrices*****************************************************
485  template< typename MT2 > // Type of the target sparse matrix
486  friend inline typename EnableIf< UseAssign<MT2> >::Type
487  assign( SparseMatrix<MT2,false>& lhs, const SMatAbsExpr& rhs )
488  {
490 
491  using std::abs;
492 
493  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
494  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
495 
496  typedef typename MT2::Iterator Iterator;
497 
498  assign( ~lhs, rhs.sm_ );
499 
500  const size_t m( rhs.rows() );
501 
502  for( size_t i=0UL; i<m; ++i ) {
503  const Iterator end( (~lhs).end(i) );
504  for( Iterator element=(~lhs).begin(i); element!=end; ++element ) {
505  element->value() = abs( element->value() );
506  }
507  }
508  }
510  //**********************************************************************************************
511 
512  //**Assignment to column-major sparse matrices**************************************************
526  template< typename MT2 > // Type of the target sparse matrix
527  friend inline typename EnableIf< UseAssign<MT2> >::Type
528  assign( SparseMatrix<MT2,true>& lhs, const SMatAbsExpr& rhs )
529  {
531 
532  using std::abs;
533 
534  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
535  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
536 
537  typedef typename MT2::Iterator Iterator;
538 
539  assign( ~lhs, rhs.sm_ );
540 
541  const size_t n( rhs.columns() );
542 
543  for( size_t j=0UL; j<n; ++j ) {
544  const Iterator end( (~lhs).end(j) );
545  for( Iterator element=(~lhs).begin(j); element!=end; ++element ) {
546  element->value() = abs( element->value() );
547  }
548  }
549  }
551  //**********************************************************************************************
552 
553  //**Addition assignment to dense matrices*******************************************************
567  template< typename MT2 // Type of the target dense matrix
568  , bool SO2 > // Storage order of the target dense matrix
569  friend inline typename EnableIf< UseAssign<MT2> >::Type
570  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatAbsExpr& rhs )
571  {
573 
576 
577  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
578  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
579 
580  const ResultType tmp( serial( rhs ) );
581  addAssign( ~lhs, tmp );
582  }
584  //**********************************************************************************************
585 
586  //**Addition assignment to sparse matrices******************************************************
587  // No special implementation for the addition assignment to sparse matrices.
588  //**********************************************************************************************
589 
590  //**Subtraction assignment to dense matrices****************************************************
604  template< typename MT2 // Type of the target dense matrix
605  , bool SO2 > // Storage order of the target sparse matrix
606  friend inline typename EnableIf< UseAssign<MT2> >::Type
607  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatAbsExpr& rhs )
608  {
610 
613 
614  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
615  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
616 
617  const ResultType tmp( serial( rhs ) );
618  subAssign( ~lhs, tmp );
619  }
621  //**********************************************************************************************
622 
623  //**Subtraction assignment to sparse matrices***************************************************
624  // No special implementation for the subtraction assignment to sparse matrices.
625  //**********************************************************************************************
626 
627  //**Multiplication assignment to dense matrices*************************************************
628  // No special implementation for the multiplication assignment to dense matrices.
629  //**********************************************************************************************
630 
631  //**Multiplication assignment to sparse matrices************************************************
632  // No special implementation for the multiplication assignment to sparse matrices.
633  //**********************************************************************************************
634 
635  //**SMP assignment to dense matrices************************************************************
649  template< typename MT2 // Type of the target dense matrix
650  , bool SO2 > // Storage order of the target dense matrix
651  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
652  smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatAbsExpr& rhs )
653  {
655 
656  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
657  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
658 
659  smpAssign( ~lhs, rhs.sm_ );
660  smpAssign( ~lhs, abs( ~lhs ) );
661  }
663  //**********************************************************************************************
664 
665  //**SMP assignment to sparse matrices***********************************************************
666  // No special implementation for the SMP assignment to sparse matrices.
667  //**********************************************************************************************
668 
669  //**SMP addition assignment to dense matrices***************************************************
683  template< typename MT2 // Type of the target dense matrix
684  , bool SO2 > // Storage order of the target dense matrix
685  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
686  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatAbsExpr& rhs )
687  {
689 
692 
693  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
694  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
695 
696  const ResultType tmp( rhs );
697  smpAddAssign( ~lhs, tmp );
698  }
700  //**********************************************************************************************
701 
702  //**SMP addition assignment to sparse matrices**************************************************
703  // No special implementation for the SMP addition assignment to sparse matrices.
704  //**********************************************************************************************
705 
706  //**SMP subtraction assignment to dense matrices************************************************
720  template< typename MT2 // Type of the target dense matrix
721  , bool SO2 > // Storage order of the target sparse matrix
722  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
723  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatAbsExpr& rhs )
724  {
726 
729 
730  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
731  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
732 
733  const ResultType tmp( rhs );
734  smpSubAssign( ~lhs, tmp );
735  }
737  //**********************************************************************************************
738 
739  //**SMP subtraction assignment to sparse matrices***********************************************
740  // No special implementation for the SMP subtraction assignment to sparse matrices.
741  //**********************************************************************************************
742 
743  //**SMP multiplication assignment to dense matrices*********************************************
744  // No special implementation for the SMP multiplication assignment to dense matrices.
745  //**********************************************************************************************
746 
747  //**SMP multiplication assignment to sparse matrices********************************************
748  // No special implementation for the SMP multiplication assignment to sparse matrices.
749  //**********************************************************************************************
750 
751  //**Compile time checks*************************************************************************
756  //**********************************************************************************************
757 };
758 //*************************************************************************************************
759 
760 
761 
762 
763 //=================================================================================================
764 //
765 // GLOBAL FUNCTIONS
766 //
767 //=================================================================================================
768 
769 //*************************************************************************************************
786 template< typename MT // Type of the sparse matrix
787  , bool SO > // Storage order
788 inline const SMatAbsExpr<MT,SO> abs( const SparseMatrix<MT,SO>& sm )
789 {
791 
792  return SMatAbsExpr<MT,SO>( ~sm );
793 }
794 //*************************************************************************************************
795 
796 
797 
798 
799 //=================================================================================================
800 //
801 // GLOBAL RESTRUCTURING FUNCTIONS
802 //
803 //=================================================================================================
804 
805 //*************************************************************************************************
816 template< typename MT // Type of the sparse matrix
817  , bool TF > // Transpose flag
818 inline const SMatAbsExpr<MT,TF>& abs( const SMatAbsExpr<MT,TF>& sm )
819 {
821 
822  return sm;
823 }
825 //*************************************************************************************************
826 
827 
828 
829 
830 //=================================================================================================
831 //
832 // EXPRESSION TRAIT SPECIALIZATIONS
833 //
834 //=================================================================================================
835 
836 //*************************************************************************************************
838 template< typename MT >
839 struct SMatAbsExprTrait< SMatAbsExpr<MT,false> >
840 {
841  public:
842  //**********************************************************************************************
843  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
844  , SMatAbsExpr<MT,false>
845  , INVALID_TYPE >::Type Type;
846  //**********************************************************************************************
847 };
849 //*************************************************************************************************
850 
851 
852 //*************************************************************************************************
854 template< typename MT >
855 struct TSMatAbsExprTrait< SMatAbsExpr<MT,true> >
856 {
857  public:
858  //**********************************************************************************************
859  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
860  , SMatAbsExpr<MT,true>
861  , INVALID_TYPE >::Type Type;
862  //**********************************************************************************************
863 };
865 //*************************************************************************************************
866 
867 
868 //*************************************************************************************************
870 template< typename MT, bool SO, bool AF >
871 struct SubmatrixExprTrait< SMatAbsExpr<MT,SO>, AF >
872 {
873  public:
874  //**********************************************************************************************
875  typedef typename AbsExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
876  //**********************************************************************************************
877 };
879 //*************************************************************************************************
880 
881 
882 //*************************************************************************************************
884 template< typename MT, bool SO >
885 struct RowExprTrait< SMatAbsExpr<MT,SO> >
886 {
887  public:
888  //**********************************************************************************************
889  typedef typename AbsExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
890  //**********************************************************************************************
891 };
893 //*************************************************************************************************
894 
895 
896 //*************************************************************************************************
898 template< typename MT, bool SO >
899 struct ColumnExprTrait< SMatAbsExpr<MT,SO> >
900 {
901  public:
902  //**********************************************************************************************
903  typedef typename AbsExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
904  //**********************************************************************************************
905 };
907 //*************************************************************************************************
908 
909 } // namespace blaze
910 
911 #endif
IteratorCategory iterator_category
The iterator category.
Definition: SMatAbsExpr.h:189
Pointer difference type of the Blaze library.
MT::ResultType ResultType
Result type for expression template evaluations.
Definition: SMatAbsExpr.h:154
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SMatAbsExpr.h:160
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatAbsExpr.h:186
ReferenceType reference
Reference return type.
Definition: SMatAbsExpr.h:192
RemoveReference< Operand >::Type::ConstIterator IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatAbsExpr.h:180
PointerType pointer
Pointer return type.
Definition: SMatAbsExpr.h:191
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatAbsExpr.h:155
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:242
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatAbsExpr.h:241
Header file for the ColumnExprTrait class template.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
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:903
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SMatAbsExpr.h:429
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatAbsExpr.h:333
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatAbsExpr.h:419
ValueType & ReferenceType
Reference return type.
Definition: SMatAbsExpr.h:185
MT::ElementType ElementType
Resulting element type.
Definition: SMatAbsExpr.h:157
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2404
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
Constraint on the data type.
Operand operand() const
Returns the sparse matrix operand.
Definition: SMatAbsExpr.h:395
const SMatAbsExpr< MT, SO > abs(const SparseMatrix< MT, SO > &sm)
Returns a matrix containing the absolute values of each single element of sm.
Definition: SMatAbsExpr.h:788
Header file for the SparseMatrix base class.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatAbsExpr.h:385
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SMatAbsExpr.h:199
Constraint on the data type.
void smpAddAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:122
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:253
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.
Element ValueType
Type of the underlying pointers.
Definition: SMatAbsExpr.h:183
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatAbsExpr.h:274
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatAbsExpr.h:319
ValueType * PointerType
Pointer return type.
Definition: SMatAbsExpr.h:184
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
size_t index() const
Access to the current index of the sparse element.
Definition: SMatAbsExpr.h:252
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:271
SMatAbsExpr(const MT &sm)
Constructor for the SMatAbsExpr class.
Definition: SMatAbsExpr.h:307
Header file for the MatAbsExpr base class.
Iterator over the elements of the sparse matrix absolute value expression.
Definition: SMatAbsExpr.h:172
#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
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2405
Constraints on the storage order of matrix types.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatAbsExpr.h:263
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatAbsExpr.h:231
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatAbsExpr.h:220
Header file for the EnableIf class template.
Header file for the serial shim.
MT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatAbsExpr.h:156
Header file for the TSMatAbsExprTrait class template.
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatAbsExpr.h:374
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatAbsExpr.h:407
Header file for the IsSparseVector type trait.
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatAbsExpr.h:354
Header file for run time assertion macros.
Utility type for generic codes.
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:301
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:331
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
Header file for the RemoveReference type trait.
IteratorType it_
Iterator over the elements of the sparse matrix expression.
Definition: SMatAbsExpr.h:292
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatAbsExpr.h:209
Header file for the SMatAbsExprTrait class template.
SelectType< useAssign, const ResultType, const SMatAbsExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SMatAbsExpr.h:163
MT::ResultType RT
Result type of the sparse matrix expression.
Definition: SMatAbsExpr.h:99
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatAbsExpr.h:344
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatAbsExpr.h:182
ValueType value_type
Type of the underlying pointers.
Definition: SMatAbsExpr.h:190
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:69
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatAbsExpr.h:177
AbsExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SMatAbsExpr.h:114
Header file for the IsComputation type trait class.
DifferenceType difference_type
Difference between two iterators.
Definition: SMatAbsExpr.h:193
MT::CompositeType CT
Composite type of the sparse matrix expression.
Definition: SMatAbsExpr.h:101
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
Header file for basic type definitions.
Expression object for the sparse matrix abs() function.The SMatAbsExpr class represents the compile t...
Definition: Forward.h:88
MT::ReturnType RN
Return type of the sparse matrix expression.
Definition: SMatAbsExpr.h:100
Header file for the AbsExprTrait class template.
Header file for the IsColumnVector type trait.
Operand sm_
Sparse matrix of the absolute value expression.
Definition: SMatAbsExpr.h:436
Evaluation of the return type of an absolute value expression.Via this type trait it is possible to e...
Definition: AbsExprTrait.h:86
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatAbsExpr.h:364
#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
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatAbsExpr.h:285
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
SMatAbsExpr< MT, SO > This
Type of this SMatAbsExpr instance.
Definition: SMatAbsExpr.h:153
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type Operand
Composite data type of the sparse matrix expression.
Definition: SMatAbsExpr.h:166
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.