#include <matpackII.h>
Public Member Functions | |
Index | nrows () const |
Returns the number of rows. | |
Index | ncols () const |
Returns the number of columns. | |
Index | nnz () const |
Returns the number of nonzero elements. | |
Numeric & | rw (Index r, Index c) |
Plain index operator. | |
Numeric | ro (Index r, Index c) const |
Plain const index operator. | |
Protected Member Functions | |
SparseView () | |
Default constructor. | |
SparseView (std::vector< Numeric > *data, std::vector< Index > *rowind, std::vector< Index > *colptr, const Range &rr, const Range &cr) | |
Explicit constructor. | |
Protected Attributes | |
std::vector< Numeric > * | mdata |
The actual data values. | |
std::vector< Index > * | mrowind |
Row indices. | |
std::vector< Index > * | mcolptr |
Pointers to first data element for each column. | |
Index | mnr |
Number of rows. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const SparseView &v) |
Class Sparse is derived from this one. It also allocates storage.
The chosen storage format is the `compressed column' format. This is the same format used by Matlab. See Matlab User Guide for a description.
Definition at line 41 of file matpackII.h.
SparseView::SparseView | ( | ) | [inline, protected] |
Default constructor.
This is necessary, so that we can have a default constructor for the derived class Sparse.
Definition at line 209 of file matpackII.h.
SparseView::SparseView | ( | std::vector< Numeric > * | data, | |
std::vector< Index > * | rowind, | |||
std::vector< Index > * | colptr, | |||
const Range & | rr, | |||
const Range & | cr | |||
) | [inline, protected] |
Explicit constructor.
This one is used by Matrix to initialize its own SubMatrix part. The row range rr must have a stride to account for the length of one row.
Definition at line 222 of file matpackII.h.
Index SparseView::nrows | ( | ) | const [inline] |
Index SparseView::ncols | ( | ) | const [inline] |
Index SparseView::nnz | ( | ) | const [inline] |
Plain index operator.
This has to correctly handle two cases:
1. The data element exists. In this case the operator acts similar to the const index operator in that the element is returned.
2. The element does not exist. In this case it is created.
Definition at line 120 of file matpackII.h.
std::ostream& operator<< | ( | std::ostream & | os, | |
const SparseView & | v | |||
) | [friend] |
Definition at line 294 of file matpackII.h.
std::vector<Numeric>* SparseView::mdata [protected] |
std::vector<Index>* SparseView::mrowind [protected] |
std::vector<Index>* SparseView::mcolptr [protected] |
Index SparseView::mnr [protected] |