All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSMatTSMatAddExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATTSMATADDEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATTSMATADDEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
69 #include <blaze/util/Assert.h>
70 #include <blaze/util/DisableIf.h>
71 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/mpl/Max.h>
74 #include <blaze/util/SelectType.h>
75 #include <blaze/util/Types.h>
78 
79 
80 namespace blaze {
81 
82 //=================================================================================================
83 //
84 // CLASS TSMATTSMATADDEXPR
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
95 template< typename MT1 // Type of the left-hand side sparse matrix
96  , typename MT2 > // Type of the right-hand side sparse matrix
97 class TSMatTSMatAddExpr : public SparseMatrix< TSMatTSMatAddExpr<MT1,MT2>, true >
98  , private MatMatAddExpr
99  , private Computation
100 {
101  private:
102  //**Type definitions****************************************************************************
103  typedef typename MT1::ResultType RT1;
104  typedef typename MT2::ResultType RT2;
105  typedef typename MT1::ReturnType RN1;
106  typedef typename MT2::ReturnType RN2;
107  typedef typename MT1::CompositeType CT1;
108  typedef typename MT2::CompositeType CT2;
109  //**********************************************************************************************
110 
111  //**Return type evaluation**********************************************************************
113 
118  enum { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
119 
122  //**********************************************************************************************
123 
124  //**Serial evaluation strategy******************************************************************
126 
131  template< typename T1, typename T2, typename T3 >
132  struct UseSymmetricKernel {
135  };
137  //**********************************************************************************************
138 
139  //**Parallel evaluation strategy****************************************************************
141 
146  template< typename MT >
147  struct UseSMPAssign {
148  enum { value = MT::smpAssignable };
149  };
151  //**********************************************************************************************
152 
153  public:
154  //**Type definitions****************************************************************************
160 
163 
165  typedef const ResultType CompositeType;
166 
168  typedef typename SelectType< IsExpression<MT1>::value, const MT1, const MT1& >::Type LeftOperand;
169 
171  typedef typename SelectType< IsExpression<MT2>::value, const MT2, const MT2& >::Type RightOperand;
172  //**********************************************************************************************
173 
174  //**Compilation flags***************************************************************************
176  enum { smpAssignable = 0 };
177  //**********************************************************************************************
178 
179  //**Constructor*********************************************************************************
185  explicit inline TSMatTSMatAddExpr( const MT1& lhs, const MT2& rhs )
186  : lhs_( lhs ) // Left-hand side sparse matrix of the addition expression
187  , rhs_( rhs ) // Right-hand side sparse matrix of the addition expression
188  {
189  BLAZE_INTERNAL_ASSERT( lhs.rows() == rhs.rows() , "Invalid number of rows" );
190  BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.columns(), "Invalid number of columns" );
191  }
192  //**********************************************************************************************
193 
194  //**Access operator*****************************************************************************
201  inline ReturnType operator()( size_t i, size_t j ) const {
202  BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
203  BLAZE_INTERNAL_ASSERT( j < lhs_.columns(), "Invalid column access index" );
204  return lhs_(i,j) + rhs_(i,j);
205  }
206  //**********************************************************************************************
207 
208  //**Rows function*******************************************************************************
213  inline size_t rows() const {
214  return lhs_.rows();
215  }
216  //**********************************************************************************************
217 
218  //**Columns function****************************************************************************
223  inline size_t columns() const {
224  return lhs_.columns();
225  }
226  //**********************************************************************************************
227 
228  //**NonZeros function***************************************************************************
233  inline size_t nonZeros() const {
234  return lhs_.nonZeros() + rhs_.nonZeros();
235  }
236  //**********************************************************************************************
237 
238  //**NonZeros function***************************************************************************
244  inline size_t nonZeros( size_t i ) const {
245  return lhs_.nonZeros(i) + rhs_.nonZeros(i);
246  }
247  //**********************************************************************************************
248 
249  //**Left operand access*************************************************************************
254  inline LeftOperand leftOperand() const {
255  return lhs_;
256  }
257  //**********************************************************************************************
258 
259  //**Right operand access************************************************************************
264  inline RightOperand rightOperand() const {
265  return rhs_;
266  }
267  //**********************************************************************************************
268 
269  //**********************************************************************************************
275  template< typename T >
276  inline bool canAlias( const T* alias ) const {
277  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
278  }
279  //**********************************************************************************************
280 
281  //**********************************************************************************************
287  template< typename T >
288  inline bool isAliased( const T* alias ) const {
289  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
290  }
291  //**********************************************************************************************
292 
293  private:
294  //**Member variables****************************************************************************
297  //**********************************************************************************************
298 
299  //**Assignment to dense matrices****************************************************************
312  template< typename MT // Type of the target dense matrix
313  , bool SO > // Storage order of the target dense matrix
314  friend inline void assign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatAddExpr& rhs )
315  {
317 
318  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
319  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
320 
321  typedef typename RemoveReference<CT2>::Type::ConstIterator RightIterator;
322 
323  assign( ~lhs, rhs.lhs_ );
324 
326  addAssign( ~lhs, rhs.rhs_ );
327  }
328  else
329  {
330  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
331 
332  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
333  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
334  BLAZE_INTERNAL_ASSERT( B.rows() == (~lhs).rows() , "Invalid number of rows" );
335  BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
336 
337  for( size_t j=0UL; j<(~lhs).columns(); ++j ) {
338  const RightIterator end( B.end(j) );
339  for( RightIterator element=B.begin(j); element!=end; ++element ) {
340  if( isDefault( (~lhs)(element->index(),j) ) )
341  (~lhs)(element->index(),j) = element->value();
342  else
343  (~lhs)(element->index(),j) += element->value();
344  }
345  }
346  }
347  }
349  //**********************************************************************************************
350 
351  //**Assignment to row-major sparse matrices*****************************************************
364  template< typename MT > // Type of the target sparse matrix
365  friend inline typename DisableIf< UseSymmetricKernel<MT,MT1,MT2> >::Type
367  {
369 
371 
372  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
373  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
374 
375  typedef typename RemoveReference<CT1>::Type::ConstIterator LeftIterator;
376  typedef typename RemoveReference<CT2>::Type::ConstIterator RightIterator;
377 
378  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
379  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
380 
381  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
382  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
383  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
384  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
385  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
386  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).columns() , "Invalid number of columns" );
387 
388  const size_t m( rhs.rows() );
389  const size_t n( rhs.columns() );
390 
391  // Counting the number of elements per column
392  std::vector<size_t> nonzeros( m, 0UL );
393  for( size_t j=0UL; j<n; ++j )
394  {
395  const LeftIterator lend( A.end(j) );
396  const RightIterator rend( B.end(j) );
397 
398  LeftIterator l( A.begin(j) );
399  RightIterator r( B.begin(j) );
400 
401  while( l != lend && r != rend )
402  {
403  if( l->index() < r->index() ) {
404  ++nonzeros[l->index()];
405  ++l;
406  }
407  else if( l->index() > r->index() ) {
408  ++nonzeros[r->index()];
409  ++r;
410  }
411  else {
412  ++nonzeros[l->index()];
413  ++l;
414  ++r;
415  }
416  }
417 
418  while( l != lend ) {
419  ++nonzeros[l->index()];
420  ++l;
421  }
422 
423  while( r != rend ) {
424  ++nonzeros[r->index()];
425  ++r;
426  }
427  }
428 
429  // Resizing the left-hand side sparse matrix
430  for( size_t i=0UL; i<m; ++i ) {
431  (~lhs).reserve( i, nonzeros[i] );
432  }
433 
434  // Performing the matrix addition
435  for( size_t j=0UL; j<n; ++j )
436  {
437  const LeftIterator lend( A.end(j) );
438  const RightIterator rend( B.end(j) );
439 
440  LeftIterator l( A.begin(j) );
441  RightIterator r( B.begin(j) );
442 
443  while( l != lend && r != rend )
444  {
445  if( l->index() < r->index() ) {
446  (~lhs).append( l->index(), j, l->value() );
447  ++l;
448  }
449  else if( l->index() > r->index() ) {
450  (~lhs).append( r->index(), j, r->value() );
451  ++r;
452  }
453  else {
454  (~lhs).append( l->index(), j, l->value()+r->value() );
455  ++l;
456  ++r;
457  }
458  }
459 
460  while( l != lend ) {
461  (~lhs).append( l->index(), j, l->value() );
462  ++l;
463  }
464 
465  while( r != rend ) {
466  (~lhs).append( r->index(), j, r->value() );
467  ++r;
468  }
469  }
470  }
472  //**********************************************************************************************
473 
474  //**Assignment to row-major sparse matrices*****************************************************
487  template< typename MT > // Type of the target sparse matrix
488  friend inline typename EnableIf< UseSymmetricKernel<MT,MT1,MT2> >::Type
489  assign( SparseMatrix<MT,false>& lhs, const TSMatTSMatAddExpr& rhs )
490  {
492 
494 
495  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
496  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
497 
498  assign( ~lhs, trans( rhs.lhs_ ) + trans( rhs.rhs_ ) );
499  }
501  //**********************************************************************************************
502 
503  //**Assignment to column-major sparse matrices**************************************************
516  template< typename MT > // Type of the target sparse matrix
517  friend inline void assign( SparseMatrix<MT,true>& lhs, const TSMatTSMatAddExpr& rhs )
518  {
520 
521  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
522  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
523 
524  typedef typename RemoveReference<CT1>::Type::ConstIterator LeftIterator;
525  typedef typename RemoveReference<CT2>::Type::ConstIterator RightIterator;
526 
527  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
528  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
529 
530  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
531  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
532  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
533  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
534  BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
535  BLAZE_INTERNAL_ASSERT( A.columns() == (~lhs).columns() , "Invalid number of columns" );
536 
537  // Final memory allocation (based on the evaluated operands)
538  (~lhs).reserve( A.nonZeros() + B.nonZeros() );
539 
540  // Performing the matrix addition
541  for( size_t j=0UL; j<(~lhs).columns(); ++j )
542  {
543  const LeftIterator lend( A.end(j) );
544  const RightIterator rend( B.end(j) );
545 
546  LeftIterator l( A.begin(j) );
547  RightIterator r( B.begin(j) );
548 
549  while( l != lend && r != rend )
550  {
551  if( l->index() < r->index() ) {
552  (~lhs).append( l->index(), j, l->value() );
553  ++l;
554  }
555  else if( l->index() > r->index() ) {
556  (~lhs).append( r->index(), j, r->value() );
557  ++r;
558  }
559  else {
560  (~lhs).append( l->index(), j, l->value()+r->value() );
561  ++l;
562  ++r;
563  }
564  }
565 
566  while( l != lend ) {
567  (~lhs).append( l->index(), j, l->value() );
568  ++l;
569  }
570 
571  while( r != rend ) {
572  (~lhs).append( r->index(), j, r->value() );
573  ++r;
574  }
575 
576  (~lhs).finalize( j );
577  }
578  }
580  //**********************************************************************************************
581 
582  //**Addition assignment to dense matrices*******************************************************
595  template< typename MT // Type of the target dense matrix
596  , bool SO > // Storage order of the target dense matrix
597  friend inline void addAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatAddExpr& rhs )
598  {
600 
601  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
602  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
603 
604  addAssign( ~lhs, rhs.lhs_ );
605  addAssign( ~lhs, rhs.rhs_ );
606  }
608  //**********************************************************************************************
609 
610  //**Addition assignment to sparse matrices******************************************************
611  // No special implementation for the addition assignment to sparse matrices.
612  //**********************************************************************************************
613 
614  //**Subtraction assignment to dense matrices****************************************************
627  template< typename MT // Type of the target dense matrix
628  , bool SO > // Storage order of the target dense matrix
629  friend inline void subAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatAddExpr& rhs )
630  {
632 
633  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
634  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
635 
636  subAssign( ~lhs, rhs.lhs_ );
637  subAssign( ~lhs, rhs.rhs_ );
638  }
640  //**********************************************************************************************
641 
642  //**Subtraction assignment to sparse matrices***************************************************
643  // No special implementation for the subtraction assignment to sparse matrices.
644  //**********************************************************************************************
645 
646  //**Multiplication assignment to dense matrices*************************************************
647  // No special implementation for the multiplication assignment to dense matrices.
648  //**********************************************************************************************
649 
650  //**Multiplication assignment to sparse matrices************************************************
651  // No special implementation for the multiplication assignment to sparse matrices.
652  //**********************************************************************************************
653 
654  //**SMP assignment to dense matrices************************************************************
655  // No special implementation for the SMP assignment to dense matrices.
656  //**********************************************************************************************
657 
658  //**SMP assignment to sparse matrices***********************************************************
659  // No special implementation for the SMP assignment to sparse matrices.
660  //**********************************************************************************************
661 
662  //**SMP addition assignment to dense matrices***************************************************
677  template< typename MT // Type of the target dense matrix
678  , bool SO > // Storage order of the target dense matrix
679  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
680  smpAddAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatAddExpr& rhs )
681  {
683 
684  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
685  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
686 
687  smpAddAssign( ~lhs, rhs.lhs_ );
688  smpAddAssign( ~lhs, rhs.rhs_ );
689  }
691  //**********************************************************************************************
692 
693  //**SMP addition assignment to sparse matrices**************************************************
694  // No special implementation for the SMP addition assignment to sparse matrices.
695  //**********************************************************************************************
696 
697  //**SMP subtraction assignment to dense matrices************************************************
712  template< typename MT // Type of the target dense matrix
713  , bool SO > // Storage order of the target dense matrix
714  friend inline typename EnableIf< UseSMPAssign<MT> >::Type
715  smpSubAssign( DenseMatrix<MT,SO>& lhs, const TSMatTSMatAddExpr& rhs )
716  {
718 
719  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
720  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
721 
722  smpSubAssign( ~lhs, rhs.lhs_ );
723  smpSubAssign( ~lhs, rhs.rhs_ );
724  }
726  //**********************************************************************************************
727 
728  //**SMP subtraction assignment to sparse matrices***********************************************
729  // No special implementation for the SMP subtraction assignment to sparse matrices.
730  //**********************************************************************************************
731 
732  //**SMP multiplication assignment to dense matrices*********************************************
733  // No special implementation for the SMP multiplication assignment to dense matrices.
734  //**********************************************************************************************
735 
736  //**SMP multiplication assignment to sparse matrices********************************************
737  // No special implementation for the SMP multiplication assignment to sparse matrices.
738  //**********************************************************************************************
739 
740  //**Compile time checks*************************************************************************
748  //**********************************************************************************************
749 };
750 //*************************************************************************************************
751 
752 
753 
754 
755 //=================================================================================================
756 //
757 // GLOBAL BINARY ARITHMETIC OPERATORS
758 //
759 //=================================================================================================
760 
761 //*************************************************************************************************
787 template< typename T1 // Type of the left-hand side sparse matrix
788  , typename T2 > // Type of the right-hand side sparse matrix
789 inline const TSMatTSMatAddExpr<T1,T2>
791 {
793 
794  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
795  throw std::invalid_argument( "Matrix sizes do not match" );
796 
797  return TSMatTSMatAddExpr<T1,T2>( ~lhs, ~rhs );
798 }
799 //*************************************************************************************************
800 
801 
802 
803 
804 //=================================================================================================
805 //
806 // ROWS SPECIALIZATIONS
807 //
808 //=================================================================================================
809 
810 //*************************************************************************************************
812 template< typename MT1, typename MT2 >
813 struct Rows< TSMatTSMatAddExpr<MT1,MT2> >
814  : public Max< Rows<MT1>, Rows<MT2> >::Type
815 {};
817 //*************************************************************************************************
818 
819 
820 
821 
822 //=================================================================================================
823 //
824 // COLUMNS SPECIALIZATIONS
825 //
826 //=================================================================================================
827 
828 //*************************************************************************************************
830 template< typename MT1, typename MT2 >
831 struct Columns< TSMatTSMatAddExpr<MT1,MT2> >
832  : public Max< Columns<MT1>, Columns<MT2> >::Type
833 {};
835 //*************************************************************************************************
836 
837 
838 
839 
840 //=================================================================================================
841 //
842 // ISSYMMETRIC SPECIALIZATIONS
843 //
844 //=================================================================================================
845 
846 //*************************************************************************************************
848 template< typename MT1, typename MT2 >
849 struct IsSymmetric< TSMatTSMatAddExpr<MT1,MT2> >
850  : public IsTrue< IsSymmetric<MT1>::value && IsSymmetric<MT2>::value >
851 {};
853 //*************************************************************************************************
854 
855 
856 
857 
858 //=================================================================================================
859 //
860 // ISLOWER SPECIALIZATIONS
861 //
862 //=================================================================================================
863 
864 //*************************************************************************************************
866 template< typename MT1, typename MT2 >
867 struct IsLower< TSMatTSMatAddExpr<MT1,MT2> >
868  : public IsTrue< IsLower<MT1>::value && IsLower<MT2>::value >
869 {};
871 //*************************************************************************************************
872 
873 
874 
875 
876 //=================================================================================================
877 //
878 // ISUPPER SPECIALIZATIONS
879 //
880 //=================================================================================================
881 
882 //*************************************************************************************************
884 template< typename MT1, typename MT2 >
885 struct IsUpper< TSMatTSMatAddExpr<MT1,MT2> >
886  : public IsTrue< IsUpper<MT1>::value && IsUpper<MT2>::value >
887 {};
889 //*************************************************************************************************
890 
891 
892 
893 
894 //=================================================================================================
895 //
896 // EXPRESSION TRAIT SPECIALIZATIONS
897 //
898 //=================================================================================================
899 
900 //*************************************************************************************************
902 template< typename MT1, typename MT2, bool AF >
903 struct SubmatrixExprTrait< TSMatTSMatAddExpr<MT1,MT2>, AF >
904 {
905  public:
906  //**********************************************************************************************
907  typedef typename AddExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
908  , typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
909  //**********************************************************************************************
910 };
912 //*************************************************************************************************
913 
914 
915 //*************************************************************************************************
917 template< typename MT1, typename MT2 >
918 struct RowExprTrait< TSMatTSMatAddExpr<MT1,MT2> >
919 {
920  public:
921  //**********************************************************************************************
922  typedef typename AddExprTrait< typename RowExprTrait<const MT1>::Type
923  , typename RowExprTrait<const MT2>::Type >::Type Type;
924  //**********************************************************************************************
925 };
927 //*************************************************************************************************
928 
929 
930 //*************************************************************************************************
932 template< typename MT1, typename MT2 >
933 struct ColumnExprTrait< TSMatTSMatAddExpr<MT1,MT2> >
934 {
935  public:
936  //**********************************************************************************************
937  typedef typename AddExprTrait< typename ColumnExprTrait<const MT1>::Type
938  , typename ColumnExprTrait<const MT2>::Type >::Type Type;
939  //**********************************************************************************************
940 };
942 //*************************************************************************************************
943 
944 } // namespace blaze
945 
946 #endif
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatTSMatAddExpr.h:157
Header file for the Max class template.
Evaluation of the return type of an addition expression.Via this type trait it is possible to evaluat...
Definition: AddExprTrait.h:104
AddTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: TSMatTSMatAddExpr.h:156
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: TSMatTSMatAddExpr.h:158
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 Rows type trait.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatTSMatAddExpr.h:201
MT1::CompositeType CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:107
SelectType< IsExpression< MT2 >::value, const MT2, const MT2 & >::Type RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:171
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:258
ResultType::ElementType ElementType
Resulting element type.
Definition: TSMatTSMatAddExpr.h:159
LeftOperand lhs_
Left-hand side sparse matrix of the addition expression.
Definition: TSMatTSMatAddExpr.h:295
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:205
MT2::ReturnType RN2
Return type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:106
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: TSMatTSMatAddExpr.h:162
Header file for the ColumnExprTrait class template.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2478
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:257
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
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:695
Header file for the Computation base class.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: TSMatTSMatAddExpr.h:276
SelectType< IsExpression< MT1 >::value, const MT1, const MT1 & >::Type LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:168
Header file for the RequiresEvaluation type trait.
AddExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: TSMatTSMatAddExpr.h:121
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
MT2::ResultType RT2
Result type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:104
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: TSMatTSMatAddExpr.h:233
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: TSMatTSMatAddExpr.h:244
Header file for the SparseMatrix base class.
Constraint on the data type.
size_t rows() const
Returns the current number of rows of the matrix.
Definition: TSMatTSMatAddExpr.h:213
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 DisableIf class template.
Header file for the IsTemporary type trait class.
Header file for the IsSymmetric type trait.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: StorageOrder.h:161
Expression object for transpose sparse matrix-transpose sparse matrix additions.The TSMatTSMatAddExpr...
Definition: Forward.h:144
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
BLAZE_ALWAYS_INLINE 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:635
Header file for the Columns type trait.
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
Header file for the IsLower type trait.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: TSMatTSMatAddExpr.h:288
Constraints on the storage order of matrix types.
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
MT1::ResultType RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:103
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATADDEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/matrix ...
Definition: MatMatAddExpr.h:165
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.
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatTSMatAddExpr.h:165
Header file for the serial shim.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: TSMatTSMatAddExpr.h:223
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
MT2::CompositeType CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:108
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
Header file for the SubmatrixExprTrait class template.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2477
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:142
Header file for the addition trait.
BLAZE_ALWAYS_INLINE 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:742
Constraint on the data type.
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
Header file for the MatMatAddExpr base class.
LeftOperand leftOperand() const
Returns the left-hand side transpose sparse matrix operand.
Definition: TSMatTSMatAddExpr.h:254
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:932
Header file for the IsComputation type trait class.
TSMatTSMatAddExpr< MT1, MT2 > This
Type of this TSMatTSMatAddExpr instance.
Definition: TSMatTSMatAddExpr.h:155
RightOperand rhs_
Right-hand side sparse matrix of the addition expression.
Definition: TSMatTSMatAddExpr.h:296
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< 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:129
#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:2473
Header file for the IsTrue value trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
Header file for basic type definitions.
Header file for the IsUpper type trait.
Header file for the IsResizable type trait.
#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
TSMatTSMatAddExpr(const MT1 &lhs, const MT2 &rhs)
Constructor for the TSMatTSMatAddExpr class.
Definition: TSMatTSMatAddExpr.h:185
RightOperand rightOperand() const
Returns the right-hand side transpose sparse matrix operand.
Definition: TSMatTSMatAddExpr.h:264
#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
MT1::ReturnType RN1
Return type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatAddExpr.h:105
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE 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:849