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 : public SparseMatrix< SMatTransposer<MT,SO>, SO >
75 {
76  public:
77  //**Type definitions****************************************************************************
80  typedef MT OppositeType;
84  typedef const This& CompositeType;
89  //**********************************************************************************************
90 
91  //**Compilation flags***************************************************************************
93 
96  enum : bool { smpAssignable = MT::smpAssignable };
97  //**********************************************************************************************
98 
99  //**Constructor*********************************************************************************
104  explicit inline SMatTransposer( MT& sm ) noexcept
105  : sm_( sm ) // The sparse matrix operand
106  {}
107  //**********************************************************************************************
108 
109  //**Access operator*****************************************************************************
116  inline ConstReference operator()( size_t i, size_t j ) const {
117  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
118  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
119  return sm_(j,i);
120  }
121  //**********************************************************************************************
122 
123  //**At function*********************************************************************************
131  inline ConstReference at( size_t i, size_t j ) const {
132  if( i >= sm_.columns() ) {
133  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
134  }
135  if( j >= sm_.rows() ) {
136  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
137  }
138  return (*this)(i,j);
139  }
140  //**********************************************************************************************
141 
142  //**Begin function******************************************************************************
153  inline Iterator begin( size_t i ) {
154  return sm_.begin(i);
155  }
156  //**********************************************************************************************
157 
158  //**Begin function******************************************************************************
169  inline ConstIterator begin( size_t i ) const {
170  return sm_.cbegin(i);
171  }
172  //**********************************************************************************************
173 
174  //**Cbegin function*****************************************************************************
185  inline ConstIterator cbegin( size_t i ) const {
186  return sm_.cbegin(i);
187  }
188  //**********************************************************************************************
189 
190  //**End function********************************************************************************
201  inline Iterator end( size_t i ) {
202  return sm_.end(i);
203  }
204  //**********************************************************************************************
205 
206  //**End function********************************************************************************
217  inline ConstIterator end( size_t i ) const {
218  return sm_.cend(i);
219  }
220  //**********************************************************************************************
221 
222  //**Cend function*******************************************************************************
233  inline ConstIterator cend( size_t i ) const {
234  return sm_.cend(i);
235  }
236  //**********************************************************************************************
237 
238  //**Multiplication assignment operator**********************************************************
245  template< typename Other > // Data type of the right-hand side scalar
247  {
248  (~sm_) *= rhs;
249  return *this;
250  }
251  //**********************************************************************************************
252 
253  //**Division assignment operator****************************************************************
262  template< typename Other > // Data type of the right-hand side scalar
264  {
265  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
266 
267  (~sm_) /= rhs;
268  return *this;
269  }
270  //**********************************************************************************************
271 
272  //**Rows function*******************************************************************************
277  inline size_t rows() const noexcept {
278  return sm_.columns();
279  }
280  //**********************************************************************************************
281 
282  //**Columns function****************************************************************************
287  inline size_t columns() const noexcept {
288  return sm_.rows();
289  }
290  //**********************************************************************************************
291 
292  //**Capacity function***************************************************************************
297  inline size_t capacity() const noexcept {
298  return sm_.capacity();
299  }
300  //**********************************************************************************************
301 
302  //**Capacity function***************************************************************************
308  inline size_t capacity( size_t i ) const noexcept {
309  return sm_.capacity( i );
310  }
311  //**********************************************************************************************
312 
313  //**NonZeros function***************************************************************************
318  inline size_t nonZeros() const {
319  return sm_.nonZeros();
320  }
321  //**********************************************************************************************
322 
323  //**NonZeros function***************************************************************************
329  inline size_t nonZeros( size_t i ) const {
330  return sm_.nonZeros( i );
331  }
332  //**********************************************************************************************
333 
334  //**Reset function******************************************************************************
339  inline void reset() {
340  return sm_.reset();
341  }
342  //**********************************************************************************************
343 
344  //**Insert function*****************************************************************************
357  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
358  return sm_.insert( j, i, value );
359  }
360  //**********************************************************************************************
361 
362  //**Reserve function****************************************************************************
372  inline void reserve( size_t nonzeros ) {
373  sm_.reserve( nonzeros );
374  }
375  //**********************************************************************************************
376 
377  //**Reserve function****************************************************************************
391  inline void reserve( size_t i, size_t nonzeros ) {
392  sm_.reserve( i, nonzeros );
393  }
394  //**********************************************************************************************
395 
396  //**Append function*****************************************************************************
423  inline void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
424  sm_.append( j, i, value, check );
425  }
426  //**********************************************************************************************
427 
428  //**Finalize function***************************************************************************
441  inline void finalize( size_t i ) {
442  sm_.finalize( i );
443  }
444  //**********************************************************************************************
445 
446  //**IsIntact function***************************************************************************
451  inline bool isIntact() const noexcept {
452  return isIntact( sm_ );
453  }
454  //**********************************************************************************************
455 
456  //**********************************************************************************************
462  template< typename Other > // Data type of the foreign expression
463  inline bool canAlias( const Other* alias ) const noexcept
464  {
465  return sm_.canAlias( alias );
466  }
467  //**********************************************************************************************
468 
469  //**********************************************************************************************
475  template< typename Other > // Data type of the foreign expression
476  inline bool isAliased( const Other* alias ) const noexcept
477  {
478  return sm_.isAliased( alias );
479  }
480  //**********************************************************************************************
481 
482  //**CanSMPAssign function***********************************************************************
487  inline bool canSMPAssign() const noexcept
488  {
489  return sm_.canSMPAssign();
490  }
491  //**********************************************************************************************
492 
493  //**Transpose assignment of row-major sparse matrices*******************************************
504  template< typename MT2 > // Type of the right-hand side sparse matrix
505  inline void assign( const SparseMatrix<MT2,false>& rhs )
506  {
508 
509  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
510  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
511  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
512 
513  typedef ConstIterator_<MT2> RhsIterator;
514 
515  const size_t m( rows() );
516 
517  for( size_t i=0UL; i<m; ++i ) {
518  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
519  sm_.append( element->index(), i, element->value() );
520  finalize( i );
521  }
522  }
523  //**********************************************************************************************
524 
525  //**Transpose assignment of column-major sparse matrices****************************************
536  template< typename MT2 > // Type of the right-hand side sparse matrix
537  inline void assign( const SparseMatrix<MT2,true>& rhs )
538  {
540 
541  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
542  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
543  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
544 
545  typedef ConstIterator_<MT2> RhsIterator;
546 
547  const size_t m( rows() );
548  const size_t n( columns() );
549 
550  // Counting the number of elements per row
551  std::vector<size_t> rowLengths( m, 0UL );
552  for( size_t j=0UL; j<n; ++j ) {
553  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
554  ++rowLengths[element->index()];
555  }
556 
557  // Resizing the sparse matrix
558  for( size_t i=0UL; i<m; ++i ) {
559  sm_.reserve( i, rowLengths[i] );
560  }
561 
562  // Appending the elements to the rows of the sparse matrix
563  for( size_t j=0UL; j<n; ++j ) {
564  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
565  sm_.append( j, element->index(), element->value() );
566  }
567  }
568  }
569  //**********************************************************************************************
570 
571  private:
572  //**Member variables****************************************************************************
573  MT& sm_;
574  //**********************************************************************************************
575 
576  //**Compile time checks*************************************************************************
582  //**********************************************************************************************
583 };
584 //*************************************************************************************************
585 
586 
587 
588 
589 //=================================================================================================
590 //
591 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR MATRICES
592 //
593 //=================================================================================================
594 
595 //*************************************************************************************************
603 template< typename MT > // Type of the sparse matrix
604 class SMatTransposer<MT,true> : public SparseMatrix< SMatTransposer<MT,true>, true >
605 {
606  public:
607  //**Type definitions****************************************************************************
608  typedef SMatTransposer<MT,true> This;
610  typedef MT OppositeType;
612  typedef ElementType_<MT> ElementType;
613  typedef ReturnType_<MT> ReturnType;
614  typedef const This& CompositeType;
615  typedef Reference_<MT> Reference;
617  typedef Iterator_<MT> Iterator;
619  //**********************************************************************************************
620 
621  //**Compilation flags***************************************************************************
623 
626  enum : bool { smpAssignable = MT::smpAssignable };
627  //**********************************************************************************************
628 
629  //**Constructor*********************************************************************************
634  explicit inline SMatTransposer( MT& sm ) noexcept
635  : sm_( sm ) // The sparse matrix operand
636  {}
637  //**********************************************************************************************
638 
639  //**Access operator*****************************************************************************
646  inline ConstReference operator()( size_t i, size_t j ) const {
647  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
648  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
649  return sm_(j,i);
650  }
651  //**********************************************************************************************
652 
653  //**At function*********************************************************************************
661  inline ConstReference at( size_t i, size_t j ) const {
662  if( i >= sm_.columns() ) {
663  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
664  }
665  if( j >= sm_.rows() ) {
666  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
667  }
668  return (*this)(i,j);
669  }
670  //**********************************************************************************************
671 
672  //**Begin function******************************************************************************
678  inline Iterator begin( size_t j ) {
679  return sm_.begin(j);
680  }
681  //**********************************************************************************************
682 
683  //**Begin function******************************************************************************
689  inline ConstIterator begin( size_t j ) const {
690  return sm_.cbegin(j);
691  }
692  //**********************************************************************************************
693 
694  //**Cbegin function*****************************************************************************
700  inline ConstIterator cbegin( size_t j ) const {
701  return sm_.cbegin(j);
702  }
703  //**********************************************************************************************
704 
705  //**End function********************************************************************************
711  inline Iterator end( size_t j ) {
712  return sm_.end(j);
713  }
714  //**********************************************************************************************
715 
716  //**End function********************************************************************************
722  inline ConstIterator end( size_t j ) const {
723  return sm_.cend(j);
724  }
725  //**********************************************************************************************
726 
727  //**Cend function*******************************************************************************
733  inline ConstIterator cend( size_t j ) const {
734  return sm_.cend(j);
735  }
736  //**********************************************************************************************
737 
738  //**Multiplication assignment operator**********************************************************
745  template< typename Other > // Data type of the right-hand side scalar
746  inline EnableIf_< IsNumeric<Other>, SMatTransposer >& operator*=( Other rhs )
747  {
748  (~sm_) *= rhs;
749  return *this;
750  }
751  //**********************************************************************************************
752 
753  //**Division assignment operator****************************************************************
762  template< typename Other > // Data type of the right-hand side scalar
763  inline EnableIf_< IsNumeric<Other>, SMatTransposer >& operator/=( Other rhs )
764  {
765  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
766 
767  (~sm_) /= rhs;
768  return *this;
769  }
770  //**********************************************************************************************
771 
772  //**Rows function*******************************************************************************
777  inline size_t rows() const noexcept {
778  return sm_.columns();
779  }
780  //**********************************************************************************************
781 
782  //**Columns function****************************************************************************
787  inline size_t columns() const noexcept {
788  return sm_.rows();
789  }
790  //**********************************************************************************************
791 
792  //**Capacity function***************************************************************************
797  inline size_t capacity() const noexcept {
798  return sm_.capacity();
799  }
800  //**********************************************************************************************
801 
802  //**Capacity function***************************************************************************
808  inline size_t capacity( size_t j ) const noexcept {
809  return sm_.capacity( j );
810  }
811  //**********************************************************************************************
812 
813  //**NonZeros function***************************************************************************
818  inline size_t nonZeros() const {
819  return sm_.nonZeros();
820  }
821  //**********************************************************************************************
822 
823  //**NonZeros function***************************************************************************
829  inline size_t nonZeros( size_t j ) const {
830  return sm_.nonZeros( j );
831  }
832  //**********************************************************************************************
833 
834  //**Reset function******************************************************************************
839  inline void reset() {
840  return sm_.reset();
841  }
842  //**********************************************************************************************
843 
844  //**Insert function*****************************************************************************
857  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
858  return sm_.insert( j, i, value );
859  }
860  //**********************************************************************************************
861 
862  //**Reserve function****************************************************************************
872  inline void reserve( size_t nonzeros ) {
873  sm_.reserve( nonzeros );
874  }
875  //**********************************************************************************************
876 
877  //**Reserve function****************************************************************************
888  inline void reserve( size_t i, size_t nonzeros ) {
889  sm_.reserve( i, nonzeros );
890  }
891  //**********************************************************************************************
892 
893  //**Append function*****************************************************************************
920  void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
921  sm_.append( j, i, value, check );
922  }
923  //**********************************************************************************************
924 
925  //**Finalize function***************************************************************************
938  inline void finalize( size_t j ) {
939  sm_.finalize( j );
940  }
941  //**********************************************************************************************
942 
943  //**IsIntact function***************************************************************************
948  inline bool isIntact() const noexcept {
949  return isIntact( sm_ );
950  }
951  //**********************************************************************************************
952 
953  //**********************************************************************************************
959  template< typename Other > // Data type of the foreign expression
960  inline bool canAlias( const Other* alias ) const noexcept
961  {
962  return sm_.canAlias( alias );
963  }
964  //**********************************************************************************************
965 
966  //**********************************************************************************************
972  template< typename Other > // Data type of the foreign expression
973  inline bool isAliased( const Other* alias ) const noexcept
974  {
975  return sm_.isAliased( alias );
976  }
977  //**********************************************************************************************
978 
979  //**CanSMPAssign function***********************************************************************
984  inline bool canSMPAssign() const noexcept
985  {
986  return sm_.canSMPAssign();
987  }
988  //**********************************************************************************************
989 
990  //**Transpose assignment of row-major sparse matrices*******************************************
1001  template< typename MT2 > // Type of the right-hand side sparse matrix
1002  inline void assign( const SparseMatrix<MT2,false>& rhs )
1003  {
1005 
1006  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
1007  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
1008  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
1009 
1010  typedef ConstIterator_<MT2> RhsIterator;
1011 
1012  const size_t m( rows() );
1013  const size_t n( columns() );
1014 
1015  // Counting the number of elements per row
1016  std::vector<size_t> columnLengths( n, 0UL );
1017  for( size_t i=0UL; i<m; ++i ) {
1018  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
1019  ++columnLengths[element->index()];
1020  }
1021 
1022  // Resizing the sparse matrix
1023  for( size_t j=0UL; j<n; ++j ) {
1024  sm_.reserve( j, columnLengths[j] );
1025  }
1026 
1027  // Appending the elements to the columns of the sparse matrix
1028  for( size_t i=0UL; i<m; ++i ) {
1029  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
1030  sm_.append( element->index(), i, element->value() );
1031  }
1032  }
1033  }
1034  //**********************************************************************************************
1035 
1036  //**Transpose assignment of column-major sparse matrices****************************************
1047  template< typename MT2 > // Type of the right-hand side sparse matrix
1048  inline void assign( const SparseMatrix<MT2,true>& rhs )
1049  {
1051 
1052  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
1053  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
1054  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
1055 
1056  typedef ConstIterator_<MT2> RhsIterator;
1057 
1058  const size_t n( columns() );
1059 
1060  for( size_t j=0UL; j<n; ++j ) {
1061  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
1062  sm_.append( j, element->index(), element->value() );
1063  finalize( j );
1064  }
1065  }
1066  //**********************************************************************************************
1067 
1068  private:
1069  //**Member variables****************************************************************************
1070  MT& sm_;
1071  //**********************************************************************************************
1072 
1073  //**Compile time checks*************************************************************************
1079  //**********************************************************************************************
1080 };
1082 //*************************************************************************************************
1083 
1084 
1085 
1086 
1087 //=================================================================================================
1088 //
1089 // GLOBAL OPERATORS
1090 //
1091 //=================================================================================================
1092 
1093 //*************************************************************************************************
1101 template< typename MT // Type of the sparse matrix
1102  , bool SO > // Storage order
1103 inline void reset( SMatTransposer<MT,SO>& m )
1104 {
1105  m.reset();
1106 }
1108 //*************************************************************************************************
1109 
1110 
1111 //*************************************************************************************************
1119 template< typename MT // Type of the sparse matrix
1120  , bool SO > // Storage order
1121 inline bool isIntact( const SMatTransposer<MT,SO>& m ) noexcept
1122 {
1123  return m.isIntact();
1124 }
1126 //*************************************************************************************************
1127 
1128 
1129 
1130 
1131 //=================================================================================================
1132 //
1133 // SUBMATRIXTRAIT SPECIALIZATIONS
1134 //
1135 //=================================================================================================
1136 
1137 //*************************************************************************************************
1139 template< typename MT, bool SO >
1140 struct SubmatrixTrait< SMatTransposer<MT,SO> >
1141 {
1142  using Type = SubmatrixTrait_< ResultType_< SMatTransposer<MT,SO> > >;
1143 };
1145 //*************************************************************************************************
1146 
1147 } // namespace blaze
1148 
1149 #endif
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SMatTransposer.h:83
Constraint on the data type.
size_t capacity(size_t i) const noexcept
Returns the current capacity of the specified row/column.
Definition: SMatTransposer.h:308
Header file for auxiliary alias declarations.
ConstIterator_< MT > ConstIterator
Iterator over constant elements.
Definition: SMatTransposer.h:88
#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:116
Header file for basic type definitions.
#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:104
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatTransposer.h:287
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: SMatTransposer.h:476
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
ResultType_< MT > TransposeType
Transpose type 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:246
Constraints on the storage order of matrix types.
TransposeType_< MT > ResultType
Result type for expression template evaluations.
Definition: SMatTransposer.h:79
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
ConstReference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatTransposer.h:131
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatTransposer.h:277
MT & sm_
The sparse matrix operand.
Definition: SMatTransposer.h:573
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
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:391
Constraint on the data type.
MT OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTransposer.h:80
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:153
#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
void reset()
Resets the matrix elements.
Definition: SMatTransposer.h:339
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Iterator_< MT > Iterator
Iterator over non-constant elements.
Definition: SMatTransposer.h:87
Header file for the exception macros of the math module.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:169
EnableIf_< IsNumeric< Other >, SMatTransposer > & operator/=(Other rhs)
Division assignment operator for the division of a matrix by a scalar value ( ).
Definition: SMatTransposer.h:263
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:217
typename T::Reference Reference_
Alias declaration for nested Reference type definitions.The Reference_ alias declaration provides a c...
Definition: Aliases.h:283
Header file for the EnableIf class template.
ConstReference_< MT > ConstReference
Reference to a constant matrix value.
Definition: SMatTransposer.h:86
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse matrix.
Definition: SMatTransposer.h:372
size_t nonZeros() const
Returns the number of non-zero elements in the matrix.
Definition: SMatTransposer.h:318
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: SMatTransposer.h:487
void assign(const SparseMatrix< MT2, true > &rhs)
Implementation of the transpose assignment of a column-major sparse matrix.
Definition: SMatTransposer.h:537
Header file for the IsNumeric type trait.
void assign(const SparseMatrix< MT2, false > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: SMatTransposer.h:505
Expression object for the transposition of a sparse matrix.The SMatTransposer class is a wrapper obje...
Definition: Forward.h:105
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:233
#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
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:185
Header file for run time assertion macros.
Header file for the submatrix trait.
SMatTransposer< MT, SO > This
Type of this SMatTransposer instance.
Definition: SMatTransposer.h:78
ElementType_< MT > ElementType
Resulting element type.
Definition: SMatTransposer.h:82
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row/column.
Definition: SMatTransposer.h:329
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:423
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:201
bool isIntact() const noexcept
Returns whether the invariants of the matrix are intact.
Definition: SMatTransposer.h:451
Constraints on the storage order of matrix types.
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: SMatTransposer.h:463
Iterator insert(size_t i, size_t j, const ElementType &value)
Inserting an element into the sparse matrix.
Definition: SMatTransposer.h:357
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
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:441
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
Reference_< MT > Reference
Reference to a non-constant matrix value.
Definition: SMatTransposer.h:85
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
const This & CompositeType
Data type for composite expression templates.
Definition: SMatTransposer.h:84
#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
size_t capacity() const noexcept
Returns the maximum capacity of the matrix.
Definition: SMatTransposer.h:297