Represents the configuration of a sparse matrix but not the data. More...
#include <vnl_crs_index.h>
Public Types | |
typedef vcl_pair< int, int > | idx_pair |
typedef vcl_vector< idx_pair > | sparse_vector |
Public Member Functions | |
vnl_crs_index () | |
Constructor - default. | |
vnl_crs_index (const vcl_vector< vcl_vector< bool > > &mask) | |
Constructor - from a binary mask. | |
~vnl_crs_index () | |
Destructor. | |
int | num_rows () const |
number of rows in the sparse matrix. | |
int | num_cols () const |
number of columns in the sparse matrix. | |
int | num_non_zero () const |
number of non-zero elements. | |
sparse_vector | sparse_row (int i) const |
returns row i as a vector of index-column pairs. | |
sparse_vector | sparse_col (int j) const |
returns column j as a vector of index-row pairs. | |
int | operator() (int i, int j) const |
return the index at location (i,j). | |
Private Attributes | |
unsigned int | num_cols_ |
The number of columns in the matrix. | |
vcl_vector< int > | col_idx_ |
The column for each non-zero element. | |
vcl_vector< int > | row_ptr_ |
The index of the first non-zero element in each row. |
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 vcl_pair<int,int> vnl_crs_index::idx_pair |
Definition at line 29 of file vnl_crs_index.h.
typedef vcl_vector<idx_pair> vnl_crs_index::sparse_vector |
Definition at line 30 of file vnl_crs_index.h.
vnl_crs_index::vnl_crs_index | ( | ) | [inline] |
Constructor - default.
Definition at line 33 of file vnl_crs_index.h.
vnl_crs_index::vnl_crs_index | ( | const vcl_vector< vcl_vector< bool > > & | mask | ) |
Constructor - from a binary mask.
Definition at line 13 of file vnl_crs_index.cxx.
vnl_crs_index::~vnl_crs_index | ( | ) | [inline] |
Destructor.
Definition at line 39 of file vnl_crs_index.h.
int vnl_crs_index::num_cols | ( | ) | const [inline] |
number of columns in the sparse matrix.
Definition at line 45 of file vnl_crs_index.h.
int vnl_crs_index::num_non_zero | ( | ) | const [inline] |
number of non-zero elements.
Definition at line 48 of file vnl_crs_index.h.
int vnl_crs_index::num_rows | ( | ) | const [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 34 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 72 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 59 of file vnl_crs_index.cxx.
vcl_vector<int> vnl_crs_index::col_idx_ [private] |
The column for each non-zero element.
Definition at line 65 of file vnl_crs_index.h.
unsigned int vnl_crs_index::num_cols_ [private] |
The number of columns in the matrix.
Definition at line 63 of file vnl_crs_index.h.
vcl_vector<int> vnl_crs_index::row_ptr_ [private] |
The index of the first non-zero element in each row.
Definition at line 67 of file vnl_crs_index.h.