SMatTransExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATTRANSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATTRANSEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
74 #include <blaze/util/Assert.h>
76 #include <blaze/util/EmptyType.h>
77 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/Exception.h>
79 #include <blaze/util/InvalidType.h>
81 #include <blaze/util/SelectType.h>
82 #include <blaze/util/Types.h>
85 
86 
87 namespace blaze {
88 
89 //=================================================================================================
90 //
91 // CLASS SMATTRANSEXPR
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
102 template< typename MT // Type of the sparse matrix
103  , bool SO > // Storage order
104 class SMatTransExpr : public SparseMatrix< SMatTransExpr<MT,SO>, SO >
105  , private MatTransExpr
106  , private SelectType< IsComputation<MT>::value, Computation, EmptyType >::Type
107 {
108  private:
109  //**Type definitions****************************************************************************
110  typedef typename MT::ResultType RT;
111  typedef typename MT::CompositeType CT;
112  //**********************************************************************************************
113 
114  //**Serial evaluation strategy******************************************************************
116 
122  enum { useAssign = RequiresEvaluation<MT>::value };
123 
125  template< typename MT2 >
127  struct UseAssign {
128  enum { value = useAssign };
129  };
131  //**********************************************************************************************
132 
133  //**Parallel evaluation strategy****************************************************************
135 
140  template< typename MT2 >
141  struct UseSMPAssign {
142  enum { value = MT2::smpAssignable && useAssign };
143  };
145  //**********************************************************************************************
146 
147  public:
148  //**Type definitions****************************************************************************
150  typedef typename MT::TransposeType ResultType;
151  typedef typename MT::OppositeType OppositeType;
152  typedef typename MT::ResultType TransposeType;
153  typedef typename MT::ElementType ElementType;
154  typedef typename MT::ReturnType ReturnType;
155 
158 
160  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type Operand;
161  //**********************************************************************************************
162 
163  //**ConstIterator class definition**************************************************************
167  {
168  public:
169  //**Type definitions*************************************************************************
172 
173  typedef std::forward_iterator_tag IteratorCategory;
174  typedef typename std::iterator_traits<IteratorType>::value_type ValueType;
175  typedef typename std::iterator_traits<IteratorType>::pointer PointerType;
176  typedef typename std::iterator_traits<IteratorType>::reference ReferenceType;
177  typedef typename std::iterator_traits<IteratorType>::difference_type DifferenceType;
178 
179  // STL iterator requirements
180  typedef IteratorCategory iterator_category;
181  typedef ValueType value_type;
182  typedef PointerType pointer;
183  typedef ReferenceType reference;
184  typedef DifferenceType difference_type;
185  //*******************************************************************************************
186 
187  //**Constructor******************************************************************************
190  inline ConstIterator( IteratorType it )
191  : it_( it ) // Iterator over the elements of the sparse matrix expression
192  {}
193  //*******************************************************************************************
194 
195  //**Prefix increment operator****************************************************************
201  ++it_;
202  return *this;
203  }
204  //*******************************************************************************************
205 
206  //**Element access operator******************************************************************
211  inline const ValueType operator*() const {
212  return *it_;
213  }
214  //*******************************************************************************************
215 
216  //**Element access operator******************************************************************
221  inline const IteratorType operator->() const {
222  return it_;
223  }
224  //*******************************************************************************************
225 
226  //**Value function***************************************************************************
231  inline ReturnType value() const {
232  return it_->value();
233  }
234  //*******************************************************************************************
235 
236  //**Index function***************************************************************************
241  inline size_t index() const {
242  return it_->index();
243  }
244  //*******************************************************************************************
245 
246  //**Equality operator************************************************************************
252  inline bool operator==( const ConstIterator& rhs ) const {
253  return it_ == rhs.it_;
254  }
255  //*******************************************************************************************
256 
257  //**Inequality operator**********************************************************************
263  inline bool operator!=( const ConstIterator& rhs ) const {
264  return it_ != rhs.it_;
265  }
266  //*******************************************************************************************
267 
268  //**Subtraction operator*********************************************************************
274  inline DifferenceType operator-( const ConstIterator& rhs ) const {
275  return it_ - rhs.it_;
276  }
277  //*******************************************************************************************
278 
279  private:
280  //**Member variables*************************************************************************
281  IteratorType it_;
282  //*******************************************************************************************
283  };
284  //**********************************************************************************************
285 
286  //**Compilation flags***************************************************************************
288  enum { smpAssignable = MT::smpAssignable };
289  //**********************************************************************************************
290 
291  //**Constructor*********************************************************************************
296  explicit inline SMatTransExpr( const MT& sm )
297  : sm_( sm )
298  {}
299  //**********************************************************************************************
300 
301  //**Access operator*****************************************************************************
308  inline ReturnType operator()( size_t i, size_t j ) const {
309  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
310  BLAZE_INTERNAL_ASSERT( j < sm_.rows() , "Invalid column access index" );
311  return sm_(j,i);
312  }
313  //**********************************************************************************************
314 
315  //**At function*********************************************************************************
323  inline ReturnType at( size_t i, size_t j ) const {
324  if( i >= sm_.columns() ) {
325  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
326  }
327  if( j >= sm_.rows() ) {
328  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
329  }
330  return (*this)(i,j);
331  }
332  //**********************************************************************************************
333 
334  //**Begin function******************************************************************************
340  inline ConstIterator begin( size_t i ) const {
341  return sm_.begin(i);
342  }
343  //**********************************************************************************************
344 
345  //**End function********************************************************************************
351  inline ConstIterator end( size_t i ) const {
352  return sm_.end(i);
353  }
354  //**********************************************************************************************
355 
356  //**Rows function*******************************************************************************
361  inline size_t rows() const {
362  return sm_.columns();
363  }
364  //**********************************************************************************************
365 
366  //**Columns function****************************************************************************
371  inline size_t columns() const {
372  return sm_.rows();
373  }
374  //**********************************************************************************************
375 
376  //**NonZeros function***************************************************************************
381  inline size_t nonZeros() const {
382  return sm_.nonZeros();
383  }
384  //**********************************************************************************************
385 
386  //**NonZeros function***************************************************************************
392  inline size_t nonZeros( size_t i ) const {
393  return sm_.nonZeros( i );
394  }
395  //**********************************************************************************************
396 
397  //**Find function*******************************************************************************
404  inline ConstIterator find( size_t i, size_t j ) const {
406  return sm_.find( j, i );
407  }
408  //**********************************************************************************************
409 
410  //**LowerBound function*************************************************************************
417  inline ConstIterator lowerBound( size_t i, size_t j ) const {
419  return sm_.lowerBound( j, i );
420  }
421  //**********************************************************************************************
422 
423  //**UpperBound function*************************************************************************
430  inline ConstIterator upperBound( size_t i, size_t j ) const {
432  return sm_.upperBound( j, i );
433  }
434  //**********************************************************************************************
435 
436  //**Operand access******************************************************************************
441  inline Operand operand() const {
442  return sm_;
443  }
444  //**********************************************************************************************
445 
446  //**********************************************************************************************
452  template< typename T >
453  inline bool canAlias( const T* alias ) const {
454  return sm_.isAliased( alias );
455  }
456  //**********************************************************************************************
457 
458  //**********************************************************************************************
464  template< typename T >
465  inline bool isAliased( const T* alias ) const {
466  return sm_.isAliased( alias );
467  }
468  //**********************************************************************************************
469 
470  //**********************************************************************************************
475  inline bool canSMPAssign() const {
476  return sm_.canSMPAssign();
477  }
478  //**********************************************************************************************
479 
480  private:
481  //**Member variables****************************************************************************
482  Operand sm_;
483  //**********************************************************************************************
484 
485  //**Assignment to dense matrices****************************************************************
499  template< typename MT2 // Type of the target dense matrix
500  , bool SO2 > // Storage order of the target dense matrix
501  friend inline typename EnableIf< UseAssign<MT2> >::Type
502  assign( DenseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
503  {
505 
506  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
507  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
508 
509  DMatTransposer<MT2,!SO2> tmp( ~lhs );
510  assign( tmp, rhs.sm_ );
511  }
513  //**********************************************************************************************
514 
515  //**Assignment to sparse matrices***************************************************************
529  template< typename MT2 // Type of the target sparse matrix
530  , bool SO2 > // Storage order of the target sparse matrix
531  friend inline typename EnableIf< UseAssign<MT2> >::Type
532  assign( SparseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
533  {
535 
536  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
537  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
538 
539  SMatTransposer<MT2,!SO2> tmp( ~lhs );
540  assign( tmp, rhs.sm_ );
541  }
543  //**********************************************************************************************
544 
545  //**Addition assignment to dense matrices*******************************************************
559  template< typename MT2 // Type of the target dense matrix
560  , bool SO2 > // Storage order of the target dense matrix
561  friend inline typename EnableIf< UseAssign<MT2> >::Type
562  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
563  {
565 
566  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
567  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
568 
569  DMatTransposer<MT2,!SO2> tmp( ~lhs );
570  addAssign( tmp, rhs.sm_ );
571  }
573  //**********************************************************************************************
574 
575  //**Addition assignment to sparse matrices******************************************************
576  // No special implementation for the addition assignment to sparse matrices.
577  //**********************************************************************************************
578 
579  //**Subtraction assignment to dense matrices****************************************************
593  template< typename MT2 // Type of the target dense matrix
594  , bool SO2 > // Storage order of the target dense matrix
595  friend inline typename EnableIf< UseAssign<MT2> >::Type
596  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
597  {
599 
600  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
601  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
602 
603  DMatTransposer<MT2,!SO2> tmp( ~lhs );
604  subAssign( tmp, rhs.sm_ );
605  }
607  //**********************************************************************************************
608 
609  //**Subtraction assignment to sparse matrices***************************************************
610  // No special implementation for the subtraction assignment to sparse matrices.
611  //**********************************************************************************************
612 
613  //**Multiplication assignment to dense matrices*************************************************
614  // No special implementation for the multiplication assignment to dense matrices.
615  //**********************************************************************************************
616 
617  //**Multiplication assignment to sparse matrices************************************************
618  // No special implementation for the multiplication assignment to sparse matrices.
619  //**********************************************************************************************
620 
621  //**SMP assignment to dense matrices************************************************************
635  template< typename MT2 // Type of the target dense matrix
636  , bool SO2 > // Storage order of the target dense matrix
637  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
638  smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
639  {
641 
642  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
643  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
644 
645  DMatTransposer<MT2,!SO2> tmp( ~lhs );
646  smpAssign( tmp, rhs.sm_ );
647  }
649  //**********************************************************************************************
650 
651  //**SMP assignment to sparse matrices***********************************************************
665  template< typename MT2 // Type of the target sparse matrix
666  , bool SO2 > // Storage order of the target sparse matrix
667  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
668  smpAssign( SparseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
669  {
671 
672  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
673  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
674 
675  SMatTransposer<MT2,!SO2> tmp( ~lhs );
676  smpAssign( tmp, rhs.sm_ );
677  }
679  //**********************************************************************************************
680 
681  //**SMP addition assignment to dense matrices***************************************************
695  template< typename MT2 // Type of the target dense matrix
696  , bool SO2 > // Storage order of the target dense matrix
697  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
698  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
699  {
701 
702  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
703  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
704 
705  DMatTransposer<MT2,!SO2> tmp( ~lhs );
706  smpAddAssign( tmp, rhs.sm_ );
707  }
709  //**********************************************************************************************
710 
711  //**SMP addition assignment to sparse matrices**************************************************
712  // No special implementation for the SMP addition assignment to sparse matrices.
713  //**********************************************************************************************
714 
715  //**SMP subtraction assignment to dense matrices************************************************
730  template< typename MT2 // Type of the target dense matrix
731  , bool SO2 > // Storage order of the target dense matrix
732  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
733  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatTransExpr& rhs )
734  {
736 
737  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
738  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
739 
740  DMatTransposer<MT2,!SO2> tmp( ~lhs );
741  smpSubAssign( tmp, rhs.sm_ );
742  }
744  //**********************************************************************************************
745 
746  //**SMP subtraction assignment to sparse matrices***********************************************
747  // No special implementation for the SMP subtraction assignment to sparse matrices.
748  //**********************************************************************************************
749 
750  //**SMP multiplication assignment to dense matrices*********************************************
751  // No special implementation for the SMP multiplication assignment to dense matrices.
752  //**********************************************************************************************
753 
754  //**SMP multiplication assignment to sparse matrices********************************************
755  // No special implementation for the SMP multiplication assignment to sparse matrices.
756  //**********************************************************************************************
757 
758  //**Compile time checks*************************************************************************
763  //**********************************************************************************************
764 };
765 //*************************************************************************************************
766 
767 
768 
769 
770 //=================================================================================================
771 //
772 // GLOBAL OPERATORS
773 //
774 //=================================================================================================
775 
776 //*************************************************************************************************
795 template< typename MT // Type of the sparse matrix
796  , bool SO > // Storage order
798 {
800 
801  return SMatTransExpr<MT,!SO>( ~sm );
802 }
803 //*************************************************************************************************
804 
805 
806 
807 
808 //=================================================================================================
809 //
810 // GLOBAL RESTRUCTURING FUNCTIONS
811 //
812 //=================================================================================================
813 
814 //*************************************************************************************************
834 template< typename MT // Type of the dense matrix
835  , bool SO > // Storage order
836 inline typename SMatTransExpr<MT,SO>::Operand trans( const SMatTransExpr<MT,SO>& sm )
837 {
839 
840  return sm.operand();
841 }
843 //*************************************************************************************************
844 
845 
846 
847 
848 //=================================================================================================
849 //
850 // ROWS SPECIALIZATIONS
851 //
852 //=================================================================================================
853 
854 //*************************************************************************************************
856 template< typename MT, bool SO >
857 struct Rows< SMatTransExpr<MT,SO> > : public Columns<MT>
858 {};
860 //*************************************************************************************************
861 
862 
863 
864 
865 //=================================================================================================
866 //
867 // COLUMNS SPECIALIZATIONS
868 //
869 //=================================================================================================
870 
871 //*************************************************************************************************
873 template< typename MT, bool SO >
874 struct Columns< SMatTransExpr<MT,SO> > : public Rows<MT>
875 {};
877 //*************************************************************************************************
878 
879 
880 
881 
882 //=================================================================================================
883 //
884 // ISSYMMETRIC SPECIALIZATIONS
885 //
886 //=================================================================================================
887 
888 //*************************************************************************************************
890 template< typename MT, bool SO >
891 struct IsSymmetric< SMatTransExpr<MT,SO> > : public IsTrue< IsSymmetric<MT>::value >
892 {};
894 //*************************************************************************************************
895 
896 
897 
898 
899 //=================================================================================================
900 //
901 // ISHERMITIAN SPECIALIZATIONS
902 //
903 //=================================================================================================
904 
905 //*************************************************************************************************
907 template< typename MT, bool SO >
908 struct IsHermitian< SMatTransExpr<MT,SO> > : public IsTrue< IsHermitian<MT>::value >
909 {};
911 //*************************************************************************************************
912 
913 
914 
915 
916 //=================================================================================================
917 //
918 // ISLOWER SPECIALIZATIONS
919 //
920 //=================================================================================================
921 
922 //*************************************************************************************************
924 template< typename MT, bool SO >
925 struct IsLower< SMatTransExpr<MT,SO> > : public IsTrue< IsUpper<MT>::value >
926 {};
928 //*************************************************************************************************
929 
930 
931 
932 
933 //=================================================================================================
934 //
935 // ISUNILOWER SPECIALIZATIONS
936 //
937 //=================================================================================================
938 
939 //*************************************************************************************************
941 template< typename MT, bool SO >
942 struct IsUniLower< SMatTransExpr<MT,SO> > : public IsTrue< IsUniUpper<MT>::value >
943 {};
945 //*************************************************************************************************
946 
947 
948 
949 
950 //=================================================================================================
951 //
952 // ISSTRICTLYLOWER SPECIALIZATIONS
953 //
954 //=================================================================================================
955 
956 //*************************************************************************************************
958 template< typename MT, bool SO >
959 struct IsStrictlyLower< SMatTransExpr<MT,SO> > : public IsTrue< IsStrictlyUpper<MT>::value >
960 {};
962 //*************************************************************************************************
963 
964 
965 
966 
967 //=================================================================================================
968 //
969 // ISUPPER SPECIALIZATIONS
970 //
971 //=================================================================================================
972 
973 //*************************************************************************************************
975 template< typename MT, bool SO >
976 struct IsUpper< SMatTransExpr<MT,SO> > : public IsTrue< IsLower<MT>::value >
977 {};
979 //*************************************************************************************************
980 
981 
982 
983 
984 //=================================================================================================
985 //
986 // ISUNIUPPER SPECIALIZATIONS
987 //
988 //=================================================================================================
989 
990 //*************************************************************************************************
992 template< typename MT, bool SO >
993 struct IsUniUpper< SMatTransExpr<MT,SO> > : public IsTrue< IsUniLower<MT>::value >
994 {};
996 //*************************************************************************************************
997 
998 
999 
1000 
1001 //=================================================================================================
1002 //
1003 // ISSTRICTLYUPPER SPECIALIZATIONS
1004 //
1005 //=================================================================================================
1006 
1007 //*************************************************************************************************
1009 template< typename MT, bool SO >
1010 struct IsStrictlyUpper< SMatTransExpr<MT,SO> > : public IsTrue< IsStrictlyLower<MT>::value >
1011 {};
1013 //*************************************************************************************************
1014 
1015 
1016 
1017 
1018 //=================================================================================================
1019 //
1020 // EXPRESSION TRAIT SPECIALIZATIONS
1021 //
1022 //=================================================================================================
1023 
1024 //*************************************************************************************************
1026 template< typename MT >
1027 struct SMatTransExprTrait< SMatTransExpr<MT,false> >
1028 {
1029  public:
1030  //**********************************************************************************************
1031  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1032  , typename SMatTransExpr<MT,false>::Operand
1033  , INVALID_TYPE >::Type Type;
1034  //**********************************************************************************************
1035 };
1037 //*************************************************************************************************
1038 
1039 
1040 //*************************************************************************************************
1042 template< typename MT >
1043 struct TSMatTransExprTrait< SMatTransExpr<MT,true> >
1044 {
1045  public:
1046  //**********************************************************************************************
1047  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1048  , typename SMatTransExpr<MT,true>::Operand
1049  , INVALID_TYPE >::Type Type;
1050  //**********************************************************************************************
1051 };
1053 //*************************************************************************************************
1054 
1055 
1056 //*************************************************************************************************
1058 template< typename MT, bool SO, bool AF >
1059 struct SubmatrixExprTrait< SMatTransExpr<MT,SO>, AF >
1060 {
1061  public:
1062  //**********************************************************************************************
1063  typedef typename TransExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1064  //**********************************************************************************************
1065 };
1067 //*************************************************************************************************
1068 
1069 
1070 //*************************************************************************************************
1072 template< typename MT, bool SO >
1073 struct RowExprTrait< SMatTransExpr<MT,SO> >
1074 {
1075  public:
1076  //**********************************************************************************************
1077  typedef typename TransExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
1078  //**********************************************************************************************
1079 };
1081 //*************************************************************************************************
1082 
1083 
1084 //*************************************************************************************************
1086 template< typename MT, bool SO >
1087 struct ColumnExprTrait< SMatTransExpr<MT,SO> >
1088 {
1089  public:
1090  //**********************************************************************************************
1091  typedef typename TransExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1092  //**********************************************************************************************
1093 };
1095 //*************************************************************************************************
1096 
1097 } // namespace blaze
1098 
1099 #endif
Operand operand() const
Returns the sparse matrix operand.
Definition: SMatTransExpr.h:441
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatTransExpr.h:231
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatTransExpr.h:381
Header file for the sparse matrix transposer.
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SMatTransExpr.h:190
Header file for basic type definitions.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransExpr.h:340
#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:81
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatTransExpr.h:453
Header file for the MatTransExpr base class.
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatTransExpr.h:361
Iterator over the elements of the sparse matrix transposition expression.
Definition: SMatTransExpr.h:166
Header file for the ColumnExprTrait class template.
MT::ResultType TransposeType
Transpose type for expression template evaluations.
Definition: SMatTransExpr.h:152
Header file for the IsColumnMajorMatrix type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
const ValueType operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatTransExpr.h:211
Header file for the Computation base class.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransExpr.h:351
Header file for the RequiresEvaluation type trait.
Header file for the IsUniLower type trait.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatTransExpr.h:308
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:117
Constraint on the data type.
Header file for the SparseMatrix base class.
std::iterator_traits< IteratorType >::reference ReferenceType
Reference return type.
Definition: SMatTransExpr.h:176
SMatTransExpr(const MT &sm)
Constructor for the SMatTransExpr class.
Definition: SMatTransExpr.h:296
Constraint on the data type.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SMatTransExpr.h:154
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
const IteratorType operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatTransExpr.h:221
Operand sm_
Sparse matrix of the transposition expression.
Definition: SMatTransExpr.h:482
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatTransExpr.h:173
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatTransExpr.h:252
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatTransExpr.h:417
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
IteratorType it_
Iterator over the elements of the sparse matrix expression.
Definition: SMatTransExpr.h:281
Header file for the SMatTransExprTrait class template.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatTransExpr.h:323
std::iterator_traits< IteratorType >::value_type ValueType
Type of the underlying pointers.
Definition: SMatTransExpr.h:174
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the Columns type trait.
SMatTransExpr< MT, SO > This
Type of this SMatTransExpr instance.
Definition: SMatTransExpr.h:149
Expression object for the transposition of a dense matrix.The DMatTransposer class is a wrapper objec...
Definition: DMatTransposer.h:79
Header file for the IsLower type trait.
std::iterator_traits< IteratorType >::difference_type DifferenceType
Difference between two iterators.
Definition: SMatTransExpr.h:177
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SMatTransExpr.h:475
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row/column.
Definition: SMatTransExpr.h:392
Header file for the TSMatTransExprTrait class template.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
Constraints on the storage order of matrix types.
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatTransExpr.h:430
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatTransExpr.h:465
Constraint on the data type.
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
MT::ElementType ElementType
Resulting element type.
Definition: SMatTransExpr.h:153
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
IteratorCategory iterator_category
The iterator category.
Definition: SMatTransExpr.h:180
Header file for the dense matrix transposer.
Expression object for the transposition of a sparse matrix.The SMatTransposer class is a wrapper obje...
Definition: Forward.h:113
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
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatTransExpr.h:200
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
DifferenceType difference_type
Difference between two iterators.
Definition: SMatTransExpr.h:184
Utility type for generic codes.
MT::CompositeType CT
Composite type of the sparse matrix expression.
Definition: SMatTransExpr.h:111
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
SelectType< useAssign, const ResultType, const SMatTransExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SMatTransExpr.h:157
Header file for the TransExprTrait class template.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatTransExpr.h:274
Header file for the RemoveReference type trait.
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type Operand
Composite data type of the sparse matrix expression.
Definition: SMatTransExpr.h:160
size_t index() const
Access to the current index of the sparse element.
Definition: SMatTransExpr.h:241
PointerType pointer
Pointer return type.
Definition: SMatTransExpr.h:182
Header file for the IsRowMajorMatrix type trait.
ValueType value_type
Type of the underlying pointers.
Definition: SMatTransExpr.h:181
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:944
Header file for the IsComputation type trait class.
RemoveReference< Operand >::Type::ConstIterator IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatTransExpr.h:171
MT::TransposeType ResultType
Result type for expression template evaluations.
Definition: SMatTransExpr.h:150
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
Expression object for sparse matrix transpositions.The SMatTransExpr class represents the compile tim...
Definition: Forward.h:112
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatTransExpr.h:404
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTransExpr.h:151
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatTransExpr.h:263
std::iterator_traits< IteratorType >::pointer PointerType
Pointer return type.
Definition: SMatTransExpr.h:175
Header file for the IsUpper type trait.
Header file for exception macros.
MT::ResultType RT
Result type of the sparse matrix expression.
Definition: SMatTransExpr.h:110
Header file for the empty type.
Header file for the IsHermitian 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
#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
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatTransExpr.h:371
ReferenceType reference
Reference return type.
Definition: SMatTransExpr.h:183
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.