SMatTransposer.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATTRANSPOSER_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATTRANSPOSER_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <vector>
50 #include <blaze/util/Assert.h>
51 #include <blaze/util/EnableIf.h>
52 #include <blaze/util/Exception.h>
53 #include <blaze/util/Types.h>
55 
56 
57 namespace blaze {
58 
59 //=================================================================================================
60 //
61 // CLASS SMATTRANSPOSER
62 //
63 //=================================================================================================
64 
65 //*************************************************************************************************
71 template< typename MT // Type of the sparse matrix
72  , bool SO > // Storage order
73 class SMatTransposer : public SparseMatrix< SMatTransposer<MT,SO>, SO >
74 {
75  public:
76  //**Type definitions****************************************************************************
78  typedef typename MT::TransposeType ResultType;
79  typedef MT OppositeType;
80  typedef typename MT::ResultType TransposeType;
81  typedef typename MT::ElementType ElementType;
82  typedef typename MT::ReturnType ReturnType;
83  typedef const This& CompositeType;
84  typedef typename MT::Reference Reference;
86  typedef typename MT::Iterator Iterator;
87  typedef typename MT::ConstIterator ConstIterator;
88  //**********************************************************************************************
89 
90  //**Compilation flags***************************************************************************
92 
95  enum { smpAssignable = MT::smpAssignable };
96  //**********************************************************************************************
97 
98  //**Constructor*********************************************************************************
103  explicit inline SMatTransposer( MT& sm )
104  : sm_( sm ) // The sparse matrix operand
105  {}
106  //**********************************************************************************************
107 
108  //**Access operator*****************************************************************************
115  inline ConstReference operator()( size_t i, size_t j ) const {
116  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
117  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
118  return sm_(j,i);
119  }
120  //**********************************************************************************************
121 
122  //**At function*********************************************************************************
130  inline ConstReference at( size_t i, size_t j ) const {
131  if( i >= sm_.columns() ) {
132  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
133  }
134  if( j >= sm_.rows() ) {
135  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
136  }
137  return (*this)(i,j);
138  }
139  //**********************************************************************************************
140 
141  //**Begin function******************************************************************************
152  inline Iterator begin( size_t i ) {
153  return sm_.begin(i);
154  }
155  //**********************************************************************************************
156 
157  //**Begin function******************************************************************************
168  inline ConstIterator begin( size_t i ) const {
169  return sm_.cbegin(i);
170  }
171  //**********************************************************************************************
172 
173  //**Cbegin function*****************************************************************************
184  inline ConstIterator cbegin( size_t i ) const {
185  return sm_.cbegin(i);
186  }
187  //**********************************************************************************************
188 
189  //**End function********************************************************************************
200  inline Iterator end( size_t i ) {
201  return sm_.end(i);
202  }
203  //**********************************************************************************************
204 
205  //**End function********************************************************************************
216  inline ConstIterator end( size_t i ) const {
217  return sm_.cend(i);
218  }
219  //**********************************************************************************************
220 
221  //**Cend function*******************************************************************************
232  inline ConstIterator cend( size_t i ) const {
233  return sm_.cend(i);
234  }
235  //**********************************************************************************************
236 
237  //**Multiplication assignment operator**********************************************************
244  template< typename Other > // Data type of the right-hand side scalar
245  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator*=( Other rhs )
246  {
247  (~sm_) *= rhs;
248  return *this;
249  }
250  //**********************************************************************************************
251 
252  //**Division assignment operator****************************************************************
261  template< typename Other > // Data type of the right-hand side scalar
262  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator/=( Other rhs )
263  {
264  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
265 
266  (~sm_) /= rhs;
267  return *this;
268  }
269  //**********************************************************************************************
270 
271  //**Rows function*******************************************************************************
276  inline size_t rows() const {
277  return sm_.columns();
278  }
279  //**********************************************************************************************
280 
281  //**Columns function****************************************************************************
286  inline size_t columns() const {
287  return sm_.rows();
288  }
289  //**********************************************************************************************
290 
291  //**Capacity function***************************************************************************
296  inline size_t capacity() const {
297  return sm_.capacity();
298  }
299  //**********************************************************************************************
300 
301  //**Capacity function***************************************************************************
307  inline size_t capacity( size_t i ) const {
308  return sm_.capacity( i );
309  }
310  //**********************************************************************************************
311 
312  //**NonZeros function***************************************************************************
317  inline size_t nonZeros() const {
318  return sm_.nonZeros();
319  }
320  //**********************************************************************************************
321 
322  //**NonZeros function***************************************************************************
328  inline size_t nonZeros( size_t i ) const {
329  return sm_.nonZeros( i );
330  }
331  //**********************************************************************************************
332 
333  //**Reset function******************************************************************************
338  inline void reset() {
339  return sm_.reset();
340  }
341  //**********************************************************************************************
342 
343  //**Insert function*****************************************************************************
356  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
357  return sm_.insert( j, i, value );
358  }
359  //**********************************************************************************************
360 
361  //**Reserve function****************************************************************************
371  inline void reserve( size_t nonzeros ) {
372  sm_.reserve( nonzeros );
373  }
374  //**********************************************************************************************
375 
376  //**Reserve function****************************************************************************
390  inline void reserve( size_t i, size_t nonzeros ) {
391  sm_.reserve( i, nonzeros );
392  }
393  //**********************************************************************************************
394 
395  //**Append function*****************************************************************************
422  inline void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
423  sm_.append( j, i, value, check );
424  }
425  //**********************************************************************************************
426 
427  //**Finalize function***************************************************************************
440  inline void finalize( size_t i ) {
441  sm_.finalize( i );
442  }
443  //**********************************************************************************************
444 
445  //**IsIntact function***************************************************************************
450  inline bool isIntact() const {
451  return isIntact( sm_ );
452  }
453  //**********************************************************************************************
454 
455  //**********************************************************************************************
461  template< typename Other > // Data type of the foreign expression
462  inline bool canAlias( const Other* alias ) const
463  {
464  return sm_.canAlias( alias );
465  }
466  //**********************************************************************************************
467 
468  //**********************************************************************************************
474  template< typename Other > // Data type of the foreign expression
475  inline bool isAliased( const Other* alias ) const
476  {
477  return sm_.isAliased( alias );
478  }
479  //**********************************************************************************************
480 
481  //**CanSMPAssign function***********************************************************************
486  inline bool canSMPAssign() const
487  {
488  return sm_.canSMPAssign();
489  }
490  //**********************************************************************************************
491 
492  //**Transpose assignment of row-major sparse matrices*******************************************
503  template< typename MT2 > // Type of the right-hand side sparse matrix
504  inline void assign( const SparseMatrix<MT2,false>& rhs )
505  {
507 
508  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
509  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
510  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
511 
512  typedef typename MT2::ConstIterator RhsIterator;
513 
514  const size_t m( rows() );
515 
516  for( size_t i=0UL; i<m; ++i ) {
517  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
518  sm_.append( element->index(), i, element->value() );
519  finalize( i );
520  }
521  }
522  //**********************************************************************************************
523 
524  //**Transpose assignment of column-major sparse matrices****************************************
535  template< typename MT2 > // Type of the right-hand side sparse matrix
536  inline void assign( const SparseMatrix<MT2,true>& rhs )
537  {
539 
540  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
541  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
542  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
543 
544  typedef typename MT2::ConstIterator RhsIterator;
545 
546  const size_t m( rows() );
547  const size_t n( columns() );
548 
549  // Counting the number of elements per row
550  std::vector<size_t> rowLengths( m, 0UL );
551  for( size_t j=0UL; j<n; ++j ) {
552  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
553  ++rowLengths[element->index()];
554  }
555 
556  // Resizing the sparse matrix
557  for( size_t i=0UL; i<m; ++i ) {
558  sm_.reserve( i, rowLengths[i] );
559  }
560 
561  // Appending the elements to the rows of the sparse matrix
562  for( size_t j=0UL; j<n; ++j ) {
563  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
564  sm_.append( j, element->index(), element->value() );
565  }
566  }
567  }
568  //**********************************************************************************************
569 
570  private:
571  //**Member variables****************************************************************************
572  MT& sm_;
573  //**********************************************************************************************
574 
575  //**Compile time checks*************************************************************************
581  //**********************************************************************************************
582 };
583 //*************************************************************************************************
584 
585 
586 
587 
588 //=================================================================================================
589 //
590 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR MATRICES
591 //
592 //=================================================================================================
593 
594 //*************************************************************************************************
602 template< typename MT > // Type of the sparse matrix
603 class SMatTransposer<MT,true> : public SparseMatrix< SMatTransposer<MT,true>, true >
604 {
605  public:
606  //**Type definitions****************************************************************************
607  typedef SMatTransposer<MT,true> This;
608  typedef typename MT::TransposeType ResultType;
609  typedef MT OppositeType;
610  typedef typename MT::ResultType TransposeType;
611  typedef typename MT::ElementType ElementType;
612  typedef typename MT::ReturnType ReturnType;
613  typedef const This& CompositeType;
614  typedef typename MT::Reference Reference;
615  typedef typename MT::ConstReference ConstReference;
616  typedef typename MT::Iterator Iterator;
617  typedef typename MT::ConstIterator ConstIterator;
618  //**********************************************************************************************
619 
620  //**Compilation flags***************************************************************************
622 
625  enum { smpAssignable = MT::smpAssignable };
626  //**********************************************************************************************
627 
628  //**Constructor*********************************************************************************
633  explicit inline SMatTransposer( MT& sm )
634  : sm_( sm ) // The sparse matrix operand
635  {}
636  //**********************************************************************************************
637 
638  //**Access operator*****************************************************************************
645  inline ConstReference operator()( size_t i, size_t j ) const {
646  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
647  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
648  return sm_(j,i);
649  }
650  //**********************************************************************************************
651 
652  //**At function*********************************************************************************
660  inline ConstReference at( size_t i, size_t j ) const {
661  if( i >= sm_.columns() ) {
662  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
663  }
664  if( j >= sm_.rows() ) {
665  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
666  }
667  return (*this)(i,j);
668  }
669  //**********************************************************************************************
670 
671  //**Begin function******************************************************************************
677  inline Iterator begin( size_t j ) {
678  return sm_.begin(j);
679  }
680  //**********************************************************************************************
681 
682  //**Begin function******************************************************************************
688  inline ConstIterator begin( size_t j ) const {
689  return sm_.cbegin(j);
690  }
691  //**********************************************************************************************
692 
693  //**Cbegin function*****************************************************************************
699  inline ConstIterator cbegin( size_t j ) const {
700  return sm_.cbegin(j);
701  }
702  //**********************************************************************************************
703 
704  //**End function********************************************************************************
710  inline Iterator end( size_t j ) {
711  return sm_.end(j);
712  }
713  //**********************************************************************************************
714 
715  //**End function********************************************************************************
721  inline ConstIterator end( size_t j ) const {
722  return sm_.cend(j);
723  }
724  //**********************************************************************************************
725 
726  //**Cend function*******************************************************************************
732  inline ConstIterator cend( size_t j ) const {
733  return sm_.cend(j);
734  }
735  //**********************************************************************************************
736 
737  //**Multiplication assignment operator**********************************************************
744  template< typename Other > // Data type of the right-hand side scalar
745  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator*=( Other rhs )
746  {
747  (~sm_) *= rhs;
748  return *this;
749  }
750  //**********************************************************************************************
751 
752  //**Division assignment operator****************************************************************
761  template< typename Other > // Data type of the right-hand side scalar
762  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator/=( Other rhs )
763  {
764  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
765 
766  (~sm_) /= rhs;
767  return *this;
768  }
769  //**********************************************************************************************
770 
771  //**Rows function*******************************************************************************
776  inline size_t rows() const {
777  return sm_.columns();
778  }
779  //**********************************************************************************************
780 
781  //**Columns function****************************************************************************
786  inline size_t columns() const {
787  return sm_.rows();
788  }
789  //**********************************************************************************************
790 
791  //**Capacity function***************************************************************************
796  inline size_t capacity() const {
797  return sm_.capacity();
798  }
799  //**********************************************************************************************
800 
801  //**Capacity function***************************************************************************
807  inline size_t capacity( size_t j ) const {
808  return sm_.capacity( j );
809  }
810  //**********************************************************************************************
811 
812  //**NonZeros function***************************************************************************
817  inline size_t nonZeros() const {
818  return sm_.nonZeros();
819  }
820  //**********************************************************************************************
821 
822  //**NonZeros function***************************************************************************
828  inline size_t nonZeros( size_t j ) const {
829  return sm_.nonZeros( j );
830  }
831  //**********************************************************************************************
832 
833  //**Reset function******************************************************************************
838  inline void reset() {
839  return sm_.reset();
840  }
841  //**********************************************************************************************
842 
843  //**Insert function*****************************************************************************
856  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
857  return sm_.insert( j, i, value );
858  }
859  //**********************************************************************************************
860 
861  //**Reserve function****************************************************************************
871  inline void reserve( size_t nonzeros ) {
872  sm_.reserve( nonzeros );
873  }
874  //**********************************************************************************************
875 
876  //**Reserve function****************************************************************************
887  inline void reserve( size_t i, size_t nonzeros ) {
888  sm_.reserve( i, nonzeros );
889  }
890  //**********************************************************************************************
891 
892  //**Append function*****************************************************************************
919  void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
920  sm_.append( j, i, value, check );
921  }
922  //**********************************************************************************************
923 
924  //**Finalize function***************************************************************************
937  inline void finalize( size_t j ) {
938  sm_.finalize( j );
939  }
940  //**********************************************************************************************
941 
942  //**IsIntact function***************************************************************************
947  inline bool isIntact() const {
948  return isIntact( sm_ );
949  }
950  //**********************************************************************************************
951 
952  //**********************************************************************************************
958  template< typename Other > // Data type of the foreign expression
959  inline bool canAlias( const Other* alias ) const
960  {
961  return sm_.canAlias( alias );
962  }
963  //**********************************************************************************************
964 
965  //**********************************************************************************************
971  template< typename Other > // Data type of the foreign expression
972  inline bool isAliased( const Other* alias ) const
973  {
974  return sm_.isAliased( alias );
975  }
976  //**********************************************************************************************
977 
978  //**CanSMPAssign function***********************************************************************
983  inline bool canSMPAssign() const
984  {
985  return sm_.canSMPAssign();
986  }
987  //**********************************************************************************************
988 
989  //**Transpose assignment of row-major sparse matrices*******************************************
1000  template< typename MT2 > // Type of the right-hand side sparse matrix
1001  inline void assign( const SparseMatrix<MT2,false>& rhs )
1002  {
1004 
1005  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
1006  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
1007  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
1008 
1009  typedef typename MT2::ConstIterator RhsIterator;
1010 
1011  const size_t m( rows() );
1012  const size_t n( columns() );
1013 
1014  // Counting the number of elements per row
1015  std::vector<size_t> columnLengths( n, 0UL );
1016  for( size_t i=0UL; i<m; ++i ) {
1017  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
1018  ++columnLengths[element->index()];
1019  }
1020 
1021  // Resizing the sparse matrix
1022  for( size_t j=0UL; j<n; ++j ) {
1023  sm_.reserve( j, columnLengths[j] );
1024  }
1025 
1026  // Appending the elements to the columns of the sparse matrix
1027  for( size_t i=0UL; i<m; ++i ) {
1028  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
1029  sm_.append( element->index(), i, element->value() );
1030  }
1031  }
1032  }
1033  //**********************************************************************************************
1034 
1035  //**Transpose assignment of column-major sparse matrices****************************************
1046  template< typename MT2 > // Type of the right-hand side sparse matrix
1047  inline void assign( const SparseMatrix<MT2,true>& rhs )
1048  {
1050 
1051  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
1052  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
1053  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
1054 
1055  typedef typename MT2::ConstIterator RhsIterator;
1056 
1057  const size_t n( columns() );
1058 
1059  for( size_t j=0UL; j<n; ++j ) {
1060  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
1061  sm_.append( j, element->index(), element->value() );
1062  finalize( j );
1063  }
1064  }
1065  //**********************************************************************************************
1066 
1067  private:
1068  //**Member variables****************************************************************************
1069  MT& sm_;
1070  //**********************************************************************************************
1071 
1072  //**Compile time checks*************************************************************************
1078  //**********************************************************************************************
1079 };
1081 //*************************************************************************************************
1082 
1083 
1084 
1085 
1086 //=================================================================================================
1087 //
1088 // GLOBAL OPERATORS
1089 //
1090 //=================================================================================================
1091 
1092 //*************************************************************************************************
1100 template< typename MT // Type of the sparse matrix
1101  , bool SO > // Storage order
1102 inline void reset( SMatTransposer<MT,SO>& m )
1103 {
1104  m.reset();
1105 }
1107 //*************************************************************************************************
1108 
1109 
1110 //*************************************************************************************************
1118 template< typename MT // Type of the sparse matrix
1119  , bool SO > // Storage order
1120 inline bool isIntact( const SMatTransposer<MT,SO>& m )
1121 {
1122  return m.isIntact();
1123 }
1125 //*************************************************************************************************
1126 
1127 
1128 
1129 
1130 //=================================================================================================
1131 //
1132 // SUBMATRIXTRAIT SPECIALIZATIONS
1133 //
1134 //=================================================================================================
1135 
1136 //*************************************************************************************************
1138 template< typename MT, bool SO >
1139 struct SubmatrixTrait< SMatTransposer<MT,SO> >
1140 {
1141  typedef typename SubmatrixTrait< typename SMatTransposer<MT,SO>::ResultType >::Type Type;
1142 };
1144 //*************************************************************************************************
1145 
1146 } // namespace blaze
1147 
1148 #endif
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
ConstReference operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatTransposer.h:115
Header file for basic type definitions.
EnableIf< IsNumeric< Other >, SMatTransposer >::Type & operator/=(Other rhs)
Division assignment operator for the division of a matrix by a scalar value ( ).
Definition: SMatTransposer.h:262
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatTransposer.h:276
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:118
MT::Reference Reference
Reference to a non-constant matrix value.
Definition: SMatTransposer.h:84
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
EnableIf< IsNumeric< Other >, SMatTransposer >::Type & operator*=(Other rhs)
Multiplication assignment operator for the multiplication between a matrix and a scalar value ( )...
Definition: SMatTransposer.h:245
MT::ElementType ElementType
Resulting element type.
Definition: SMatTransposer.h:81
Constraints on the storage order of matrix types.
ConstReference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatTransposer.h:130
MT & sm_
The sparse matrix operand.
Definition: SMatTransposer.h:572
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:117
Header file for the SparseMatrix base class.
bool canSMPAssign() const
Returns whether the matrix can be used in SMP assignments.
Definition: SMatTransposer.h:486
void reserve(size_t i, size_t nonzeros)
Setting the minimum capacity of a specific row/column of the sparse matrix.
Definition: SMatTransposer.h:390
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SMatTransposer.h:82
size_t capacity(size_t i) const
Returns the current capacity of the specified row/column.
Definition: SMatTransposer.h:307
Constraint on the data type.
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: SMatTransposer.h:475
MT OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTransposer.h:79
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#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: ColumnMajorMatrix.h:79
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:152
#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
void reset()
Resets the matrix elements.
Definition: SMatTransposer.h:338
MT::ConstReference ConstReference
Reference to a constant matrix value.
Definition: SMatTransposer.h:85
MT::TransposeType ResultType
Result type for expression template evaluations.
Definition: SMatTransposer.h:78
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:168
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:216
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SMatTransposer.h:87
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Header file for the EnableIf class template.
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse matrix.
Definition: SMatTransposer.h:371
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: SMatTransposer.h:462
size_t nonZeros() const
Returns the number of non-zero elements in the matrix.
Definition: SMatTransposer.h:317
void assign(const SparseMatrix< MT2, true > &rhs)
Implementation of the transpose assignment of a column-major sparse matrix.
Definition: SMatTransposer.h:536
Header file for the IsNumeric type trait.
MT::Iterator Iterator
Iterator over non-constant elements.
Definition: SMatTransposer.h:86
void assign(const SparseMatrix< MT2, false > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: SMatTransposer.h:504
Expression object for the transposition of a sparse matrix.The SMatTransposer class is a wrapper obje...
Definition: Forward.h:113
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:232
#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: RowMajorMatrix.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:184
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatTransposer.h:286
Header file for run time assertion macros.
Header file for the submatrix trait.
SMatTransposer(MT &sm)
Constructor for the SMatTransposer class.
Definition: SMatTransposer.h:103
SMatTransposer< MT, SO > This
Type of this SMatTransposer instance.
Definition: SMatTransposer.h:77
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
bool isIntact() const
Returns whether the invariants of the matrix are intact.
Definition: SMatTransposer.h:450
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row/column.
Definition: SMatTransposer.h:328
void append(size_t i, size_t j, const ElementType &value, bool check=false)
Appending an element to the specified row/column of the sparse matrix.
Definition: SMatTransposer.h:422
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:200
size_t capacity() const
Returns the maximum capacity of the matrix.
Definition: SMatTransposer.h:296
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Constraints on the storage order of matrix types.
Iterator insert(size_t i, size_t j, const ElementType &value)
Inserting an element into the sparse matrix.
Definition: SMatTransposer.h:356
void finalize(size_t i)
Finalizing the element insertion of a row/column.
Definition: SMatTransposer.h:440
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
MT::ResultType TransposeType
Transpose type for expression template evaluations.
Definition: SMatTransposer.h:80
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Header file for exception macros.
const This & CompositeType
Data type for composite expression templates.
Definition: SMatTransposer.h:83
#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