2 #ifndef _LIL_SPARSE_MATRIX_H_ 3 #define _LIL_SPARSE_MATRIX_H_ 14 template<
class el_type>
20 typedef vector<int> idx_vector_type;
21 typedef vector<el_type> elt_vector_type;
36 vector<elt_vector_type>
m_x;
68 virtual el_type
coeff(
const int& i,
const int& j,
int offset = 0)
const = 0;
72 virtual std::string
to_string()
const = 0;
80 #endif // _LIL_SPARSE_MATRIX_H_ int nnz_count
Number of nonzeros in the matrix.
Definition: lil_sparse_matrix.h:32
vector< elt_vector_type > m_x
The values of the nonzeros in the matrix.
Definition: lil_sparse_matrix.h:36
virtual std::string to_string() const =0
vector< idx_vector_type > m_idx
The row/col indices. The way m_idx is used depends on whether the matrix is in LIL-C or LIL-R...
Definition: lil_sparse_matrix.h:35
int m_n_cols
Number of cols in the matrix.
Definition: lil_sparse_matrix.h:31
el_type eps
Machine epsilon for el_type.
Definition: lil_sparse_matrix.h:33
int n_rows() const
Definition: lil_sparse_matrix.h:46
friend std::ostream & operator<<(std::ostream &os, const lil_sparse_matrix &A)
Allows outputting the contents of the matrix via << operators.
Definition: lil_sparse_matrix.h:24
lil_sparse_matrix(int n_rows, int n_cols)
Default constructor for an abstract matrix. This constructor will be extended by base classes dependi...
Definition: lil_sparse_matrix.h:39
int m_n_rows
Number of rows in the matrix.
Definition: lil_sparse_matrix.h:28
virtual el_type coeff(const int &i, const int &j, int offset=0) const =0
Returns A_ij (zero-indexed). This function should be extended by subclasses as it is dependent on the...
virtual ~lil_sparse_matrix()
Definition: lil_sparse_matrix.h:75
The abstract parent of all sparse matrices.
Definition: lil_sparse_matrix.h:15
int nnz() const
Definition: lil_sparse_matrix.h:58
int n_cols() const
Definition: lil_sparse_matrix.h:52