All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SMatDMatSubExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATDMATSUBEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATDMATSUBEXPR_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 SMATDMATSUBEXPR
76 //
77 //=================================================================================================
78 
79 //*************************************************************************************************
86 template< typename MT1 // Type of the left-hand side sparse matrix
87  , typename MT2 // Type of the right-hand side dense matrix
88  , bool SO > // Storage order
89 class SMatDMatSubExpr : public DenseMatrix< SMatDMatSubExpr<MT1,MT2,SO>, SO >
90  , private MatMatSubExpr
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 SMatDMatSubExpr( const MT1& lhs, const MT2& rhs )
164  : lhs_( lhs ) // Left-hand side sparse matrix of the subtraction expression
165  , rhs_( rhs ) // Right-hand side dense matrix of the subtraction 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 ( lhs_.canAlias( alias ) ) ||
235  ( IsExpression<MT2>::value && 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 SMatDMatSubExpr& 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  assign ( ~lhs, -rhs.rhs_ );
279  addAssign( ~lhs, rhs.lhs_ );
280  }
282  //**********************************************************************************************
283 
284  //**Assignment to sparse matrices***************************************************************
296  template< typename MT // Type of the target sparse matrix
297  , bool SO2 > // Storage order of the target sparse matrix
298  friend inline void assign( SparseMatrix<MT,SO2>& lhs, const SMatDMatSubExpr& rhs )
299  {
301 
303 
310 
311  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
312  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
313 
314  const TmpType tmp( serial( rhs ) );
315  assign( ~lhs, tmp );
316  }
318  //**********************************************************************************************
319 
320  //**Addition assignment to dense matrices*******************************************************
332  template< typename MT // Type of the target dense matrix
333  , bool SO2 > // Storage order of the target dense matrix
334  friend inline void addAssign( DenseMatrix<MT,SO2>& lhs, const SMatDMatSubExpr& rhs )
335  {
337 
338  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
339  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
340 
341  subAssign( ~lhs, rhs.rhs_ );
342  addAssign( ~lhs, rhs.lhs_ );
343  }
345  //**********************************************************************************************
346 
347  //**Addition assignment to sparse matrices******************************************************
348  // No special implementation for the addition assignment to sparse matrices.
349  //**********************************************************************************************
350 
351  //**Subtraction assignment to dense matrices****************************************************
363  template< typename MT // Type of the target dense matrix
364  , bool SO2 > // Storage order of the target dense matrix
365  friend inline void subAssign( DenseMatrix<MT,SO2>& lhs, const SMatDMatSubExpr& rhs )
366  {
368 
369  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
370  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
371 
372  addAssign( ~lhs, rhs.rhs_ );
373  subAssign( ~lhs, rhs.lhs_ );
374  }
376  //**********************************************************************************************
377 
378  //**Subtraction assignment to sparse matrices***************************************************
379  // No special implementation for the subtraction assignment to sparse matrices.
380  //**********************************************************************************************
381 
382  //**Multiplication assignment to dense matrices*************************************************
383  // No special implementation for the multiplication assignment to dense matrices.
384  //**********************************************************************************************
385 
386  //**Multiplication assignment to sparse matrices************************************************
387  // No special implementation for the multiplication assignment to sparse matrices.
388  //**********************************************************************************************
389 
390  //**SMP assignment to dense matrices*************************************************************
404  template< typename MT // Type of the target dense matrix
405  , bool SO2 > // Storage order of the target dense matrix
406  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
407  smpAssign( DenseMatrix<MT,SO2>& lhs, const SMatDMatSubExpr& rhs )
408  {
410 
411  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
412  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
413 
414  smpAssign ( ~lhs, -rhs.rhs_ );
415  smpAddAssign( ~lhs, rhs.lhs_ );
416  }
418  //**********************************************************************************************
419 
420  //**SMP assignment to sparse matrices***********************************************************
434  template< typename MT // Type of the target sparse matrix
435  , bool SO2 > // Storage order of the target sparse matrix
436  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
437  smpAssign( SparseMatrix<MT,SO2>& lhs, const SMatDMatSubExpr& rhs )
438  {
440 
441  typedef typename SelectType< SO == SO2, ResultType, OppositeType >::Type TmpType;
442 
449 
450  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
451  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
452 
453  const TmpType tmp( rhs );
454  smpAssign( ~lhs, tmp );
455  }
457  //**********************************************************************************************
458 
459  //**SMP addition assignment to dense matrices***************************************************
473  template< typename MT // Type of the target dense matrix
474  , bool SO2 > // Storage order of the target dense matrix
475  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
476  smpAddAssign( DenseMatrix<MT,SO2>& lhs, const SMatDMatSubExpr& rhs )
477  {
479 
480  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
481  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
482 
483  smpSubAssign( ~lhs, rhs.rhs_ );
484  smpAddAssign( ~lhs, rhs.lhs_ );
485  }
487  //**********************************************************************************************
488 
489  //**SMP addition assignment to sparse matrices**************************************************
490  // No special implementation for the SMP addition assignment to sparse matrices.
491  //**********************************************************************************************
492 
493  //**SMP subtraction assignment to dense matrices************************************************
507  template< typename MT // Type of the target dense matrix
508  , bool SO2 > // Storage order of the target dense matrix
509  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
510  smpSubAssign( DenseMatrix<MT,SO2>& lhs, const SMatDMatSubExpr& rhs )
511  {
513 
514  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
515  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
516 
517  smpAddAssign( ~lhs, rhs.rhs_ );
518  smpSubAssign( ~lhs, rhs.lhs_ );
519  }
521  //**********************************************************************************************
522 
523  //**SMP subtraction assignment to sparse matrices***********************************************
524  // No special implementation for the SMP subtraction assignment to sparse matrices.
525  //**********************************************************************************************
526 
527  //**SMP multiplication assignment to dense matrices*********************************************
528  // No special implementation for the SMP multiplication assignment to dense matrices.
529  //**********************************************************************************************
530 
531  //**SMP multiplication assignment to sparse matrices********************************************
532  // No special implementation for the SMP multiplication assignment to sparse matrices.
533  //**********************************************************************************************
534 
535  //**Compile time checks*************************************************************************
541  //**********************************************************************************************
542 };
543 //*************************************************************************************************
544 
545 
546 
547 
548 //=================================================================================================
549 //
550 // GLOBAL BINARY ARITHMETIC OPERATORS
551 //
552 //=================================================================================================
553 
554 //*************************************************************************************************
583 template< typename T1 // Type of the left-hand side sparse matrix
584  , typename T2 // Type of the right-hand side dense matrix
585  , bool SO > // Storage order
586 inline const SMatDMatSubExpr<T1,T2,SO>
588 {
590 
591  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
592  throw std::invalid_argument( "Matrix sizes do not match" );
593 
594  return SMatDMatSubExpr<T1,T2,SO>( ~lhs, ~rhs );
595 }
596 //*************************************************************************************************
597 
598 
599 
600 
601 //=================================================================================================
602 //
603 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
604 //
605 //=================================================================================================
606 
607 //*************************************************************************************************
620 template< typename T1 // Type of the sparse matrix of the left-hand side expression
621  , typename T2 // Type of the dense matrix of the left-hand side expression
622  , bool SO1 // Storage order of the left-hand side expression
623  , typename T3 // Type of the right-hand side dense matrix
624  , bool SO2 > // Storage order of the right-hand side dense matrix
625 inline const typename AddExprTrait< SMatDMatSubExpr<T1,T2,SO1>, T3 >::Type
626  operator+( const SMatDMatSubExpr<T1,T2,SO1>& lhs, const DenseMatrix<T3,SO2>& rhs )
627 {
629 
630  return ( (~rhs) - lhs.rightOperand() ) + lhs.leftOperand();
631 }
633 //*************************************************************************************************
634 
635 
636 //*************************************************************************************************
649 template< typename T1 // Type of the sparse matrix of the left-hand side expression
650  , typename T2 // Type of the dense matrix of the left-hand side expression
651  , bool SO1 // Storage order of the left-hand side expression
652  , typename T3 // Type of the right-hand side dense matrix
653  , bool SO2 > // Storage order of the right-hand side dense matrix
654 inline const typename SubExprTrait< SMatDMatSubExpr<T1,T2,SO1>, T3 >::Type
655  operator-( const SMatDMatSubExpr<T1,T2,SO1>& lhs, const DenseMatrix<T3,SO2>& rhs )
656 {
658 
659  return lhs.leftOperand() - ( lhs.rightOperand() + (~rhs) );
660 }
662 //*************************************************************************************************
663 
664 
665 
666 
667 //=================================================================================================
668 //
669 // EXPRESSION TRAIT SPECIALIZATIONS
670 //
671 //=================================================================================================
672 
673 //*************************************************************************************************
675 template< typename MT1, typename MT2, typename MT3 >
676 struct DMatDMatAddExprTrait< SMatDMatSubExpr<MT1,MT2,false>, MT3 >
677 {
678  public:
679  //**********************************************************************************************
681  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
682  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
683  IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
684  , typename DMatSMatAddExprTrait< typename DMatDMatSubExprTrait<MT3,MT2>::Type, MT1 >::Type
685  , INVALID_TYPE >::Type Type;
687  //**********************************************************************************************
688 };
690 //*************************************************************************************************
691 
692 
693 //*************************************************************************************************
695 template< typename MT1, typename MT2, typename MT3 >
696 struct DMatTDMatAddExprTrait< SMatDMatSubExpr<MT1,MT2,false>, MT3 >
697 {
698  public:
699  //**********************************************************************************************
701  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
702  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
703  IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
704  , typename DMatSMatAddExprTrait< typename TDMatDMatSubExprTrait<MT3,MT2>::Type, MT1 >::Type
705  , INVALID_TYPE >::Type Type;
707  //**********************************************************************************************
708 };
710 //*************************************************************************************************
711 
712 
713 //*************************************************************************************************
715 template< typename MT1, typename MT2, typename MT3 >
716 struct TDMatDMatAddExprTrait< SMatDMatSubExpr<MT1,MT2,true>, MT3 >
717 {
718  public:
719  //**********************************************************************************************
721  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
722  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
723  IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
724  , typename DMatTSMatAddExprTrait< typename DMatTDMatSubExprTrait<MT3,MT2>::Type, MT1 >::Type
725  , INVALID_TYPE >::Type Type;
727  //**********************************************************************************************
728 };
730 //*************************************************************************************************
731 
732 
733 //*************************************************************************************************
735 template< typename MT1, typename MT2, typename MT3 >
736 struct TDMatTDMatAddExprTrait< SMatDMatSubExpr<MT1,MT2,true>, MT3 >
737 {
738  public:
739  //**********************************************************************************************
741  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
742  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
743  IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
744  , typename TDMatTSMatAddExprTrait< typename TDMatTDMatSubExprTrait<MT3,MT2>::Type, MT1 >::Type
745  , INVALID_TYPE >::Type Type;
747  //**********************************************************************************************
748 };
750 //*************************************************************************************************
751 
752 
753 //*************************************************************************************************
755 template< typename MT1, typename MT2, typename MT3 >
756 struct DMatDMatSubExprTrait< SMatDMatSubExpr<MT1,MT2,false>, MT3 >
757 {
758  public:
759  //**********************************************************************************************
761  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
762  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
763  IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
764  , typename SMatDMatSubExprTrait< MT1, typename DMatDMatAddExprTrait<MT2,MT3>::Type >::Type
765  , INVALID_TYPE >::Type Type;
767  //**********************************************************************************************
768 };
770 //*************************************************************************************************
771 
772 
773 //*************************************************************************************************
775 template< typename MT1, typename MT2, typename MT3 >
776 struct DMatTDMatSubExprTrait< SMatDMatSubExpr<MT1,MT2,false>, MT3 >
777 {
778  public:
779  //**********************************************************************************************
781  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
782  IsDenseMatrix<MT2>::value && IsRowMajorMatrix<MT2>::value &&
783  IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
784  , typename SMatDMatSubExprTrait< MT1, typename DMatTDMatAddExprTrait<MT2,MT3>::Type >::Type
785  , INVALID_TYPE >::Type Type;
787  //**********************************************************************************************
788 };
790 //*************************************************************************************************
791 
792 
793 //*************************************************************************************************
795 template< typename MT1, typename MT2, typename MT3 >
796 struct TDMatDMatSubExprTrait< SMatDMatSubExpr<MT1,MT2,true>, MT3 >
797 {
798  public:
799  //**********************************************************************************************
801  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
802  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
803  IsDenseMatrix<MT3>::value && IsRowMajorMatrix<MT3>::value
804  , typename TSMatDMatSubExprTrait< MT1, typename TDMatDMatAddExprTrait<MT2,MT3>::Type >::Type
805  , INVALID_TYPE >::Type Type;
807  //**********************************************************************************************
808 };
810 //*************************************************************************************************
811 
812 
813 //*************************************************************************************************
815 template< typename MT1, typename MT2, typename MT3 >
816 struct TDMatTDMatSubExprTrait< SMatDMatSubExpr<MT1,MT2,true>, MT3 >
817 {
818  public:
819  //**********************************************************************************************
821  typedef typename SelectType< IsSparseMatrix<MT1>::value && IsColumnMajorMatrix<MT1>::value &&
822  IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
823  IsDenseMatrix<MT3>::value && IsColumnMajorMatrix<MT3>::value
824  , typename TSMatTDMatSubExprTrait< MT1, typename TDMatTDMatAddExprTrait<MT2,MT3>::Type >::Type
825  , INVALID_TYPE >::Type Type;
827  //**********************************************************************************************
828 };
830 //*************************************************************************************************
831 
832 
833 //*************************************************************************************************
835 template< typename MT1, typename MT2, bool SO, bool AF >
836 struct SubmatrixExprTrait< SMatDMatSubExpr<MT1,MT2,SO>, AF >
837 {
838  public:
839  //**********************************************************************************************
840  typedef typename SubExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
841  , typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
842  //**********************************************************************************************
843 };
845 //*************************************************************************************************
846 
847 
848 //*************************************************************************************************
850 template< typename MT1, typename MT2, bool SO >
851 struct RowExprTrait< SMatDMatSubExpr<MT1,MT2,SO> >
852 {
853  public:
854  //**********************************************************************************************
855  typedef typename SubExprTrait< typename RowExprTrait<const MT1>::Type
856  , typename RowExprTrait<const MT2>::Type >::Type Type;
857  //**********************************************************************************************
858 };
860 //*************************************************************************************************
861 
862 
863 //*************************************************************************************************
865 template< typename MT1, typename MT2, bool SO >
866 struct ColumnExprTrait< SMatDMatSubExpr<MT1,MT2,SO> >
867 {
868  public:
869  //**********************************************************************************************
870  typedef typename SubExprTrait< typename ColumnExprTrait<const MT1>::Type
871  , typename ColumnExprTrait<const MT2>::Type >::Type Type;
872  //**********************************************************************************************
873 };
875 //*************************************************************************************************
876 
877 } // namespace blaze
878 
879 #endif
MT1::ReturnType RN1
Return type of the left-hand side sparse matrix expression.
Definition: SMatDMatSubExpr.h:97
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
Header file for the subtraction trait.
LeftOperand leftOperand() const
Returns the left-hand side sparse matrix operand.
Definition: SMatDMatSubExpr.h:211
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.
RightOperand rightOperand() const
Returns the right-hand side dense matrix operand.
Definition: SMatDMatSubExpr.h:221
#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
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatDMatSubExpr.h:179
#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
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatDMatSubExpr.h:246
SubExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SMatDMatSubExpr.h:111
Header file for the ColumnExprTrait class template.
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
Header file for the AddExprTrait class template.
SMatDMatSubExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the SMatDMatSubExpr class.
Definition: SMatDMatSubExpr.h:163
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.
MT2::ReturnType RN2
Return type of the right-hand side dense matrix expression.
Definition: SMatDMatSubExpr.h:98
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.
SubTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: SMatDMatSubExpr.h:131
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
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: SMatDMatSubExpr.h:143
Expression object for sparse matrix-dense matrix subtractions.The SMatDMatSubExpr class represents th...
Definition: Forward.h:90
const ResultType CompositeType
Data type for composite expression templates.
Definition: SMatDMatSubExpr.h:140
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.
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: SMatDMatSubExpr.h:146
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SMatDMatSubExpr.h:137
Header file for the DenseMatrix base class.
ResultType::ElementType ElementType
Resulting element type.
Definition: SMatDMatSubExpr.h:134
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.
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 columns() const
Returns the current number of columns of the matrix.
Definition: SMatDMatSubExpr.h:201
RightOperand rhs_
Right-hand side dense matrix of the subtraction expression.
Definition: SMatDMatSubExpr.h:254
#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.
Evaluation of the return type of a subtraction expression.Via this type trait it is possible to evalu...
Definition: SubExprTrait.h:103
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.
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
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatDMatSubExpr.h:133
SMatDMatSubExpr< MT1, MT2, SO > This
Type of this SMatDMatSubExpr instance.
Definition: SMatDMatSubExpr.h:130
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
MT1::ResultType RT1
Result type of the left-hand side sparse matrix expression.
Definition: SMatDMatSubExpr.h:95
Header file for run time assertion macros.
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
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatDMatSubExpr.h:191
LeftOperand lhs_
Left-hand side sparse matrix of the subtraction expression.
Definition: SMatDMatSubExpr.h:253
#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
Header file for the IsRowMajorMatrix type trait.
MT2::ResultType RT2
Result type of the right-hand side dense matrix expression.
Definition: SMatDMatSubExpr.h:96
#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
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatDMatSubExpr.h:233
Header file for basic type definitions.
Base template for the SubTrait class.
Definition: SubTrait.h:141
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatDMatSubExpr.h:132
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.