ARTS
1.0.222
|
#include <matpackII.h>
Public Member Functions | |
Sparse () | |
Default constructor. More... | |
Sparse (Index r, Index c) | |
Constructor setting size. More... | |
Sparse (const Sparse &m) | |
Copy constructor from another Sparse. More... | |
~Sparse () | |
Destructor for Sparse. More... | |
![]() | |
Index | nrows () const |
Returns the number of rows. More... | |
Index | ncols () const |
Returns the number of columns. More... | |
Index | nnz () const |
Returns the number of nonzero elements. More... | |
Numeric & | rw (Index r, Index c) |
Plain index operator. More... | |
Numeric | ro (Index r, Index c) const |
Plain const index operator. More... | |
Additional Inherited Members | |
![]() | |
SparseView () | |
Default constructor. More... | |
SparseView (std::vector< Numeric > *data, std::vector< Index > *rowind, std::vector< Index > *colptr, const Range &rr, const Range &cr) | |
Explicit constructor. More... | |
![]() | |
std::vector< Numeric > * | mdata |
The actual data values. More... | |
std::vector< Index > * | mrowind |
Row indices. More... | |
std::vector< Index > * | mcolptr |
Pointers to first data element for each column. More... | |
Index | mnr |
Number of rows. More... | |
The Sparse class.
This is a SparseView that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from SparseView. Just the constructors and the destructor have to be defined separately here, since these are not inherited.
Definition at line 80 of file matpackII.h.
|
inline |
Default constructor.
Definition at line 242 of file matpackII.h.
Constructor setting size.
Elements *mdata and *mrowind have to grow later on, when we add data element. But *mcolptr always has the dimenson of the number of columns of the matrix plus one, so it is allocated directly.
Why is there an extra element in mcolptr? We store also the index behind the last element of the last column. Or in other words the starting index that the next column would have. This just safes a litle time when computing indices. Also, this corresponds to the number of nonzero elements.
Definition at line 260 of file matpackII.h.
|
inline |
Copy constructor from another Sparse.
This automatically sets the size and copies the data.
Definition at line 272 of file matpackII.h.
|
inline |
Destructor for Sparse.
This is important, since Sparse uses new to allocate storage.
Definition at line 285 of file matpackII.h.