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>
49 #include <blaze/util/Assert.h>
50 #include <blaze/util/EnableIf.h>
51 #include <blaze/util/Types.h>
53 
54 
55 namespace blaze {
56 
57 //=================================================================================================
58 //
59 // CLASS SMATTRANSPOSER
60 //
61 //=================================================================================================
62 
63 //*************************************************************************************************
69 template< typename MT // Type of the sparse matrix
70  , bool SO > // Storage order
71 class SMatTransposer : public SparseMatrix< SMatTransposer<MT,SO>, SO >
72 {
73  public:
74  //**Type definitions****************************************************************************
76  typedef typename MT::TransposeType ResultType;
77  typedef MT OppositeType;
78  typedef typename MT::ResultType TransposeType;
79  typedef typename MT::ElementType ElementType;
80  typedef typename MT::ReturnType ReturnType;
81  typedef const This& CompositeType;
82  typedef typename MT::Reference Reference;
84  typedef typename MT::Iterator Iterator;
85  typedef typename MT::ConstIterator ConstIterator;
86  //**********************************************************************************************
87 
88  //**Compilation flags***************************************************************************
90 
93  enum { smpAssignable = MT::smpAssignable };
94  //**********************************************************************************************
95 
96  //**Constructor*********************************************************************************
101  explicit inline SMatTransposer( MT& sm )
102  : sm_( sm ) // The sparse matrix operand
103  {}
104  //**********************************************************************************************
105 
106  //**Access operator*****************************************************************************
113  inline ConstReference operator()( size_t i, size_t j ) const {
114  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
115  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
116  return sm_(j,i);
117  }
118  //**********************************************************************************************
119 
120  //**Begin function******************************************************************************
131  inline Iterator begin( size_t i ) {
132  return sm_.begin(i);
133  }
134  //**********************************************************************************************
135 
136  //**Begin function******************************************************************************
147  inline ConstIterator begin( size_t i ) const {
148  return sm_.cbegin(i);
149  }
150  //**********************************************************************************************
151 
152  //**Cbegin function*****************************************************************************
163  inline ConstIterator cbegin( size_t i ) const {
164  return sm_.cbegin(i);
165  }
166  //**********************************************************************************************
167 
168  //**End function********************************************************************************
179  inline Iterator end( size_t i ) {
180  return sm_.end(i);
181  }
182  //**********************************************************************************************
183 
184  //**End function********************************************************************************
195  inline ConstIterator end( size_t i ) const {
196  return sm_.cend(i);
197  }
198  //**********************************************************************************************
199 
200  //**Cend function*******************************************************************************
211  inline ConstIterator cend( size_t i ) const {
212  return sm_.cend(i);
213  }
214  //**********************************************************************************************
215 
216  //**Multiplication assignment operator**********************************************************
223  template< typename Other > // Data type of the right-hand side scalar
224  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator*=( Other rhs )
225  {
226  (~sm_) *= rhs;
227  return *this;
228  }
229  //**********************************************************************************************
230 
231  //**Division assignment operator****************************************************************
240  template< typename Other > // Data type of the right-hand side scalar
241  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator/=( Other rhs )
242  {
243  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
244 
245  (~sm_) /= rhs;
246  return *this;
247  }
248  //**********************************************************************************************
249 
250  //**Rows function*******************************************************************************
255  inline size_t rows() const {
256  return sm_.columns();
257  }
258  //**********************************************************************************************
259 
260  //**Columns function****************************************************************************
265  inline size_t columns() const {
266  return sm_.rows();
267  }
268  //**********************************************************************************************
269 
270  //**Capacity function***************************************************************************
275  inline size_t capacity() const {
276  return sm_.capacity();
277  }
278  //**********************************************************************************************
279 
280  //**Capacity function***************************************************************************
286  inline size_t capacity( size_t i ) const {
287  return sm_.capacity( i );
288  }
289  //**********************************************************************************************
290 
291  //**NonZeros function***************************************************************************
296  inline size_t nonZeros() const {
297  return sm_.nonZeros();
298  }
299  //**********************************************************************************************
300 
301  //**NonZeros function***************************************************************************
307  inline size_t nonZeros( size_t i ) const {
308  return sm_.nonZeros( i );
309  }
310  //**********************************************************************************************
311 
312  //**Reset function******************************************************************************
317  inline void reset() {
318  return sm_.reset();
319  }
320  //**********************************************************************************************
321 
322  //**Insert function*****************************************************************************
335  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
336  return sm_.insert( j, i, value );
337  }
338  //**********************************************************************************************
339 
340  //**Reserve function****************************************************************************
350  inline void reserve( size_t nonzeros ) {
351  sm_.reserve( nonzeros );
352  }
353  //**********************************************************************************************
354 
355  //**Reserve function****************************************************************************
369  inline void reserve( size_t i, size_t nonzeros ) {
370  sm_.reserve( i, nonzeros );
371  }
372  //**********************************************************************************************
373 
374  //**Append function*****************************************************************************
401  inline void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
402  sm_.append( j, i, value, check );
403  }
404  //**********************************************************************************************
405 
406  //**Finalize function***************************************************************************
419  inline void finalize( size_t i ) {
420  sm_.finalize( i );
421  }
422  //**********************************************************************************************
423 
424  //**********************************************************************************************
430  template< typename Other > // Data type of the foreign expression
431  inline bool canAlias( const Other* alias ) const
432  {
433  return sm_.canAlias( alias );
434  }
435  //**********************************************************************************************
436 
437  //**********************************************************************************************
443  template< typename Other > // Data type of the foreign expression
444  inline bool isAliased( const Other* alias ) const
445  {
446  return sm_.isAliased( alias );
447  }
448  //**********************************************************************************************
449 
450  //**CanSMPAssign function***********************************************************************
455  inline bool canSMPAssign() const
456  {
457  return sm_.canSMPAssign();
458  }
459  //**********************************************************************************************
460 
461  //**Transpose assignment of row-major sparse matrices*******************************************
472  template< typename MT2 > // Type of the right-hand side sparse matrix
473  inline void assign( const SparseMatrix<MT2,false>& rhs )
474  {
476 
477  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
478  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
479  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
480 
481  typedef typename MT2::ConstIterator RhsIterator;
482 
483  const size_t m( rows() );
484 
485  for( size_t i=0UL; i<m; ++i ) {
486  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
487  sm_.append( element->index(), i, element->value() );
488  finalize( i );
489  }
490  }
491  //**********************************************************************************************
492 
493  //**Transpose assignment of column-major sparse matrices****************************************
504  template< typename MT2 > // Type of the right-hand side sparse matrix
505  inline void assign( const SparseMatrix<MT2,true>& 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 typename MT2::ConstIterator RhsIterator;
514 
515  const size_t m( rows() );
516  const size_t n( columns() );
517 
518  // Counting the number of elements per row
519  std::vector<size_t> rowLengths( m, 0UL );
520  for( size_t j=0UL; j<n; ++j ) {
521  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
522  ++rowLengths[element->index()];
523  }
524 
525  // Resizing the sparse matrix
526  for( size_t i=0UL; i<m; ++i ) {
527  sm_.reserve( i, rowLengths[i] );
528  }
529 
530  // Appending the elements to the rows of the sparse matrix
531  for( size_t j=0UL; j<n; ++j ) {
532  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
533  sm_.append( j, element->index(), element->value() );
534  }
535  }
536  }
537  //**********************************************************************************************
538 
539  private:
540  //**Member variables****************************************************************************
541  MT& sm_;
542  //**********************************************************************************************
543 
544  //**Compile time checks*************************************************************************
550  //**********************************************************************************************
551 };
552 //*************************************************************************************************
553 
554 
555 
556 
557 //=================================================================================================
558 //
559 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR MATRICES
560 //
561 //=================================================================================================
562 
563 //*************************************************************************************************
571 template< typename MT > // Type of the sparse matrix
572 class SMatTransposer<MT,true> : public SparseMatrix< SMatTransposer<MT,true>, true >
573 {
574  public:
575  //**Type definitions****************************************************************************
576  typedef SMatTransposer<MT,true> This;
577  typedef typename MT::TransposeType ResultType;
578  typedef MT OppositeType;
579  typedef typename MT::ResultType TransposeType;
580  typedef typename MT::ElementType ElementType;
581  typedef typename MT::ReturnType ReturnType;
582  typedef const This& CompositeType;
583  typedef typename MT::Reference Reference;
584  typedef typename MT::ConstReference ConstReference;
585  typedef typename MT::Iterator Iterator;
586  typedef typename MT::ConstIterator ConstIterator;
587  //**********************************************************************************************
588 
589  //**Compilation flags***************************************************************************
591 
594  enum { smpAssignable = MT::smpAssignable };
595  //**********************************************************************************************
596 
597  //**Constructor*********************************************************************************
602  explicit inline SMatTransposer( MT& sm )
603  : sm_( sm ) // The sparse matrix operand
604  {}
605  //**********************************************************************************************
606 
607  //**Access operator*****************************************************************************
614  inline ConstReference operator()( size_t i, size_t j ) const {
615  BLAZE_INTERNAL_ASSERT( i < sm_.columns(), "Invalid row access index" );
616  BLAZE_INTERNAL_ASSERT( j < sm_.row() , "Invalid column access index" );
617  return sm_(j,i);
618  }
619  //**********************************************************************************************
620 
621  //**Begin function******************************************************************************
627  inline Iterator begin( size_t j ) {
628  return sm_.begin(j);
629  }
630  //**********************************************************************************************
631 
632  //**Begin function******************************************************************************
638  inline ConstIterator begin( size_t j ) const {
639  return sm_.cbegin(j);
640  }
641  //**********************************************************************************************
642 
643  //**Cbegin function*****************************************************************************
649  inline ConstIterator cbegin( size_t j ) const {
650  return sm_.cbegin(j);
651  }
652  //**********************************************************************************************
653 
654  //**End function********************************************************************************
660  inline Iterator end( size_t j ) {
661  return sm_.end(j);
662  }
663  //**********************************************************************************************
664 
665  //**End function********************************************************************************
671  inline ConstIterator end( size_t j ) const {
672  return sm_.cend(j);
673  }
674  //**********************************************************************************************
675 
676  //**Cend function*******************************************************************************
682  inline ConstIterator cend( size_t j ) const {
683  return sm_.cend(j);
684  }
685  //**********************************************************************************************
686 
687  //**Multiplication assignment operator**********************************************************
694  template< typename Other > // Data type of the right-hand side scalar
695  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator*=( Other rhs )
696  {
697  (~sm_) *= rhs;
698  return *this;
699  }
700  //**********************************************************************************************
701 
702  //**Division assignment operator****************************************************************
711  template< typename Other > // Data type of the right-hand side scalar
712  inline typename EnableIf< IsNumeric<Other>, SMatTransposer >::Type& operator/=( Other rhs )
713  {
714  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
715 
716  (~sm_) /= rhs;
717  return *this;
718  }
719  //**********************************************************************************************
720 
721  //**Rows function*******************************************************************************
726  inline size_t rows() const {
727  return sm_.columns();
728  }
729  //**********************************************************************************************
730 
731  //**Columns function****************************************************************************
736  inline size_t columns() const {
737  return sm_.rows();
738  }
739  //**********************************************************************************************
740 
741  //**Capacity function***************************************************************************
746  inline size_t capacity() const {
747  return sm_.capacity();
748  }
749  //**********************************************************************************************
750 
751  //**Capacity function***************************************************************************
757  inline size_t capacity( size_t j ) const {
758  return sm_.capacity( j );
759  }
760  //**********************************************************************************************
761 
762  //**NonZeros function***************************************************************************
767  inline size_t nonZeros() const {
768  return sm_.nonZeros();
769  }
770  //**********************************************************************************************
771 
772  //**NonZeros function***************************************************************************
778  inline size_t nonZeros( size_t j ) const {
779  return sm_.nonZeros( j );
780  }
781  //**********************************************************************************************
782 
783  //**Reset function******************************************************************************
788  inline void reset() {
789  return sm_.reset();
790  }
791  //**********************************************************************************************
792 
793  //**Insert function*****************************************************************************
806  inline Iterator insert( size_t i, size_t j, const ElementType& value ) {
807  return sm_.insert( j, i, value );
808  }
809  //**********************************************************************************************
810 
811  //**Reserve function****************************************************************************
821  inline void reserve( size_t nonzeros ) {
822  sm_.reserve( nonzeros );
823  }
824  //**********************************************************************************************
825 
826  //**Reserve function****************************************************************************
837  inline void reserve( size_t i, size_t nonzeros ) {
838  sm_.reserve( i, nonzeros );
839  }
840  //**********************************************************************************************
841 
842  //**Append function*****************************************************************************
869  void append( size_t i, size_t j, const ElementType& value, bool check=false ) {
870  sm_.append( j, i, value, check );
871  }
872  //**********************************************************************************************
873 
874  //**Finalize function***************************************************************************
887  inline void finalize( size_t j ) {
888  sm_.finalize( j );
889  }
890  //**********************************************************************************************
891 
892  //**********************************************************************************************
898  template< typename Other > // Data type of the foreign expression
899  inline bool canAlias( const Other* alias ) const
900  {
901  return sm_.canAlias( alias );
902  }
903  //**********************************************************************************************
904 
905  //**********************************************************************************************
911  template< typename Other > // Data type of the foreign expression
912  inline bool isAliased( const Other* alias ) const
913  {
914  return sm_.isAliased( alias );
915  }
916  //**********************************************************************************************
917 
918  //**CanSMPAssign function***********************************************************************
923  inline bool canSMPAssign() const
924  {
925  return sm_.canSMPAssign();
926  }
927  //**********************************************************************************************
928 
929  //**Transpose assignment of row-major sparse matrices*******************************************
940  template< typename MT2 > // Type of the right-hand side sparse matrix
941  inline void assign( const SparseMatrix<MT2,false>& rhs )
942  {
944 
945  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
946  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
947  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
948 
949  typedef typename MT2::ConstIterator RhsIterator;
950 
951  const size_t m( rows() );
952  const size_t n( columns() );
953 
954  // Counting the number of elements per row
955  std::vector<size_t> columnLengths( n, 0UL );
956  for( size_t i=0UL; i<m; ++i ) {
957  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
958  ++columnLengths[element->index()];
959  }
960 
961  // Resizing the sparse matrix
962  for( size_t j=0UL; j<n; ++j ) {
963  sm_.reserve( j, columnLengths[j] );
964  }
965 
966  // Appending the elements to the columns of the sparse matrix
967  for( size_t i=0UL; i<m; ++i ) {
968  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
969  sm_.append( element->index(), i, element->value() );
970  }
971  }
972  }
973  //**********************************************************************************************
974 
975  //**Transpose assignment of column-major sparse matrices****************************************
986  template< typename MT2 > // Type of the right-hand side sparse matrix
987  inline void assign( const SparseMatrix<MT2,true>& rhs )
988  {
990 
991  BLAZE_INTERNAL_ASSERT( sm_.columns() == (~rhs).rows() , "Invalid number of rows" );
992  BLAZE_INTERNAL_ASSERT( sm_.rows() == (~rhs).columns() , "Invalid number of columns" );
993  BLAZE_INTERNAL_ASSERT( sm_.capacity() >= (~rhs).nonZeros(), "Capacity not sufficient" );
994 
995  typedef typename MT2::ConstIterator RhsIterator;
996 
997  const size_t n( columns() );
998 
999  for( size_t j=0UL; j<n; ++j ) {
1000  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
1001  sm_.append( j, element->index(), element->value() );
1002  finalize( j );
1003  }
1004  }
1005  //**********************************************************************************************
1006 
1007  private:
1008  //**Member variables****************************************************************************
1009  MT& sm_;
1010  //**********************************************************************************************
1011 
1012  //**Compile time checks*************************************************************************
1018  //**********************************************************************************************
1019 };
1021 //*************************************************************************************************
1022 
1023 
1024 
1025 
1026 //=================================================================================================
1027 //
1028 // GLOBAL OPERATORS
1029 //
1030 //=================================================================================================
1031 
1032 //*************************************************************************************************
1040 template< typename MT // Type of the sparse matrix
1041  , bool SO > // Storage order
1042 inline void reset( SMatTransposer<MT,SO>& m )
1043 {
1044  m.reset();
1045 }
1047 //*************************************************************************************************
1048 
1049 
1050 
1051 
1052 //=================================================================================================
1053 //
1054 // SUBMATRIXTRAIT SPECIALIZATIONS
1055 //
1056 //=================================================================================================
1057 
1058 //*************************************************************************************************
1060 template< typename MT, bool SO >
1061 struct SubmatrixTrait< SMatTransposer<MT,SO> >
1062 {
1063  typedef typename SubmatrixTrait< typename SMatTransposer<MT,SO>::ResultType >::Type Type;
1064 };
1066 //*************************************************************************************************
1067 
1068 } // namespace blaze
1069 
1070 #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:113
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:241
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatTransposer.h:255
#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:82
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
EnableIf< IsNumeric< Other >, SMatTransposer >::Type & operator*=(Other rhs)
Multiplication assignment operator for the multiplication between a matrix and a scalar value ( )...
Definition: SMatTransposer.h:224
MT::ElementType ElementType
Resulting element type.
Definition: SMatTransposer.h:79
MT & sm_
The sparse matrix operand.
Definition: SMatTransposer.h:541
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
Header file for the SparseMatrix base class.
bool canSMPAssign() const
Returns whether the matrix can be used in SMP assignments.
Definition: SMatTransposer.h:455
void reserve(size_t i, size_t nonzeros)
Setting the minimum capacity of a specific row/column of the sparse matrix.
Definition: SMatTransposer.h:369
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SMatTransposer.h:80
size_t capacity(size_t i) const
Returns the current capacity of the specified row/column.
Definition: SMatTransposer.h:286
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:444
MT OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatTransposer.h:77
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: StorageOrder.h:161
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:131
void reset()
Resets the matrix elements.
Definition: SMatTransposer.h:317
MT::ConstReference ConstReference
Reference to a constant matrix value.
Definition: SMatTransposer.h:83
MT::TransposeType ResultType
Result type for expression template evaluations.
Definition: SMatTransposer.h:76
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2504
Constraints on the storage order of matrix types.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:147
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:195
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SMatTransposer.h:85
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
Header file for the EnableIf class template.
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse matrix.
Definition: SMatTransposer.h:350
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: SMatTransposer.h:431
size_t nonZeros() const
Returns the number of non-zero elements in the matrix.
Definition: SMatTransposer.h:296
void assign(const SparseMatrix< MT2, true > &rhs)
Implementation of the transpose assignment of a column-major sparse matrix.
Definition: SMatTransposer.h:505
Header file for the IsNumeric type trait.
MT::Iterator Iterator
Iterator over non-constant elements.
Definition: SMatTransposer.h:84
void assign(const SparseMatrix< MT2, false > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: SMatTransposer.h:473
Expression object for the transposition of a sparse matrix.The SMatTransposer class is a wrapper obje...
Definition: Forward.h:103
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:211
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatTransposer.h:163
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatTransposer.h:265
Header file for run time assertion macros.
Header file for the submatrix trait.
SMatTransposer(MT &sm)
Constructor for the SMatTransposer class.
Definition: SMatTransposer.h:101
SMatTransposer< MT, SO > This
Type of this SMatTransposer instance.
Definition: SMatTransposer.h:75
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row/column.
Definition: SMatTransposer.h:307
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:401
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatTransposer.h:179
size_t capacity() const
Returns the maximum capacity of the matrix.
Definition: SMatTransposer.h:275
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Iterator insert(size_t i, size_t j, const ElementType &value)
Inserting an element into the sparse matrix.
Definition: SMatTransposer.h:335
void finalize(size_t i)
Finalizing the element insertion of a row/column.
Definition: SMatTransposer.h:419
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
MT::ResultType TransposeType
Transpose type for expression template evaluations.
Definition: SMatTransposer.h:78
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
const This & CompositeType
Data type for composite expression templates.
Definition: SMatTransposer.h:81
#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