Template Class CSR

Inheritance Relationships

Base Type

Class Documentation

template<typename IDType, typename NNZType, typename ValueType>
class sparsebase::format::CSR : public sparsebase::utils::IdentifiableImplementation<CSR<IDType, NNZType, ValueType>, FormatOrderTwo<IDType, NNZType, ValueType>>

Compressed Sparse Row Sparse Data Format.

Compressed Sparse Row format keeps 3 arrays row_ptr, col, vals. The i-th element in the row_ptr array denotes the index the i-th row starts in the col array. The col, vals arrays are identical to the COO format.

Buluç, Aydın; Fineman, Jeremy T.; Frigo, Matteo; Gilbert, John R.; Leiserson, Charles E. (2009). Parallel sparse matrix-vector and matrix-transpose-vector multiplication using compressed sparse blocks. ACM Symp. on Parallelism in Algorithms and Architectures. CiteSeerX 10.1.1.211.5256.

tparam IDType

type used for the dimensions

tparam NNZType

type used for non-zeros and the number of non-zeros

tparam ValueType

type used for the stored values

Public Functions

CSR(IDType n, IDType m, NNZType *row_ptr, IDType *col, ValueType *vals, Ownership own = kNotOwned, bool ignore_sort = false)
CSR(const CSR<IDType, NNZType, ValueType>&)
CSR(CSR<IDType, NNZType, ValueType>&&)
CSR<IDType, NNZType, ValueType> &operator=(const CSR<IDType, NNZType, ValueType>&)
Format *Clone() const override
virtual ~CSR()
NNZType *get_row_ptr() const
IDType *get_col() const
ValueType *get_vals() const
NNZType *release_row_ptr()
IDType *release_col()
ValueType *release_vals()
void set_row_ptr(NNZType*, Ownership own = kNotOwned)
void set_col(IDType*, Ownership own = kNotOwned)
void set_vals(ValueType*, Ownership own = kNotOwned)
virtual bool ColIsOwned()
virtual bool RowPtrIsOwned()
virtual bool ValsIsOwned()

Protected Attributes

std::unique_ptr<NNZType, std::function<void(NNZType*)>> row_ptr_
std::unique_ptr<IDType, std::function<void(IDType*)>> col_
std::unique_ptr<ValueType, std::function<void(ValueType*)>> vals_