Represents the configuration of a sparse matrix but not the data. More...
#include <vnl_crs_index.h>
Public Types | |
| typedef std::pair< int, int > | idx_pair |
| typedef std::vector< idx_pair > | sparse_vector |
Public Member Functions | |
| vnl_crs_index () | |
| Constructor - default. More... | |
| vnl_crs_index (const std::vector< std::vector< bool > > &mask) | |
| Constructor - from a binary mask. More... | |
| ~vnl_crs_index ()=default | |
| Destructor. More... | |
| int | num_rows () const |
| number of rows in the sparse matrix. More... | |
| int | num_cols () const |
| number of columns in the sparse matrix. More... | |
| int | num_non_zero () const |
| number of non-zero elements. More... | |
| sparse_vector | sparse_row (int i) const |
returns row i as a vector of index-column pairs. More... | |
| sparse_vector | sparse_col (int j) const |
returns column j as a vector of index-row pairs. More... | |
| int | operator() (int i, int j) const |
| return the index at location (i,j). More... | |
Private Attributes | |
| unsigned int | num_cols_ |
| The number of columns in the matrix. More... | |
| std::vector< int > | col_idx_ |
| The column for each non-zero element. More... | |
| std::vector< int > | row_ptr_ |
| The index of the first non-zero element in each row. More... | |
Represents the configuration of a sparse matrix but not the data.
This is essentially a sparse matrix of indices into a data vector Compressed row storage is used for representation This class is useful when working with several sparse matrices that share a common sparse structure.
Definition at line 26 of file vnl_crs_index.h.
| typedef std::pair<int,int> vnl_crs_index::idx_pair |
Definition at line 29 of file vnl_crs_index.h.
| typedef std::vector<idx_pair> vnl_crs_index::sparse_vector |
Definition at line 30 of file vnl_crs_index.h.
|
inline |
Constructor - default.
Definition at line 33 of file vnl_crs_index.h.
| vnl_crs_index::vnl_crs_index | ( | const std::vector< std::vector< bool > > & | mask | ) |
Constructor - from a binary mask.
Definition at line 10 of file vnl_crs_index.cxx.
|
default |
Destructor.
|
inline |
number of columns in the sparse matrix.
Definition at line 45 of file vnl_crs_index.h.
|
inline |
number of non-zero elements.
Definition at line 48 of file vnl_crs_index.h.
|
inline |
number of rows in the sparse matrix.
Definition at line 42 of file vnl_crs_index.h.
| int vnl_crs_index::operator() | ( | int | i, |
| int | j | ||
| ) | const |
return the index at location (i,j).
returns -1 if the entry is 0
Definition at line 31 of file vnl_crs_index.cxx.
| vnl_crs_index::sparse_vector vnl_crs_index::sparse_col | ( | int | j | ) | const |
returns column j as a vector of index-row pairs.
Definition at line 69 of file vnl_crs_index.cxx.
| vnl_crs_index::sparse_vector vnl_crs_index::sparse_row | ( | int | i | ) | const |
returns row i as a vector of index-column pairs.
Definition at line 56 of file vnl_crs_index.cxx.
|
private |
The column for each non-zero element.
Definition at line 65 of file vnl_crs_index.h.
|
private |
The number of columns in the matrix.
Definition at line 63 of file vnl_crs_index.h.
|
private |
The index of the first non-zero element in each row.
Definition at line 67 of file vnl_crs_index.h.
1.8.15