Data members

The class only includes three members to store the matrix:

uint64_t danceq::internal::SparseMatrix::dim

Dimension of the matrix.

std::vector<uint64_t> danceq::internal::SparseMatrix::range

Specifies the range to access data.

The range vector is of size dim+1 and defines the range of elements in data for each row:

uint64_t row = 42;
for(uint64_t i = range[row]; i < range[row+1UL]; i++){
    std::cout << "Row " << row << " has an entry in column " << data[i].first << " with value " << data[i].second << std::endl;
}

std::vector<std::pair<uint64_t, ScalarType>> danceq::internal::SparseMatrix::data

Stores the columns and respective values of the matrix.

The values assigned to a certain row can be accessed using range:

uint64_t row = 42;
for(uint64_t i = range[row]; i < range[row+1UL]; i++){
    std::cout << "Row " << row << " has an entry in column " << data[i].first << " with value " << data[i].second << std::endl;
}