All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMatSMatAddExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATSMATADDEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATSMATADDEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
64 #include <blaze/util/Assert.h>
67 #include <blaze/util/SelectType.h>
68 #include <blaze/util/Types.h>
69 
70 
71 namespace blaze {
72 
73 //=================================================================================================
74 //
75 // CLASS DMATSMATADDEXPR
76 //
77 //=================================================================================================
78 
79 //*************************************************************************************************
86 template< typename MT1 // Type of the left-hand side dense matrix
87  , typename MT2 // Type of the right-hand side sparse matrix
88  , bool SO > // Storage order
89 class DMatSMatAddExpr : public DenseMatrix< DMatSMatAddExpr<MT1,MT2,SO>, SO >
90  , private MatMatAddExpr
91  , private Computation
92 {
93  private:
94  //**Type definitions****************************************************************************
95  typedef typename MT1::ResultType RT1;
96  typedef typename MT2::ResultType RT2;
97  typedef typename MT1::ReturnType RN1;
98  typedef typename MT2::ReturnType RN2;
99  //**********************************************************************************************
100 
101  //**Return type evaluation**********************************************************************
103 
108  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
109 
112  //**********************************************************************************************
113 
114  //**Parallel evaluation strategy****************************************************************
116 
121  template< typename MT >
122  struct UseSMPAssign {
123  enum { value = ( !MT1::smpAssignable || !MT2::smpAssignable ) };
124  };
126  //**********************************************************************************************
127 
128  public:
129  //**Type definitions****************************************************************************
135 
138 
140  typedef const ResultType CompositeType;
141 
143  typedef typename SelectType< IsExpression<MT1>::value, const MT1, const MT1& >::Type LeftOperand;
144 
146  typedef typename SelectType< IsExpression<MT2>::value, const MT2, const MT2& >::Type RightOperand;
147  //**********************************************************************************************
148 
149  //**Compilation flags***************************************************************************
151  enum { vectorizable = 0 };
152 
154  enum { smpAssignable = 0 };
155  //**********************************************************************************************
156 
157  //**Constructor*********************************************************************************
163  explicit inline DMatSMatAddExpr( const MT1& lhs, const MT2& rhs )
164  : lhs_( lhs ) // Left-hand side dense matrix of the addition expression
165  , rhs_( rhs ) // Right-hand side sparse matrix of the addition expression
166  {
167  BLAZE_INTERNAL_ASSERT( lhs.rows() == rhs.rows() , "Invalid number of rows" );
168  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.columns(), "Invalid number of columns" );
169  }
170  //**********************************************************************************************
171 
172  //**Access operator*****************************************************************************
179  inline ReturnType operator()( size_t i, size_t j ) const {
180  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
181  BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
182  return lhs_(i,j) + rhs_(i,j);
183  }
184  //**********************************************************************************************
185 
186  //**Rows function*******************************************************************************
191  inline size_t rows() const {
192  return lhs_.rows();
193  }
194  //**********************************************************************************************
195 
196  //**Columns function****************************************************************************
201  inline size_t columns() const {
202  return lhs_.columns();
203  }
204  //**********************************************************************************************
205 
206  //**Left operand access*************************************************************************
211  inline LeftOperand leftOperand() const {
212  return lhs_;
213  }
214  //**********************************************************************************************
215 
216  //**Right operand access************************************************************************
221  inline RightOperand rightOperand() const {
222  return rhs_;
223  }
224  //**********************************************************************************************
225 
226  //**********************************************************************************************
232  template< typename T >
233  inline bool canAlias( const T* alias ) const {
234  return ( IsExpression<MT1>::value && lhs_.canAlias( alias ) ) ||
235  ( rhs_.canAlias( alias ) );
236  }
237  //**********************************************************************************************
238 
239  //**********************************************************************************************
245  template< typename T >
246  inline bool isAliased( const T* alias ) const {
247  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
248  }
249  //**********************************************************************************************
250 
251  private:
252  //**Member variables****************************************************************************
255  //**********************************************************************************************
256 
257  //**Assignment to dense matrices****************************************************************
269  template< typename MT // Type of the target dense matrix
270  , bool SO2 > // Storage order of the target dense matrix
271  friend inline void assign( DenseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
272  {
274 
275  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
276  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
277 
278  if( !IsExpression<MT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
279  addAssign( ~lhs, rhs.rhs_ );
280  }
281  else {
282  assign ( ~lhs, rhs.lhs_ );
283  addAssign( ~lhs, rhs.rhs_ );
284  }
285  }
287  //**********************************************************************************************
288 
289  //**Assignment to sparse matrices***************************************************************
301  template< typename MT // Type of the target sparse matrix
302  , bool SO2 > // Storage order of the target sparse matrix
303  friend inline void assign( SparseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
304  {
306 
308 
315 
316  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
317  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
318 
319  const TmpType tmp( serial( rhs ) );
320  assign( ~lhs, tmp );
321  }
323  //**********************************************************************************************
324 
325  //**Addition assignment to dense matrices*******************************************************
337  template< typename MT // Type of the target dense matrix
338  , bool SO2 > // Storage order of the target dense matrix
339  friend inline void addAssign( DenseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
340  {
342 
343  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
344  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
345 
346  addAssign( ~lhs, rhs.lhs_ );
347  addAssign( ~lhs, rhs.rhs_ );
348  }
350  //**********************************************************************************************
351 
352  //**Addition assignment to sparse matrices******************************************************
353  // No special implementation for the addition assignment to sparse matrices.
354  //**********************************************************************************************
355 
356  //**Subtraction assignment to dense matrices****************************************************
368  template< typename MT // Type of the target dense matrix
369  , bool SO2 > // Storage order of the target dense matrix
370  friend inline void subAssign( DenseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
371  {
373 
374  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
375  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
376 
377  subAssign( ~lhs, rhs.lhs_ );
378  subAssign( ~lhs, rhs.rhs_ );
379  }
381  //**********************************************************************************************
382 
383  //**Subtraction assignment to sparse matrices***************************************************
384  // No special implementation for the subtraction assignment to sparse matrices.
385  //**********************************************************************************************
386 
387  //**Multiplication assignment to dense matrices*************************************************
388  // No special implementation for the multiplication assignment to dense matrices.
389  //**********************************************************************************************
390 
391  //**Multiplication assignment to sparse matrices************************************************
392  // No special implementation for the multiplication assignment to sparse matrices.
393  //**********************************************************************************************
394 
395  //**SMP assignment to dense matrices************************************************************
409  template< typename MT // Type of the target dense matrix
410  , bool SO2 > // Storage order of the target dense matrix
411  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
412  smpAssign( DenseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
413  {
415 
416  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
417  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
418 
419  if( !IsExpression<MT1>::value && isSame( ~lhs, rhs.lhs_ ) ) {
420  smpAddAssign( ~lhs, rhs.rhs_ );
421  }
422  else {
423  smpAssign ( ~lhs, rhs.lhs_ );
424  smpAddAssign( ~lhs, rhs.rhs_ );
425  }
426  }
428  //**********************************************************************************************
429 
430  //**SMP assignment to sparse matrices***********************************************************
444  template< typename MT // Type of the target sparse matrix
445  , bool SO2 > // Storage order of the target sparse matrix
446  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
447  smpAssign( SparseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
448  {
450 
451  typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
452 
459 
460  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
461  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
462 
463  const TmpType tmp( rhs );
464  smpAssign( ~lhs, tmp );
465  }
467  //**********************************************************************************************
468 
469  //**SMP addition assignment to dense matrices***************************************************
483  template< typename MT // Type of the target dense matrix
484  , bool SO2 > // Storage order of the target dense matrix
485  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
486  smpAddAssign( DenseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
487  {
489 
490  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
491  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
492 
493  smpAddAssign( ~lhs, rhs.lhs_ );
494  smpAddAssign( ~lhs, rhs.rhs_ );
495  }
497  //**********************************************************************************************
498 
499  //**SMP addition assignment to sparse matrices**************************************************
500  // No special implementation for the SMP addition assignment to sparse matrices.
501  //**********************************************************************************************
502 
503  //**SMP subtraction assignment to dense matrices************************************************
517  template< typename MT // Type of the target dense matrix
518  , bool SO2 > // Storage order of the target dense matrix
519  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
520  smpSubAssign( DenseMatrix<MT,SO2>& lhs, const DMatSMatAddExpr& rhs )
521  {
523 
524  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
525  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
526 
527  smpSubAssign( ~lhs, rhs.lhs_ );
528  smpSubAssign( ~lhs, rhs.rhs_ );
529  }
531  //**********************************************************************************************
532 
533  //**SMP subtraction assignment to sparse matrices***********************************************
534  // No special implementation for the SMP subtraction assignment to sparse matrices.
535  //**********************************************************************************************
536 
537  //**SMP multiplication assignment to dense matrices*********************************************
538  // No special implementation for the SMP multiplication assignment to dense matrices.
539  //**********************************************************************************************
540 
541  //**SMP multiplication assignment to sparse matrices********************************************
542  // No special implementation for the SMP multiplication assignment to sparse matrices.
543  //**********************************************************************************************
544 
545  //**Compile time checks*************************************************************************
551  //**********************************************************************************************
552 };
553 //*************************************************************************************************
554 
555 
556 
557 
558 //=================================================================================================
559 //
560 // GLOBAL BINARY ARITHMETIC OPERATORS
561 //
562 //=================================================================================================
563 
564 //*************************************************************************************************
590 template< typename T1 // Type of the left-hand side dense matrix
591  , typename T2 // Type of the right-hand side sparse matrix
592  , bool SO > // Storage order
593 inline const DMatSMatAddExpr<T1,T2,SO>
595 {
597 
598  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
599  throw std::invalid_argument( "Matrix sizes do not match" );
600 
601  return DMatSMatAddExpr<T1,T2,SO>( ~lhs, ~rhs );
602 }
603 //*************************************************************************************************
604 
605 
606 //*************************************************************************************************
632 template< typename T1 // Type of the left-hand side sparse matrix
633  , typename T2 // Type of the right-hand side dense matrix
634  , bool SO > // Storage order
635 inline const DMatSMatAddExpr<T2,T1,SO>
637 {
639 
640  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
641  throw std::invalid_argument( "Matrix sizes do not match" );
642 
643  return DMatSMatAddExpr<T2,T1,SO>( ~rhs, ~lhs );
644 }
645 //*************************************************************************************************
646 
647 
648 
649 
650 //=================================================================================================
651 //
652 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
653 //
654 //=================================================================================================
655 
656 //*************************************************************************************************
669 template< typename T1 // Type of the dense matrix of the left-hand side expression
670  , typename T2 // Type of the sparse matrix of the left-hand side expression
671  , bool SO1 // Storage order of the left-hand side expression
672  , typename T3 // Type of the right-hand side dense matrix
673  , bool SO2 > // Storage order of the right-hand side dense matrix
674 inline const typename AddExprTrait< DMatSMatAddExpr<T1,T2,SO1>, T3 >::Type
675  operator+( const DMatSMatAddExpr<T1,T2,SO1>& lhs, const DenseMatrix<T3,SO2>& rhs )
676 {
678 
679  return ( lhs.leftOperand() + (~rhs) ) + lhs.rightOperand();
680 }
682 //*************************************************************************************************
683 
684 
685 //*************************************************************************************************
698 template< typename T1 // Type of the dense matrix of the left-hand side expression
699  , typename T2 // Type of the sparse matrix of the left-hand side expression
700  , bool SO1 // Storage order of the left-hand side expression
701  , typename T3 // Type of the right-hand side dense matrix
702  , bool SO2 > // Storage order of the right-hand side dense matrix
703 inline const typename SubExprTrait< DMatSMatAddExpr<T1,T2,SO1>, T3 >::Type
704  operator-( const DMatSMatAddExpr<T1,T2,SO1>& lhs, const DenseMatrix<T3,SO2>& rhs )
705 {
707 
708  return ( lhs.leftOperand() - (~rhs) ) + lhs.rightOperand();
709 }
711 //*************************************************************************************************
712 
713 
714 
715 
716 //=================================================================================================
717 //
718 // EXPRESSION TRAIT SPECIALIZATIONS
719 //
720 //=================================================================================================
721 
722 //*************************************************************************************************
724 template< typename MT1, typename MT2, typename MT3 >
725 struct DMatDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
726 {
727  public:
728  //**********************************************************************************************
730  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
731  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
732  IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
733  , typename DMatSMatAddExprTrait< typename DMatDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
734  , INVALID_TYPE >::Type Type;
736  //**********************************************************************************************
737 };
739 //*************************************************************************************************
740 
741 
742 //*************************************************************************************************
744 template< typename MT1, typename MT2, typename MT3 >
745 struct DMatTDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
746 {
747  public:
748  //**********************************************************************************************
750  typedef typename SelectType< IsDenseMatrix <MT1>::value && IsRowMajorMatrix<MT1>::value &&
751  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
752  IsDenseMatrix <MT3>::value && IsColumnMajorMatrix<MT3>::value
753  , typename DMatSMatAddExprTrait< typename DMatTDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
754  , INVALID_TYPE >::Type Type;
756  //**********************************************************************************************
757 };
759 //*************************************************************************************************
760 
761 
762 //*************************************************************************************************
764 template< typename MT1, typename MT2, typename MT3 >
765 struct TDMatDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
766 {
767  public:
768  //**********************************************************************************************
770  typedef typename SelectType< IsDenseMatrix <MT1>::value && IsColumnMajorMatrix<MT1>::value &&
771  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
772  IsDenseMatrix <MT3>::value && IsRowMajorMatrix<MT3>::value
773  , typename DMatTSMatAddExprTrait< typename TDMatDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
774  , INVALID_TYPE >::Type Type;
776  //**********************************************************************************************
777 };
779 //*************************************************************************************************
780 
781 
782 //*************************************************************************************************
784 template< typename MT1, typename MT2, typename MT3 >
785 struct TDMatTDMatAddExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
786 {
787  public:
788  //**********************************************************************************************
790  typedef typename SelectType< IsDenseMatrix <MT1>::value && IsColumnMajorMatrix<MT1>::value &&
791  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
792  IsDenseMatrix <MT3>::value && IsColumnMajorMatrix<MT3>::value
793  , typename TDMatTSMatAddExprTrait< typename TDMatTDMatAddExprTrait<MT1,MT3>::Type, MT2 >::Type
794  , INVALID_TYPE >::Type Type;
796  //**********************************************************************************************
797 };
799 //*************************************************************************************************
800 
801 
802 //*************************************************************************************************
804 template< typename MT1, typename MT2, typename MT3 >
805 struct DMatDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
806 {
807  public:
808  //**********************************************************************************************
810  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
811  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
812  IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
813  , typename DMatSMatAddExprTrait< typename DMatDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
814  , INVALID_TYPE >::Type Type;
816  //**********************************************************************************************
817 };
819 //*************************************************************************************************
820 
821 
822 //*************************************************************************************************
824 template< typename MT1, typename MT2, typename MT3 >
825 struct DMatTDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,false>, MT3 >
826 {
827  public:
828  //**********************************************************************************************
830  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
831  IsSparseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
832  IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
833  , typename DMatSMatAddExprTrait< typename DMatTDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
834  , INVALID_TYPE >::Type Type;
836  //**********************************************************************************************
837 };
839 //*************************************************************************************************
840 
841 
842 //*************************************************************************************************
844 template< typename MT1, typename MT2, typename MT3 >
845 struct TDMatDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
846 {
847  public:
848  //**********************************************************************************************
850  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
851  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
852  IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
853  , typename DMatTSMatAddExprTrait< typename TDMatDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
854  , INVALID_TYPE >::Type Type;
856  //**********************************************************************************************
857 };
859 //*************************************************************************************************
860 
861 
862 //*************************************************************************************************
864 template< typename MT1, typename MT2, typename MT3 >
865 struct TDMatTDMatSubExprTrait< DMatSMatAddExpr<MT1,MT2,true>, MT3 >
866 {
867  public:
868  //**********************************************************************************************
870  typedef typename SelectType< IsDenseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
871  IsSparseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
872  IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
873  , typename TDMatTSMatAddExprTrait< typename TDMatTDMatSubExprTrait<MT1,MT3>::Type, MT2 >::Type
874  , INVALID_TYPE >::Type Type;
876  //**********************************************************************************************
877 };
879 //*************************************************************************************************
880 
881 
882 //*************************************************************************************************
884 template< typename MT1, typename MT2, bool SO, bool AF >
885 struct SubmatrixExprTrait< DMatSMatAddExpr<MT1,MT2,SO>, AF >
886 {
887  public:
888  //**********************************************************************************************
889  typedef typename AddExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
890  , typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
891  //**********************************************************************************************
892 };
894 //*************************************************************************************************
895 
896 
897 //*************************************************************************************************
899 template< typename MT1, typename MT2, bool SO >
900 struct RowExprTrait< DMatSMatAddExpr<MT1,MT2,SO> >
901 {
902  public:
903  //**********************************************************************************************
904  typedef typename AddExprTrait< typename RowExprTrait<const MT1>::Type
905  , typename RowExprTrait<const MT2>::Type >::Type Type;
906  //**********************************************************************************************
907 };
909 //*************************************************************************************************
910 
911 
912 //*************************************************************************************************
914 template< typename MT1, typename MT2, bool SO >
915 struct ColumnExprTrait< DMatSMatAddExpr<MT1,MT2,SO> >
916 {
917  public:
918  //**********************************************************************************************
919  typedef typename AddExprTrait< typename ColumnExprTrait<const MT1>::Type
920  , typename ColumnExprTrait<const MT2>::Type >::Type Type;
921  //**********************************************************************************************
922 };
924 //*************************************************************************************************
925 
926 } // namespace blaze
927 
928 #endif
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatSMatAddExpr.h:179
AddTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DMatSMatAddExpr.h:131
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: DMatSMatAddExpr.h:146
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatSMatAddExpr.h:132
Evaluation of the return type of an addition expression.Via this type trait it is possible to evaluat...
Definition: AddExprTrait.h:103
LeftOperand lhs_
Left-hand side dense matrix of the addition expression.
Definition: DMatSMatAddExpr.h:253
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
AddExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DMatSMatAddExpr.h:111
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
Header file for the IsSparseMatrix type trait.
#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
Header file for the ColumnExprTrait class template.
RightOperand rightOperand() const
Returns the right-hand side sparse matrix operand.
Definition: DMatSMatAddExpr.h:221
Header file for the IsColumnMajorMatrix type trait.
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
ResultType::ElementType ElementType
Resulting element type.
Definition: DMatSMatAddExpr.h:134
Header file for the AddExprTrait class template.
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
MT2::ResultType RT2
Result type of the right-hand side sparse matrix expression.
Definition: DMatSMatAddExpr.h:96
Header file for the Computation base class.
MT1::ResultType RT1
Result type of the left-hand side dense matrix expression.
Definition: DMatSMatAddExpr.h:95
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
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.
RightOperand rhs_
Right-hand side sparse matrix of the addition expression.
Definition: DMatSMatAddExpr.h:254
Constraint on the data type.
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 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.
Header file for the DenseMatrix base class.
DMatSMatAddExpr< MT1, MT2, SO > This
Type of this DMatSMatAddExpr instance.
Definition: DMatSMatAddExpr.h:130
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
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatSMatAddExpr.h:191
#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
const ResultType CompositeType
Data type for composite expression templates.
Definition: DMatSMatAddExpr.h:140
Constraints on the storage order of matrix types.
MT1::ReturnType RN1
Return type of the left-hand side dense matrix expression.
Definition: DMatSMatAddExpr.h:97
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 IsDenseMatrix type trait.
MT2::ReturnType RN2
Return type of the right-hand side sparse matrix expression.
Definition: DMatSMatAddExpr.h:98
Header file for the serial shim.
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 isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatSMatAddExpr.h:246
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:141
Header file for the addition trait.
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
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
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
Header file for the MatMatAddExpr base class.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DMatSMatAddExpr.h:137
#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
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatSMatAddExpr.h:143
LeftOperand leftOperand() const
Returns the left-hand side dense matrix operand.
Definition: DMatSMatAddExpr.h:211
Header file for the IsRowMajorMatrix type trait.
Expression object for dense matrix-sparse matrix additions.The DMatSMatAddExpr class represents the c...
Definition: DMatSMatAddExpr.h:89
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatSMatAddExpr.h:233
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatSMatAddExpr.h:133
#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.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatSMatAddExpr.h:201
Header file for the SubExprTrait class template.
#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
#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
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.
DMatSMatAddExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the DMatSMatAddExpr class.
Definition: DMatSMatAddExpr.h:163