All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMatDMatAddExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATADDEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATDMATADDEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
50 #include <blaze/math/Intrinsics.h>
61 #include <blaze/util/Assert.h>
63 #include <blaze/util/EnableIf.h>
65 #include <blaze/util/SelectType.h>
66 #include <blaze/util/Types.h>
68 
69 
70 namespace blaze {
71 
72 //=================================================================================================
73 //
74 // CLASS DMATDMATADDEXPR
75 //
76 //=================================================================================================
77 
78 //*************************************************************************************************
85 template< typename MT1 // Type of the left-hand side dense matrix
86  , typename MT2 // Type of the right-hand side dense matrix
87  , bool SO > // Storage order
88 class DMatDMatAddExpr : public DenseMatrix< DMatDMatAddExpr<MT1,MT2,SO>, SO >
89  , private MatMatAddExpr
90  , private Computation
91 {
92  private:
93  //**Type definitions****************************************************************************
94  typedef typename MT1::ResultType RT1;
95  typedef typename MT2::ResultType RT2;
96  typedef typename MT1::ReturnType RN1;
97  typedef typename MT2::ReturnType RN2;
98  typedef typename MT1::CompositeType CT1;
99  typedef typename MT2::CompositeType CT2;
100  typedef typename MT1::ElementType ET1;
101  typedef typename MT2::ElementType ET2;
102  //**********************************************************************************************
103 
104  //**Return type evaluation**********************************************************************
106 
111  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
112 
115  //**********************************************************************************************
116 
117  //**Serial evaluation strategy******************************************************************
119 
125  enum { useAssign = RequiresEvaluation<MT1>::value || RequiresEvaluation<MT2>::value || !returnExpr };
126 
128  template< typename MT >
130  struct UseAssign {
131  enum { value = useAssign };
132  };
134  //**********************************************************************************************
135 
136  //**Parallel evaluation strategy****************************************************************
138 
144  template< typename MT >
145  struct UseSMPAssign {
146  enum { value = ( !MT1::smpAssignable || !MT2::smpAssignable ) && useAssign };
147  };
149  //**********************************************************************************************
150 
151  public:
152  //**Type definitions****************************************************************************
159 
162 
165 
167  typedef typename SelectType< IsExpression<MT1>::value, const MT1, const MT1& >::Type LeftOperand;
168 
170  typedef typename SelectType< IsExpression<MT2>::value, const MT2, const MT2& >::Type RightOperand;
171  //**********************************************************************************************
172 
173  //**ConstIterator class definition**************************************************************
177  {
178  public:
179  //**Type definitions*************************************************************************
180  typedef std::random_access_iterator_tag IteratorCategory;
185 
186  // STL iterator requirements
192 
195 
198  //*******************************************************************************************
199 
200  //**Constructor******************************************************************************
206  explicit inline ConstIterator( LeftIteratorType left, RightIteratorType right )
207  : left_ ( left ) // Iterator to the current left-hand side element
208  , right_( right ) // Iterator to the current right-hand side element
209  {}
210  //*******************************************************************************************
211 
212  //**Addition assignment operator*************************************************************
218  inline ConstIterator& operator+=( size_t inc ) {
219  left_ += inc;
220  right_ += inc;
221  return *this;
222  }
223  //*******************************************************************************************
224 
225  //**Subtraction assignment operator**********************************************************
231  inline ConstIterator& operator-=( size_t dec ) {
232  left_ -= dec;
233  right_ -= dec;
234  return *this;
235  }
236  //*******************************************************************************************
237 
238  //**Prefix increment operator****************************************************************
244  ++left_;
245  ++right_;
246  return *this;
247  }
248  //*******************************************************************************************
249 
250  //**Postfix increment operator***************************************************************
255  inline const ConstIterator operator++( int ) {
256  return ConstIterator( left_++, right_++ );
257  }
258  //*******************************************************************************************
259 
260  //**Prefix decrement operator****************************************************************
266  --left_;
267  --right_;
268  return *this;
269  }
270  //*******************************************************************************************
271 
272  //**Postfix decrement operator***************************************************************
277  inline const ConstIterator operator--( int ) {
278  return ConstIterator( left_--, right_-- );
279  }
280  //*******************************************************************************************
281 
282  //**Element access operator******************************************************************
287  inline ReturnType operator*() const {
288  return (*left_) + (*right_);
289  }
290  //*******************************************************************************************
291 
292  //**Load function****************************************************************************
297  inline IntrinsicType load() const {
298  return left_.load() + right_.load();
299  }
300  //*******************************************************************************************
301 
302  //**Equality operator************************************************************************
308  inline bool operator==( const ConstIterator& rhs ) const {
309  return left_ == rhs.left_;
310  }
311  //*******************************************************************************************
312 
313  //**Inequality operator**********************************************************************
319  inline bool operator!=( const ConstIterator& rhs ) const {
320  return left_ != rhs.left_;
321  }
322  //*******************************************************************************************
323 
324  //**Less-than operator***********************************************************************
330  inline bool operator<( const ConstIterator& rhs ) const {
331  return left_ < rhs.left_;
332  }
333  //*******************************************************************************************
334 
335  //**Greater-than operator********************************************************************
341  inline bool operator>( const ConstIterator& rhs ) const {
342  return left_ > rhs.left_;
343  }
344  //*******************************************************************************************
345 
346  //**Less-or-equal-than operator**************************************************************
352  inline bool operator<=( const ConstIterator& rhs ) const {
353  return left_ <= rhs.left_;
354  }
355  //*******************************************************************************************
356 
357  //**Greater-or-equal-than operator***********************************************************
363  inline bool operator>=( const ConstIterator& rhs ) const {
364  return left_ >= rhs.left_;
365  }
366  //*******************************************************************************************
367 
368  //**Subtraction operator*********************************************************************
374  inline DifferenceType operator-( const ConstIterator& rhs ) const {
375  return left_ - rhs.left_;
376  }
377  //*******************************************************************************************
378 
379  //**Addition operator************************************************************************
386  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
387  return ConstIterator( it.left_ + inc, it.right_ + inc );
388  }
389  //*******************************************************************************************
390 
391  //**Addition operator************************************************************************
398  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
399  return ConstIterator( it.left_ + inc, it.right_ + inc );
400  }
401  //*******************************************************************************************
402 
403  //**Subtraction operator*********************************************************************
410  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
411  return ConstIterator( it.left_ - dec, it.right_ - dec );
412  }
413  //*******************************************************************************************
414 
415  private:
416  //**Member variables*************************************************************************
419  //*******************************************************************************************
420  };
421  //**********************************************************************************************
422 
423  //**Compilation flags***************************************************************************
425  enum { vectorizable = MT1::vectorizable && MT2::vectorizable &&
428 
430  enum { smpAssignable = MT1::smpAssignable && MT2::smpAssignable };
431  //**********************************************************************************************
432 
433  //**Constructor*********************************************************************************
439  explicit inline DMatDMatAddExpr( const MT1& lhs, const MT2& rhs )
440  : lhs_( lhs ) // Left-hand side dense matrix of the addition expression
441  , rhs_( rhs ) // Right-hand side dense matrix of the addition expression
442  {
443  BLAZE_INTERNAL_ASSERT( lhs.rows() == rhs.rows() , "Invalid number of rows" );
444  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.columns(), "Invalid number of columns" );
445  }
446  //**********************************************************************************************
447 
448  //**Access operator*****************************************************************************
455  inline ReturnType operator()( size_t i, size_t j ) const {
456  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
457  BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
458  return lhs_(i,j) + rhs_(i,j);
459  }
460  //**********************************************************************************************
461 
462  //**Load function*******************************************************************************
469  inline IntrinsicType load( size_t i, size_t j ) const {
470  typedef IntrinsicTrait<ElementType> IT;
471  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
472  BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
473  BLAZE_INTERNAL_ASSERT( !SO || ( i % IT::size == 0UL ), "Invalid row access index" );
474  BLAZE_INTERNAL_ASSERT( SO || ( j % IT::size == 0UL ), "Invalid column access index" );
475  return lhs_.load(i,j) + rhs_.load(i,j);
476  }
477  //**********************************************************************************************
478 
479  //**Begin function******************************************************************************
485  inline ConstIterator begin( size_t i ) const {
486  return ConstIterator( lhs_.begin(i), rhs_.begin(i) );
487  }
488  //**********************************************************************************************
489 
490  //**End function********************************************************************************
496  inline ConstIterator end( size_t i ) const {
497  return ConstIterator( lhs_.end(i), rhs_.end(i) );
498  }
499  //**********************************************************************************************
500 
501  //**Rows function*******************************************************************************
506  inline size_t rows() const {
507  return lhs_.rows();
508  }
509  //**********************************************************************************************
510 
511  //**Columns function****************************************************************************
516  inline size_t columns() const {
517  return lhs_.columns();
518  }
519  //**********************************************************************************************
520 
521  //**Left operand access*************************************************************************
526  inline LeftOperand leftOperand() const {
527  return lhs_;
528  }
529  //**********************************************************************************************
530 
531  //**Right operand access************************************************************************
536  inline RightOperand rightOperand() const {
537  return rhs_;
538  }
539  //**********************************************************************************************
540 
541  //**********************************************************************************************
547  template< typename T >
548  inline bool canAlias( const T* alias ) const {
549  return ( IsExpression<MT1>::value && ( RequiresEvaluation<MT1>::value ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
550  ( IsExpression<MT2>::value && ( RequiresEvaluation<MT2>::value ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
551  }
552  //**********************************************************************************************
553 
554  //**********************************************************************************************
560  template< typename T >
561  inline bool isAliased( const T* alias ) const {
562  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
563  }
564  //**********************************************************************************************
565 
566  //**********************************************************************************************
571  inline bool isAligned() const {
572  return lhs_.isAligned() && rhs_.isAligned();
573  }
574  //**********************************************************************************************
575 
576  //**********************************************************************************************
581  inline bool canSMPAssign() const {
582  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
583  ( ( ( SO == rowMajor ) ? rows() : columns() ) > SMP_DMATDMATADD_THRESHOLD );
584  }
585  //**********************************************************************************************
586 
587  private:
588  //**Member variables****************************************************************************
591  //**********************************************************************************************
592 
593  //**Assignment to dense matrices****************************************************************
607  template< typename MT // Type of the target dense matrix
608  , bool SO2 > // Storage order of the target dense matrix
609  friend inline typename EnableIf< UseAssign<MT> >::Type
610  assign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
611  {
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  if( !IsExpression<MT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
618  addAssign( ~lhs, rhs.rhs_ );
619  }
620  else if( !IsExpression<MT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
621  addAssign( ~lhs, rhs.lhs_ );
622  }
623  else {
624  assign ( ~lhs, rhs.lhs_ );
625  addAssign( ~lhs, rhs.rhs_ );
626  }
627  }
629  //**********************************************************************************************
630 
631  //**Assignment to sparse matrices***************************************************************
645  template< typename MT // Type of the target sparse matrix
646  , bool SO2 > // Storage order of the target sparse matrix
647  friend inline typename EnableIf< UseAssign<MT> >::Type
648  assign( SparseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
649  {
651 
653 
660 
661  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
662  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
663 
664  const TmpType tmp( serial( rhs ) );
665  assign( ~lhs, tmp );
666  }
668  //**********************************************************************************************
669 
670  //**Addition assignment to dense matrices*******************************************************
684  template< typename MT // Type of the target dense matrix
685  , bool SO2 > // Storage order of the target dense matrix
686  friend inline typename EnableIf< UseAssign<MT> >::Type
687  addAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
688  {
690 
691  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
692  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
693 
694  addAssign( ~lhs, rhs.lhs_ );
695  addAssign( ~lhs, rhs.rhs_ );
696  }
698  //**********************************************************************************************
699 
700  //**Addition assignment to sparse matrices******************************************************
701  // No special implementation for the addition assignment to sparse matrices.
702  //**********************************************************************************************
703 
704  //**Subtraction assignment to dense matrices****************************************************
718  template< typename MT // Type of the target dense matrix
719  , bool SO2 > // Storage order of the target dense matrix
720  friend inline typename EnableIf< UseAssign<MT> >::Type
721  subAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
722  {
724 
725  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
726  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
727 
728  subAssign( ~lhs, rhs.lhs_ );
729  subAssign( ~lhs, rhs.rhs_ );
730  }
732  //**********************************************************************************************
733 
734  //**Subtraction assignment to sparse matrices***************************************************
735  // No special implementation for the subtraction assignment to sparse matrices.
736  //**********************************************************************************************
737 
738  //**Multiplication assignment to dense matrices*************************************************
739  // No special implementation for the multiplication assignment to dense matrices.
740  //**********************************************************************************************
741 
742  //**Multiplication assignment to sparse matrices************************************************
743  // No special implementation for the multiplication assignment to sparse matrices.
744  //**********************************************************************************************
745 
746  //**SMP assignment to dense matrices************************************************************
760  template< typename MT // Type of the target dense matrix
761  , bool SO2 > // Storage order of the target dense matrix
762  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
763  smpAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
764  {
766 
767  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
768  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
769 
770  if( !IsExpression<MT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
771  smpAddAssign( ~lhs, rhs.rhs_ );
772  }
773  else if( !IsExpression<MT2>::value && isSame( ~lhs, rhs.rhs_ ) ) {
774  smpAddAssign( ~lhs, rhs.lhs_ );
775  }
776  else {
777  smpAssign ( ~lhs, rhs.lhs_ );
778  smpAddAssign( ~lhs, rhs.rhs_ );
779  }
780  }
782  //**********************************************************************************************
783 
784  //**SMP assignment to sparse matrices***********************************************************
798  template< typename MT // Type of the target sparse matrix
799  , bool SO2 > // Storage order of the target sparse matrix
800  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
801  smpAssign( SparseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
802  {
804 
805  typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
806 
813 
814  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
815  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
816 
817  const TmpType tmp( rhs );
818  smpAssign( ~lhs, tmp );
819  }
821  //**********************************************************************************************
822 
823  //**SMP addition assignment to dense matrices***************************************************
837  template< typename MT // Type of the target dense matrix
838  , bool SO2 > // Storage order of the target dense matrix
839  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
840  smpAddAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
841  {
843 
844  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
845  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
846 
847  smpAddAssign( ~lhs, rhs.lhs_ );
848  smpAddAssign( ~lhs, rhs.rhs_ );
849  }
851  //**********************************************************************************************
852 
853  //**SMP addition assignment to sparse matrices**************************************************
854  // No special implementation for the SMP addition assignment to sparse matrices.
855  //**********************************************************************************************
856 
857  //**SMP subtraction assignment to dense matrices************************************************
871  template< typename MT // Type of the target dense matrix
872  , bool SO2 > // Storage order of the target dense matrix
873  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
874  smpSubAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatAddExpr& rhs )
875  {
877 
878  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
879  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
880 
881  smpSubAssign( ~lhs, rhs.lhs_ );
882  smpSubAssign( ~lhs, rhs.rhs_ );
883  }
885  //**********************************************************************************************
886 
887  //**SMP subtraction assignment to sparse matrices***********************************************
888  // No special implementation for the SMP subtraction assignment to sparse matrices.
889  //**********************************************************************************************
890 
891  //**SMP multiplication assignment to dense matrices*********************************************
892  // No special implementation for the SMP multiplication assignment to dense matrices.
893  //**********************************************************************************************
894 
895  //**SMP multiplication assignment to sparse matrices********************************************
896  // No special implementation for the SMP multiplication assignment to sparse matrices.
897  //**********************************************************************************************
898 
899  //**Compile time checks*************************************************************************
905  //**********************************************************************************************
906 };
907 //*************************************************************************************************
908 
909 
910 
911 
912 //=================================================================================================
913 //
914 // GLOBAL BINARY ARITHMETIC OPERATORS
915 //
916 //=================================================================================================
917 
918 //*************************************************************************************************
945 template< typename T1 // Type of the left-hand side dense matrix
946  , typename T2 // Type of the right-hand side dense matrix
947  , bool SO > // Storage order
948 inline const DMatDMatAddExpr<T1,T2,SO>
950 {
952 
953  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
954  throw std::invalid_argument( "Matrix sizes do not match" );
955 
956  return DMatDMatAddExpr<T1,T2,SO>( ~lhs, ~rhs );
957 }
958 //*************************************************************************************************
959 
960 
961 
962 
963 //=================================================================================================
964 //
965 // EXPRESSION TRAIT SPECIALIZATIONS
966 //
967 //=================================================================================================
968 
969 //*************************************************************************************************
971 template< typename MT1, typename MT2, bool SO, bool AF >
972 struct SubmatrixExprTrait< DMatDMatAddExpr<MT1,MT2,SO>, AF >
973 {
974  public:
975  //**********************************************************************************************
976  typedef typename AddExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
977  , typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
978  //**********************************************************************************************
979 };
981 //*************************************************************************************************
982 
983 
984 //*************************************************************************************************
986 template< typename MT1, typename MT2, bool SO >
987 struct RowExprTrait< DMatDMatAddExpr<MT1,MT2,SO> >
988 {
989  public:
990  //**********************************************************************************************
991  typedef typename AddExprTrait< typename RowExprTrait<const MT1>::Type
992  , typename RowExprTrait<const MT2>::Type >::Type Type;
993  //**********************************************************************************************
994 };
996 //*************************************************************************************************
997 
998 
999 //*************************************************************************************************
1001 template< typename MT1, typename MT2, bool SO >
1002 struct ColumnExprTrait< DMatDMatAddExpr<MT1,MT2,SO> >
1003 {
1004  public:
1005  //**********************************************************************************************
1006  typedef typename AddExprTrait< typename ColumnExprTrait<const MT1>::Type
1007  , typename ColumnExprTrait<const MT2>::Type >::Type Type;
1008  //**********************************************************************************************
1009 };
1011 //*************************************************************************************************
1012 
1013 } // namespace blaze
1014 
1015 #endif
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatDMatAddExpr.h:496
Pointer difference type of the Blaze library.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:341
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatDMatAddExpr.h:243
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatDMatAddExpr.h:218
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DMatDMatAddExpr.h:206
RightOperand rightOperand() const
Returns the right-hand side dense matrix operand.
Definition: DMatDMatAddExpr.h:536
Evaluation of the return type of an addition expression.Via this type trait it is possible to evaluat...
Definition: AddExprTrait.h:103
PointerType pointer
Pointer return type.
Definition: DMatDMatAddExpr.h:189
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatDMatAddExpr.h:231
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatDMatAddExpr.h:184
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:352
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
MT1::ElementType ET1
Element type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:100
#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
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatDMatAddExpr.h:287
Header file for the ColumnExprTrait class template.
Header file for the IsSame and IsStrictlySame type traits.
IntrinsicType load(size_t i, size_t j) const
Access to the intrinsic elements of the matrix.
Definition: DMatDMatAddExpr.h:469
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:319
MT2::ResultType RT2
Result type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:95
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
MT2::ConstIterator RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:197
ElementType * PointerType
Pointer return type.
Definition: DMatDMatAddExpr.h:182
Header file for the AddExprTrait class template.
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatDMatAddExpr.h:180
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatDMatAddExpr.h:581
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:158
Header file for the RequiresEvaluation type trait.
ResultType::ElementType ElementType
Resulting element type.
Definition: DMatDMatAddExpr.h:157
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:409
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
MT2::ReturnType RN2
Return type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:97
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
IntrinsicType load() const
Access to the intrinsic elements of the matrix.
Definition: DMatDMatAddExpr.h:297
Constraint on the data type.
Iterator over the elements of the dense matrix.
Definition: DMatDMatAddExpr.h:176
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatDMatAddExpr.h:156
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
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DMatDMatAddExpr.h:418
Expression object for dense matrix-dense matrix additions.The DMatDMatAddExpr class represents the co...
Definition: DMatDMatAddExpr.h:88
MT1::ResultType RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:94
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.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatDMatAddExpr.h:485
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatDMatAddExpr.h:277
AddExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DMatDMatAddExpr.h:114
AddTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DMatDMatAddExpr.h:154
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
SelectType< useAssign, const ResultType, const DMatDMatAddExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatDMatAddExpr.h:164
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatDMatAddExpr.h:561
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatDMatAddExpr.h:265
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DMatDMatAddExpr.h:158
Header file for the DenseMatrix base class.
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatDMatAddExpr.h:386
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:271
Base class for all matrix/matrix addition expression templates.The MatMatAddExpr class serves as a ta...
Definition: MatMatAddExpr.h:65
ReferenceType reference
Reference return type.
Definition: DMatDMatAddExpr.h:190
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
MT2::CompositeType CT2
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:99
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDMatAddExpr.h:155
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:330
DMatDMatAddExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the DMatDMatAddExpr class.
Definition: DMatDMatAddExpr.h:439
#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
Constraints on the storage order of matrix types.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:308
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
MT1::ConstIterator LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:194
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
RightOperand rhs_
Right-hand side dense matrix of the addition expression.
Definition: DMatDMatAddExpr.h:590
Header file for the EnableIf class template.
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatDMatAddExpr.h:374
Header file for the serial shim.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatDMatAddExpr.h:516
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatDMatAddExpr.h:548
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
MT2::ElementType ET2
Element type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:101
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:141
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatDMatAddExpr.h:506
Header file for the addition trait.
ElementType & ReferenceType
Reference return type.
Definition: DMatDMatAddExpr.h:183
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
ElementType ValueType
Type of the underlying elements.
Definition: DMatDMatAddExpr.h:181
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DMatDMatAddExpr.h:161
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
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDMatAddExpr.h:571
Header file for the MatMatAddExpr base class.
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatDMatAddExpr.h:255
MT1::CompositeType CT1
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:98
#define BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER(T1, T2)
Constraint on the data type.In case either of the two given data types T1 or T2 is not a matrix type ...
Definition: StorageOrder.h:283
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatDMatAddExpr.h:398
Header file for all intrinsic functionality.
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:170
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DMatDMatAddExpr.h:417
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
IteratorCategory iterator_category
The iterator category.
Definition: DMatDMatAddExpr.h:187
LeftOperand lhs_
Left-hand side dense matrix of the addition expression.
Definition: DMatDMatAddExpr.h:589
LeftOperand leftOperand() const
Returns the left-hand side dense matrix operand.
Definition: DMatDMatAddExpr.h:526
#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.
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatDMatAddExpr.h:410
const size_t SMP_DMATDMATADD_THRESHOLD
SMP row-major dense matrix/row-major dense matrix addition threshold.This threshold specifies when a ...
Definition: Thresholds.h:714
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatAddExpr.h:363
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDMatAddExpr.h:455
MT1::ReturnType RN1
Return type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:96
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
DifferenceType difference_type
Difference between two iterators.
Definition: DMatDMatAddExpr.h:191
#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
DMatDMatAddExpr< MT1, MT2, SO > This
Type of this DMatDMatAdd instance.
Definition: DMatDMatAddExpr.h:153
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatAddExpr.h:167
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:87
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
ValueType value_type
Type of the underlying elements.
Definition: DMatDMatAddExpr.h:188