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>
44 #include <blaze/math/Aliases.h>
49 #include <blaze/math/Exception.h>
52 #include <blaze/util/Assert.h>
53 #include <blaze/util/EnableIf.h>
54 #include <blaze/util/Types.h>
56 
57 
58 namespace blaze {
59 
60 //=================================================================================================
61 //
62 // CLASS SMATTRANSPOSER
63 //
64 //=================================================================================================
65 
66 //*************************************************************************************************
72 template< typename MT // Type of the sparse matrix
73  , bool SO > // Storage order
74 class SMatTransposer
75  : public SparseMatrix< SMatTransposer<MT,SO>, SO >
76 {
77  public:
78  //**Type definitions****************************************************************************
81  using OppositeType = MT;
85  using CompositeType = const This&;
90  //**********************************************************************************************
91 
92  //**Compilation flags***************************************************************************
94 
97  enum : bool { smpAssignable = MT::smpAssignable };
98  //**********************************************************************************************
99 
100  //**Constructor*********************************************************************************
105  explicit inline SMatTransposer( MT& sm ) noexcept
106  : sm_( sm ) // The sparse matrix operand
107  {}
108  //**********************************************************************************************
109 
110  //**Access operator*****************************************************************************
117  inline ConstReference operator()( size_t i, size_t j ) const {
118  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
119  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
120  return sm_(j,i);
121  }
122  //**********************************************************************************************
123 
124  //**At function*********************************************************************************
132  inline ConstReference at( size_t i, size_t j ) const {
133  if( i >= sm_.columns() ) {
134  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
135  }
136  if( j >= sm_.rows() ) {
137  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
138  }
139  return (*this)(i,j);
140  }
141  //**********************************************************************************************
142 
143  //**Begin function******************************************************************************
154  inline Iterator begin( size_t i ) {
155  return sm_.begin(i);
156  }
157  //**********************************************************************************************
158 
159  //**Begin function******************************************************************************
170  inline ConstIterator begin( size_t i ) const {
171  return sm_.cbegin(i);
172  }
173  //**********************************************************************************************
174 
175  //**Cbegin function*****************************************************************************
186  inline ConstIterator cbegin( size_t i ) const {
187  return sm_.cbegin(i);
188  }
189  //**********************************************************************************************
190 
191  //**End function********************************************************************************
202  inline Iterator end( size_t i ) {
203  return sm_.end(i);
204  }
205  //**********************************************************************************************
206 
207  //**End function********************************************************************************
218  inline ConstIterator end( size_t i ) const {
219  return sm_.cend(i);
220  }
221  //**********************************************************************************************
222 
223  //**Cend function*******************************************************************************
234  inline ConstIterator cend( size_t i ) const {
235  return sm_.cend(i);
236  }
237  //**********************************************************************************************
238 
239  //**Multiplication assignment operator**********************************************************
246  template< typename Other > // Data type of the right-hand side scalar
248  {
249  (~sm_) *= rhs;
250  return *this;
251  }
252  //**********************************************************************************************
253 
254  //**Division assignment operator****************************************************************
263  template< typename Other > // Data type of the right-hand side scalar
265  {
266  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
267 
268  (~sm_) /= rhs;
269  return *this;
270  }
271  //**********************************************************************************************
272 
273  //**Rows function*******************************************************************************
278  inline size_t rows() const noexcept {
279  return sm_.columns();
280  }
281  //**********************************************************************************************
282 
283  //**Columns function****************************************************************************
288  inline size_t columns() const noexcept {
289  return sm_.rows();
290  }
291  //**********************************************************************************************
292 
293  //**Capacity function***************************************************************************
298  inline size_t capacity() const noexcept {
299  return sm_.capacity();
300  }
301  //**********************************************************************************************
302 
303  //**Capacity function***************************************************************************
309  inline size_t capacity( size_t i ) const noexcept {
310  return sm_.capacity( i );
311  }
312  //**********************************************************************************************
313 
314  //**NonZeros function***************************************************************************
319  inline size_t nonZeros() const {
320  return sm_.nonZeros();
321  }
322  //**********************************************************************************************
323 
324  //**NonZeros function***************************************************************************
330  inline size_t nonZeros( size_t i ) const {
331  return sm_.nonZeros( i );
332  }
333  //**********************************************************************************************
334 
335  //**Reset function******************************************************************************
340  inline void reset() {
341  return sm_.reset();
342  }
343  //**********************************************************************************************
344 
345  //**Insert function*****************************************************************************
358  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
359  return sm_.insert( j, i, value );
360  }
361  //**********************************************************************************************
362 
363  //**Reserve function****************************************************************************
373  inline void reserve( size_t nonzeros ) {
374  sm_.reserve( nonzeros );
375  }
376  //**********************************************************************************************
377 
378  //**Reserve function****************************************************************************
392  inline void reserve( size_t i, size_t nonzeros ) {
393  sm_.reserve( i, nonzeros );
394  }
395  //**********************************************************************************************
396 
397  //**Append function*****************************************************************************
424  inline void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
425  sm_.append( j, i, value, check );
426  }
427  //**********************************************************************************************
428 
429  //**Finalize function***************************************************************************
442  inline void finalize( size_t i ) {
443  sm_.finalize( i );
444  }
445  //**********************************************************************************************
446 
447  //**IsIntact function***************************************************************************
452  inline bool isIntact() const noexcept {
453  return isIntact( sm_ );
454  }
455  //**********************************************************************************************
456 
457  //**********************************************************************************************
463  template< typename Other > // Data type of the foreign expression
464  inline bool canAlias( const Other* alias ) const noexcept
465  {
466  return sm_.canAlias( alias );
467  }
468  //**********************************************************************************************
469 
470  //**********************************************************************************************
476  template< typename Other > // Data type of the foreign expression
477  inline bool isAliased( const Other* alias ) const noexcept
478  {
479  return sm_.isAliased( alias );
480  }
481  //**********************************************************************************************
482 
483  //**CanSMPAssign function***********************************************************************
488  inline bool canSMPAssign() const noexcept
489  {
490  return sm_.canSMPAssign();
491  }
492  //**********************************************************************************************
493 
494  //**Transpose assignment of row-major sparse matrices*******************************************
505  template< typename MT2 > // Type of the right-hand side sparse matrix
506  inline void assign( const SparseMatrix<MT2,false>& rhs )
507  {
509 
510  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
511  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
512  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
513 
514  using RhsIterator = ConstIterator_<MT2>;
515 
516  const size_t m( rows() );
517 
518  for( size_t i=0UL; i<m; ++i ) {
519  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
520  sm_.append( element->index(), i, element->value() );
521  finalize( i );
522  }
523  }
524  //**********************************************************************************************
525 
526  //**Transpose assignment of column-major sparse matrices****************************************
537  template< typename MT2 > // Type of the right-hand side sparse matrix
538  inline void assign( const SparseMatrix<MT2,true>& rhs )
539  {
541 
542  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
543  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
544  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
545 
546  using RhsIterator = ConstIterator_<MT2>;
547 
548  const size_t m( rows() );
549  const size_t n( columns() );
550 
551  // Counting the number of elements per row
552  std::vector<size_t> rowLengths( m, 0UL );
553  for( size_t j=0UL; j<n; ++j ) {
554  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
555  ++rowLengths[element->index()];
556  }
557 
558  // Resizing the sparse matrix
559  for( size_t i=0UL; i<m; ++i ) {
560  sm_.reserve( i, rowLengths[i] );
561  }
562 
563  // Appending the elements to the rows of the sparse matrix
564  for( size_t j=0UL; j<n; ++j ) {
565  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
566  sm_.append( j, element->index(), element->value() );
567  }
568  }
569  }
570  //**********************************************************************************************
571 
572  private:
573  //**Member variables****************************************************************************
574  MT& sm_;
575  //**********************************************************************************************
576 
577  //**Compile time checks*************************************************************************
583  //**********************************************************************************************
584 };
585 //*************************************************************************************************
586 
587 
588 
589 
590 //=================================================================================================
591 //
592 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR MATRICES
593 //
594 //=================================================================================================
595 
596 //*************************************************************************************************
604 template< typename MT > // Type of the sparse matrix
605 class SMatTransposer<MT,true>
606  : public SparseMatrix< SMatTransposer<MT,true>, true >
607 {
608  public:
609  //**Type definitions****************************************************************************
610  using This = SMatTransposer<MT,true>;
612  using OppositeType = MT;
614  using ElementType = ElementType_<MT>;
615  using ReturnType = ReturnType_<MT>;
616  using CompositeType = const This&;
617  using Reference = Reference_<MT>;
619  using Iterator = Iterator_<MT>;
621  //**********************************************************************************************
622 
623  //**Compilation flags***************************************************************************
625 
628  enum : bool { smpAssignable = MT::smpAssignable };
629  //**********************************************************************************************
630 
631  //**Constructor*********************************************************************************
636  explicit inline SMatTransposer( MT& sm ) noexcept
637  : sm_( sm ) // The sparse matrix operand
638  {}
639  //**********************************************************************************************
640 
641  //**Access operator*****************************************************************************
648  inline ConstReference operator()( size_t i, size_t j ) const {
649  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
650  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
651  return sm_(j,i);
652  }
653  //**********************************************************************************************
654 
655  //**At function*********************************************************************************
663  inline ConstReference at( size_t i, size_t j ) const {
664  if( i >= sm_.columns() ) {
665  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
666  }
667  if( j >= sm_.rows() ) {
668  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
669  }
670  return (*this)(i,j);
671  }
672  //**********************************************************************************************
673 
674  //**Begin function******************************************************************************
680  inline Iterator begin( size_t j ) {
681  return sm_.begin(j);
682  }
683  //**********************************************************************************************
684 
685  //**Begin function******************************************************************************
691  inline ConstIterator begin( size_t j ) const {
692  return sm_.cbegin(j);
693  }
694  //**********************************************************************************************
695 
696  //**Cbegin function*****************************************************************************
702  inline ConstIterator cbegin( size_t j ) const {
703  return sm_.cbegin(j);
704  }
705  //**********************************************************************************************
706 
707  //**End function********************************************************************************
713  inline Iterator end( size_t j ) {
714  return sm_.end(j);
715  }
716  //**********************************************************************************************
717 
718  //**End function********************************************************************************
724  inline ConstIterator end( size_t j ) const {
725  return sm_.cend(j);
726  }
727  //**********************************************************************************************
728 
729  //**Cend function*******************************************************************************
735  inline ConstIterator cend( size_t j ) const {
736  return sm_.cend(j);
737  }
738  //**********************************************************************************************
739 
740  //**Multiplication assignment operator**********************************************************
747  template< typename Other > // Data type of the right-hand side scalar
749  {
750  (~sm_) *= rhs;
751  return *this;
752  }
753  //**********************************************************************************************
754 
755  //**Division assignment operator****************************************************************
764  template< typename Other > // Data type of the right-hand side scalar
766  {
767  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
768 
769  (~sm_) /= rhs;
770  return *this;
771  }
772  //**********************************************************************************************
773 
774  //**Rows function*******************************************************************************
779  inline size_t rows() const noexcept {
780  return sm_.columns();
781  }
782  //**********************************************************************************************
783 
784  //**Columns function****************************************************************************
789  inline size_t columns() const noexcept {
790  return sm_.rows();
791  }
792  //**********************************************************************************************
793 
794  //**Capacity function***************************************************************************
799  inline size_t capacity() const noexcept {
800  return sm_.capacity();
801  }
802  //**********************************************************************************************
803 
804  //**Capacity function***************************************************************************
810  inline size_t capacity( size_t j ) const noexcept {
811  return sm_.capacity( j );
812  }
813  //**********************************************************************************************
814 
815  //**NonZeros function***************************************************************************
820  inline size_t nonZeros() const {
821  return sm_.nonZeros();
822  }
823  //**********************************************************************************************
824 
825  //**NonZeros function***************************************************************************
831  inline size_t nonZeros( size_t j ) const {
832  return sm_.nonZeros( j );
833  }
834  //**********************************************************************************************
835 
836  //**Reset function******************************************************************************
841  inline void reset() {
842  return sm_.reset();
843  }
844  //**********************************************************************************************
845 
846  //**Insert function*****************************************************************************
859  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
860  return sm_.insert( j, i, value );
861  }
862  //**********************************************************************************************
863 
864  //**Reserve function****************************************************************************
874  inline void reserve( size_t nonzeros ) {
875  sm_.reserve( nonzeros );
876  }
877  //**********************************************************************************************
878 
879  //**Reserve function****************************************************************************
890  inline void reserve( size_t i, size_t nonzeros ) {
891  sm_.reserve( i, nonzeros );
892  }
893  //**********************************************************************************************
894 
895  //**Append function*****************************************************************************
922  void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
923  sm_.append( j, i, value, check );
924  }
925  //**********************************************************************************************
926 
927  //**Finalize function***************************************************************************
940  inline void finalize( size_t j ) {
941  sm_.finalize( j );
942  }
943  //**********************************************************************************************
944 
945  //**IsIntact function***************************************************************************
950  inline bool isIntact() const noexcept {
951  return isIntact( sm_ );
952  }
953  //**********************************************************************************************
954 
955  //**********************************************************************************************
961  template< typename Other > // Data type of the foreign expression
962  inline bool canAlias( const Other* alias ) const noexcept
963  {
964  return sm_.canAlias( alias );
965  }
966  //**********************************************************************************************
967 
968  //**********************************************************************************************
974  template< typename Other > // Data type of the foreign expression
975  inline bool isAliased( const Other* alias ) const noexcept
976  {
977  return sm_.isAliased( alias );
978  }
979  //**********************************************************************************************
980 
981  //**CanSMPAssign function***********************************************************************
986  inline bool canSMPAssign() const noexcept
987  {
988  return sm_.canSMPAssign();
989  }
990  //**********************************************************************************************
991 
992  //**Transpose assignment of row-major sparse matrices*******************************************
1003  template< typename MT2 > // Type of the right-hand side sparse matrix
1004  inline void assign( const SparseMatrix<MT2,false>& rhs )
1005  {
1007 
1008  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
1009  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
1010  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
1011 
1012  using RhsIterator = ConstIterator_<MT2>;
1013 
1014  const size_t m( rows() );
1015  const size_t n( columns() );
1016 
1017  // Counting the number of elements per row
1018  std::vector<size_t> columnLengths( n, 0UL );
1019  for( size_t i=0UL; i<m; ++i ) {
1020  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
1021  ++columnLengths[element->index()];
1022  }
1023 
1024  // Resizing the sparse matrix
1025  for( size_t j=0UL; j<n; ++j ) {
1026  sm_.reserve( j, columnLengths[j] );
1027  }
1028 
1029  // Appending the elements to the columns of the sparse matrix
1030  for( size_t i=0UL; i<m; ++i ) {
1031  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
1032  sm_.append( element->index(), i, element->value() );
1033  }
1034  }
1035  }
1036  //**********************************************************************************************
1037 
1038  //**Transpose assignment of column-major sparse matrices****************************************
1049  template< typename MT2 > // Type of the right-hand side sparse matrix
1050  inline void assign( const SparseMatrix<MT2,true>& rhs )
1051  {
1053 
1054  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
1055  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
1056  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
1057 
1058  using RhsIterator = ConstIterator_<MT2>;
1059 
1060  const size_t n( columns() );
1061 
1062  for( size_t j=0UL; j<n; ++j ) {
1063  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
1064  sm_.append( j, element->index(), element->value() );
1065  finalize( j );
1066  }
1067  }
1068  //**********************************************************************************************
1069 
1070  private:
1071  //**Member variables****************************************************************************
1072  MT& sm_;
1073  //**********************************************************************************************
1074 
1075  //**Compile time checks*************************************************************************
1081  //**********************************************************************************************
1082 };
1084 //*************************************************************************************************
1085 
1086 
1087 
1088 
1089 //=================================================================================================
1090 //
1091 // GLOBAL OPERATORS
1092 //
1093 //=================================================================================================
1094 
1095 //*************************************************************************************************
1103 template< typename MT // Type of the sparse matrix
1104  , bool SO > // Storage order
1105 inline void reset( SMatTransposer<MT,SO>& m )
1106 {
1107  m.reset();
1108 }
1110 //*************************************************************************************************
1111 
1112 
1113 //*************************************************************************************************
1121 template< typename MT // Type of the sparse matrix
1122  , bool SO > // Storage order
1123 inline bool isIntact( const SMatTransposer<MT,SO>& m ) noexcept
1124 {
1125  return m.isIntact();
1126 }
1128 //*************************************************************************************************
1129 
1130 
1131 
1132 
1133 //=================================================================================================
1134 //
1135 // SUBMATRIXTRAIT SPECIALIZATIONS
1136 //
1137 //=================================================================================================
1138 
1139 //*************************************************************************************************
1141 template< typename MT, bool SO >
1142 struct SubmatrixTrait< SMatTransposer<MT,SO> >
1143 {
1145 };
1147 //*************************************************************************************************
1148 
1149 } // namespace blaze
1150 
1151 #endif
size_t capacity(size_t i) const noexcept
Returns the current capacity of the specified row/column.
Definition: SMatTransposer.h:309
Constraint on the data type.
Header file for auxiliary alias declarations.
#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
Header file for basic type definitions.
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatTransposer.h:84
ConstReference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatTransposer.h:132
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:128
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:234
#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:81
SMatTransposer(MT &sm) noexcept
Constructor for the SMatTransposer class.
Definition: SMatTransposer.h:105
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: SMatTransposer.h:477
MT OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTransposer.h:81
EnableIf_< IsNumeric< Other >, SMatTransposer > & operator*=(Other rhs)
Multiplication assignment operator for the multiplication between a matrix and a scalar value ( )...
Definition: SMatTransposer.h:247
Iterator_< MT > Iterator
Iterator over non-constant elements.
Definition: SMatTransposer.h:88
Constraints on the storage order of matrix types.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatTransposer.h:288
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
bool isIntact() const noexcept
Returns whether the invariants of the matrix are intact.
Definition: SMatTransposer.h:452
MT & sm_
The sparse matrix operand.
Definition: SMatTransposer.h:574
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
Header file for the SparseMatrix base class.
void reserve(size_t i, size_t nonzeros)
Setting the minimum capacity of a specific row/column of the sparse matrix.
Definition: SMatTransposer.h:392
Constraint on the data type.
size_t nonZeros() const
Returns the number of non-zero elements in the matrix.
Definition: SMatTransposer.h:319
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:61
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:154
ConstReference operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatTransposer.h:117
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Reference_< MT > Reference
Reference to a non-constant matrix value.
Definition: SMatTransposer.h:86
void reset()
Resets the matrix elements.
Definition: SMatTransposer.h:340
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:170
Header file for the exception macros of the math module.
EnableIf_< IsNumeric< Other >, SMatTransposer > & operator/=(Other rhs)
Division assignment operator for the division of a matrix by a scalar value ( ).
Definition: SMatTransposer.h:264
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:218
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:186
typename T::Reference Reference_
Alias declaration for nested Reference type definitions.The Reference_ alias declaration provides a c...
Definition: Aliases.h:303
Header file for the EnableIf class template.
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse matrix.
Definition: SMatTransposer.h:373
ConstIterator_< MT > ConstIterator
Iterator over constant elements.
Definition: SMatTransposer.h:89
void assign(const SparseMatrix< MT2, true > &rhs)
Implementation of the transpose assignment of a column-major sparse matrix.
Definition: SMatTransposer.h:538
Header file for the IsNumeric type trait.
TransposeType_< MT > ResultType
Result type for expression template evaluations.
Definition: SMatTransposer.h:80
ElementType_< MT > ElementType
Resulting element type.
Definition: SMatTransposer.h:83
void assign(const SparseMatrix< MT2, false > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: SMatTransposer.h:506
Expression object for the transposition of a sparse matrix.The SMatTransposer class is a wrapper obje...
Definition: Forward.h:124
#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:61
Header file for run time assertion macros.
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: SMatTransposer.h:464
ResultType_< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SMatTransposer.h:82
Header file for the submatrix trait.
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:424
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:202
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatTransposer.h:278
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:358
typename SubmatrixTrait< MT >::Type SubmatrixTrait_
Auxiliary alias declaration for the SubmatrixTrait type trait.The SubmatrixTrait_ alias declaration p...
Definition: SubmatrixTrait.h:163
ConstReference_< MT > ConstReference
Reference to a constant matrix value.
Definition: SMatTransposer.h:87
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
typename T::Iterator Iterator_
Alias declaration for nested Iterator type definitions.The Iterator_ alias declaration provides a con...
Definition: Aliases.h:183
void finalize(size_t i)
Finalizing the element insertion of a row/column.
Definition: SMatTransposer.h:442
typename T::ConstReference ConstReference_
Alias declaration for nested ConstReference type definitions.The ConstReference_ alias declaration pr...
Definition: Aliases.h:143
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
size_t capacity() const noexcept
Returns the maximum capacity of the matrix.
Definition: SMatTransposer.h:298
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row/column.
Definition: SMatTransposer.h:330
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: SMatTransposer.h:488
#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:61