2 #ifndef vnl_crs_index_h_ 3 #define vnl_crs_index_h_ 17 # include <vcl_msvc_warnings.h> 19 #include "vnl/vnl_export.h" 42 int num_rows()
const {
return int(row_ptr_.size())-1; }
51 sparse_vector sparse_row(
int i)
const;
55 sparse_vector sparse_col(
int j)
const;
59 int operator() (
int i,
int j)
const;
70 #endif // vnl_crs_index_h_ unsigned int num_cols_
The number of columns in the matrix.
int num_rows() const
number of rows in the sparse matrix.
vnl_crs_index()
Constructor - default.
std::pair< int, int > idx_pair
Represents the configuration of a sparse matrix but not the data.
int num_cols() const
number of columns in the sparse matrix.
std::vector< idx_pair > sparse_vector
std::vector< int > row_ptr_
The index of the first non-zero element in each row.
int num_non_zero() const
number of non-zero elements.
std::vector< int > col_idx_
The column for each non-zero element.