All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMatDMatSubExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATDMATSUBEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATDMATSUBEXPR_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 DMATDMATSUBEXPR
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 DMatDMatSubExpr : public DenseMatrix< DMatDMatSubExpr<MT1,MT2,SO>, SO >
89  , private MatMatSubExpr
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 DMatDMatSubExpr( const MT1& lhs, const MT2& rhs )
440  : lhs_( lhs ) // Left-hand side dense matrix of the subtraction expression
441  , rhs_( rhs ) // Right-hand side dense matrix of the subtraction 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  const IntrinsicType xmm1( lhs_.load(i,j) );
476  const IntrinsicType xmm2( rhs_.load(i,j) );
477  return xmm1 - xmm2;
478  }
479  //**********************************************************************************************
480 
481  //**Begin function******************************************************************************
487  inline ConstIterator begin( size_t i ) const {
488  return ConstIterator( lhs_.begin(i), rhs_.begin(i) );
489  }
490  //**********************************************************************************************
491 
492  //**End function********************************************************************************
498  inline ConstIterator end( size_t i ) const {
499  return ConstIterator( lhs_.end(i), rhs_.end(i) );
500  }
501  //**********************************************************************************************
502 
503  //**Rows function*******************************************************************************
508  inline size_t rows() const {
509  return lhs_.rows();
510  }
511  //**********************************************************************************************
512 
513  //**Columns function****************************************************************************
518  inline size_t columns() const {
519  return lhs_.columns();
520  }
521  //**********************************************************************************************
522 
523  //**Left operand access*************************************************************************
528  inline LeftOperand leftOperand() const {
529  return lhs_;
530  }
531  //**********************************************************************************************
532 
533  //**Right operand access************************************************************************
538  inline RightOperand rightOperand() const {
539  return rhs_;
540  }
541  //**********************************************************************************************
542 
543  //**********************************************************************************************
549  template< typename T >
550  inline bool canAlias( const T* alias ) const {
551  return ( IsExpression<MT1>::value && ( RequiresEvaluation<MT1>::value ? lhs_.isAliased( alias ) : lhs_.canAlias( alias ) ) ) ||
552  ( IsExpression<MT2>::value && ( RequiresEvaluation<MT2>::value ? rhs_.isAliased( alias ) : rhs_.canAlias( alias ) ) );
553  }
554  //**********************************************************************************************
555 
556  //**********************************************************************************************
562  template< typename T >
563  inline bool isAliased( const T* alias ) const {
564  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
565  }
566  //**********************************************************************************************
567 
568  //**********************************************************************************************
573  inline bool isAligned() const {
574  return lhs_.isAligned() && rhs_.isAligned();
575  }
576  //**********************************************************************************************
577 
578  //**********************************************************************************************
583  inline bool canSMPAssign() const {
584  return lhs_.canSMPAssign() || rhs_.canSMPAssign() ||
585  ( ( ( SO == rowMajor ) ? rows() : columns() ) > SMP_DMATDMATSUB_THRESHOLD );
586  }
587  //**********************************************************************************************
588 
589  private:
590  //**Member variables****************************************************************************
593  //**********************************************************************************************
594 
595  //**Assignment to dense matrices****************************************************************
609  template< typename MT // Type of the target dense matrix
610  , bool SO2 > // Storage order of the target dense matrix
611  friend inline typename EnableIf< UseAssign<MT> >::Type
612  assign( DenseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
613  {
615 
616  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
617  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
618 
619  if( !IsExpression<MT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
620  subAssign( ~lhs, rhs.rhs_ );
621  }
622  else {
623  assign ( ~lhs, rhs.lhs_ );
624  subAssign( ~lhs, rhs.rhs_ );
625  }
626  }
628  //**********************************************************************************************
629 
630  //**Assignment to sparse matrices***************************************************************
644  template< typename MT // Type of the target sparse matrix
645  , bool SO2 > // Storage order of the target sparse matrix
646  friend inline typename EnableIf< UseAssign<MT> >::Type
647  assign( SparseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
648  {
650 
652 
659 
660  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
661  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
662 
663  const TmpType tmp( serial( rhs ) );
664  assign( ~lhs, tmp );
665  }
667  //**********************************************************************************************
668 
669  //**Addition assignment to dense matrices*******************************************************
683  template< typename MT // Type of the target dense matrix
684  , bool SO2 > // Storage order of the target dense matrix
685  friend inline typename EnableIf< UseAssign<MT> >::Type
686  addAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
687  {
689 
690  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
691  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
692 
693  addAssign( ~lhs, rhs.lhs_ );
694  subAssign( ~lhs, rhs.rhs_ );
695  }
697  //**********************************************************************************************
698 
699  //**Addition assignment to sparse matrices******************************************************
700  // No special implementation for the addition assignment to sparse matrices.
701  //**********************************************************************************************
702 
703  //**Subtraction assignment to dense matrices****************************************************
717  template< typename MT // Type of the target dense matrix
718  , bool SO2 > // Storage order of the target dense matrix
719  friend inline typename EnableIf< UseAssign<MT> >::Type
720  subAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
721  {
723 
724  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
725  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
726 
727  subAssign( ~lhs, rhs.lhs_ );
728  addAssign( ~lhs, rhs.rhs_ );
729  }
731  //**********************************************************************************************
732 
733  //**Subtraction assignment to sparse matrices***************************************************
734  // No special implementation for the subtraction assignment to sparse matrices.
735  //**********************************************************************************************
736 
737  //**Multiplication assignment to dense matrices*************************************************
738  // No special implementation for the multiplication assignment to dense matrices.
739  //**********************************************************************************************
740 
741  //**Multiplication assignment to sparse matrices************************************************
742  // No special implementation for the multiplication assignment to sparse matrices.
743  //**********************************************************************************************
744 
745  //**SMP assignment to dense matrices************************************************************
759  template< typename MT // Type of the target dense matrix
760  , bool SO2 > // Storage order of the target dense matrix
761  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
762  smpAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
763  {
765 
766  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
767  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
768 
769  if( !IsExpression<MT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
770  smpSubAssign( ~lhs, rhs.rhs_ );
771  }
772  else {
773  smpAssign ( ~lhs, rhs.lhs_ );
774  smpSubAssign( ~lhs, rhs.rhs_ );
775  }
776  }
778  //**********************************************************************************************
779 
780  //**SMP assignment to sparse matrices***********************************************************
794  template< typename MT // Type of the target sparse matrix
795  , bool SO2 > // Storage order of the target sparse matrix
796  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
797  smpAssign( SparseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
798  {
800 
801  typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
802 
809 
810  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
811  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
812 
813  const TmpType tmp( rhs );
814  smpAssign( ~lhs, tmp );
815  }
817  //**********************************************************************************************
818 
819  //**SMP addition assignment to dense matrices***************************************************
833  template< typename MT // Type of the target dense matrix
834  , bool SO2 > // Storage order of the target dense matrix
835  friend inline typename EnableIf< UseAssign<MT> >::Type
836  smpAddAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
837  {
839 
840  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
841  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
842 
843  smpAddAssign( ~lhs, rhs.lhs_ );
844  smpSubAssign( ~lhs, rhs.rhs_ );
845  }
847  //**********************************************************************************************
848 
849  //**SMP addition assignment to sparse matrices**************************************************
850  // No special implementation for the SMP addition assignment to sparse matrices.
851  //**********************************************************************************************
852 
853  //**SMP subtraction assignment to dense matrices************************************************
867  template< typename MT // Type of the target dense matrix
868  , bool SO2 > // Storage order of the target dense matrix
869  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
870  smpSubAssign( DenseMatrix<MT,SO2>& lhs, const DMatDMatSubExpr& rhs )
871  {
873 
874  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
875  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
876 
877  smpSubAssign( ~lhs, rhs.lhs_ );
878  smpAddAssign( ~lhs, rhs.rhs_ );
879  }
881  //**********************************************************************************************
882 
883  //**SMP subtraction assignment to sparse matrices***********************************************
884  // No special implementation for the SMP subtraction assignment to sparse matrices.
885  //**********************************************************************************************
886 
887  //**SMP multiplication assignment to dense matrices*********************************************
888  // No special implementation for the SMP multiplication assignment to dense matrices.
889  //**********************************************************************************************
890 
891  //**SMP multiplication assignment to sparse matrices********************************************
892  // No special implementation for the SMP multiplication assignment to sparse matrices.
893  //**********************************************************************************************
894 
895  //**Compile time checks*************************************************************************
900  //**********************************************************************************************
901 };
902 //*************************************************************************************************
903 
904 
905 
906 
907 //=================================================================================================
908 //
909 // GLOBAL BINARY ARITHMETIC OPERATORS
910 //
911 //=================================================================================================
912 
913 //*************************************************************************************************
938 template< typename T1 // Type of the left-hand side dense matrix
939  , typename T2 // Type of the right-hand side dense matrix
940  , bool SO > // Storage order
941 inline const DMatDMatSubExpr<T1,T2,SO>
943 {
945 
946  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
947  throw std::invalid_argument( "Matrix sizes do not match" );
948 
949  return DMatDMatSubExpr<T1,T2,SO>( ~lhs, ~rhs );
950 }
951 //*************************************************************************************************
952 
953 
954 
955 
956 //=================================================================================================
957 //
958 // EXPRESSION TRAIT SPECIALIZATIONS
959 //
960 //=================================================================================================
961 
962 //*************************************************************************************************
964 template< typename MT1, typename MT2, bool SO, bool AF >
965 struct SubmatrixExprTrait< DMatDMatSubExpr<MT1,MT2,SO>, AF >
966 {
967  public:
968  //**********************************************************************************************
969  typedef typename SubExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
970  , typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
971  //**********************************************************************************************
972 };
974 //*************************************************************************************************
975 
976 
977 //*************************************************************************************************
979 template< typename MT1, typename MT2, bool SO >
980 struct RowExprTrait< DMatDMatSubExpr<MT1,MT2,SO> >
981 {
982  public:
983  //**********************************************************************************************
984  typedef typename SubExprTrait< typename RowExprTrait<const MT1>::Type
985  , typename RowExprTrait<const MT2>::Type >::Type Type;
986  //**********************************************************************************************
987 };
989 //*************************************************************************************************
990 
991 
992 //*************************************************************************************************
994 template< typename MT1, typename MT2, bool SO >
995 struct ColumnExprTrait< DMatDMatSubExpr<MT1,MT2,SO> >
996 {
997  public:
998  //**********************************************************************************************
999  typedef typename SubExprTrait< typename ColumnExprTrait<const MT1>::Type
1000  , typename ColumnExprTrait<const MT2>::Type >::Type Type;
1001  //**********************************************************************************************
1002 };
1004 //*************************************************************************************************
1005 
1006 } // namespace blaze
1007 
1008 #endif
Pointer difference type of the Blaze library.
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatDMatSubExpr.h:255
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatDMatSubExpr.h:287
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatDMatSubExpr.h:243
Header file for the subtraction trait.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatDMatSubExpr.h:550
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatSubExpr.h:341
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DMatDMatSubExpr.h:161
ElementType * PointerType
Pointer return type.
Definition: DMatDMatSubExpr.h:182
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
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DMatDMatSubExpr.h:158
#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
DMatDMatSubExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the DMatDMatSubExpr class.
Definition: DMatDMatSubExpr.h:439
#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()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDMatSubExpr.h:455
Header file for the ColumnExprTrait class template.
Header file for the IsSame and IsStrictlySame type traits.
IntrinsicType load() const
Access to the intrinsic elements of the matrix.
Definition: DMatDMatSubExpr.h:297
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
MT1::ReturnType RN1
Return type of the left-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:96
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatDMatSubExpr.h:265
PointerType pointer
Pointer return type.
Definition: DMatDMatSubExpr.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: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
MT2::ConstIterator RightIteratorType
ConstIterator type of the right-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:197
Header file for the RequiresEvaluation type trait.
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
Iterator over the elements of the dense matrix.
Definition: DMatDMatSubExpr.h:176
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.
ResultType::ElementType ElementType
Resulting element type.
Definition: DMatDMatSubExpr.h:157
MT1::CompositeType CT1
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:98
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
DifferenceType difference_type
Difference between two iterators.
Definition: DMatDMatSubExpr.h:191
RightOperand rhs_
Right-hand side dense matrix of the subtraction expression.
Definition: DMatDMatSubExpr.h:592
Expression object for dense matrix-dense matrix subtractions.The DMatDMatSubExpr class represents the...
Definition: DMatDMatSubExpr.h:88
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatDMatSubExpr.h:508
Header file for the IsTemporary type trait class.
SubTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DMatDMatSubExpr.h:154
Base class for all matrix/matrix subtraction expression templates.The MatMatSubExpr class serves as a...
Definition: MatMatSubExpr.h:65
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatDMatSubExpr.h:487
ElementType ValueType
Type of the underlying elements.
Definition: DMatDMatSubExpr.h:181
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
const size_t SMP_DMATDMATSUB_THRESHOLD
SMP row-major dense matrix/row-major dense matrix subtraction threshold.This threshold specifies when...
Definition: Thresholds.h:763
Header file for the DenseMatrix base class.
DMatDMatSubExpr< MT1, MT2, SO > This
Type of this DMatDMatSubExpr instance.
Definition: DMatDMatSubExpr.h:153
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatDMatSubExpr.h:180
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:167
RightIteratorType right_
Iterator to the current right-hand side element.
Definition: DMatDMatSubExpr.h:418
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
Header file for the MatMatSubExpr base class.
ReferenceType reference
Reference return type.
Definition: DMatDMatSubExpr.h:190
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatDMatSubExpr.h:583
ConstIterator(LeftIteratorType left, RightIteratorType right)
Constructor for the ConstIterator class.
Definition: DMatDMatSubExpr.h:206
#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
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDMatSubExpr.h:573
Constraints on the storage order of matrix types.
MT1::ElementType ET1
Element type of the left-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:100
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatDMatSubExpr.h:498
Evaluation of the return type of a subtraction expression.Via this type trait it is possible to evalu...
Definition: SubExprTrait.h:103
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatDMatSubExpr.h:156
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:170
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the serial shim.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatSubExpr.h:352
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDMatSubExpr.h:155
ValueType value_type
Type of the underlying elements.
Definition: DMatDMatSubExpr.h:188
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
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatDMatSubExpr.h:319
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatDMatSubExpr.h:374
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
MT2::CompositeType CT2
Composite type of the right-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:99
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Header file for run time assertion macros.
MT2::ElementType ET2
Element type of the right-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:101
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
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatDMatSubExpr.h:308
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatDMatSubExpr.h:398
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
MT2::ReturnType RN2
Return type of the right-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:97
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatDMatSubExpr.h:231
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatDMatSubExpr.h:410
#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
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatDMatSubExpr.h:363
RightOperand rightOperand() const
Returns the right-hand side dense matrix operand.
Definition: DMatDMatSubExpr.h:538
Header file for all intrinsic functionality.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatDMatSubExpr.h:184
IntrinsicType load(size_t i, size_t j) const
Access to the intrinsic elements of the matrix.
Definition: DMatDMatSubExpr.h:469
ElementType & ReferenceType
Reference return type.
Definition: DMatDMatSubExpr.h:183
MT2::ResultType RT2
Result type of the right-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:95
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
SelectType< useAssign, const ResultType, const DMatDMatSubExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatDMatSubExpr.h:164
IteratorCategory iterator_category
The iterator category.
Definition: DMatDMatSubExpr.h:187
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
LeftOperand leftOperand() const
Returns the left-hand side dense matrix operand.
Definition: DMatDMatSubExpr.h:528
SubExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DMatDMatSubExpr.h:114
#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
LeftIteratorType left_
Iterator to the current left-hand side element.
Definition: DMatDMatSubExpr.h:417
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatDMatSubExpr.h:563
Header file for basic type definitions.
MT1::ResultType RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:94
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatDMatSubExpr.h:330
MT1::ConstIterator LeftIteratorType
ConstIterator type of the left-hand side dense matrix expression.
Definition: DMatDMatSubExpr.h:194
Base template for the SubTrait class.
Definition: SubTrait.h:141
LeftOperand lhs_
Left-hand side dense matrix of the subtraction expression.
Definition: DMatDMatSubExpr.h:591
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatDMatSubExpr.h:386
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatDMatSubExpr.h:518
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatDMatSubExpr.h:277
Header file for the SubExprTrait class template.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
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.
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatDMatSubExpr.h:218