Iterators
-
std::pair<typename std::vector<std::pair<uint64_t, ScalarType>>::const_iterator, typename std::vector<std::pair<uint64_t, ScalarType>>::const_iterator> danceq::internal::SparseMatrix::get_data_iter_of_row(const uint64_t row) const
Returns const iterators marking the range of the given row.
The
const_iterator
mark the range of given row:uint64_t row = 42; const auto iter_pair = matrix.get_data_iter_of_row(row); for(auto iter = iter_pair.first; iter != iter_pair.second; iter++){ std::cout << "Row " << row << " has an entry in column " << iter->first << " with value " << iter->second << std::endl; }
- Parameters:
row – Row of interest
- Returns:
Pair of
const_iterator
-
std::vector<uint64_t>::const_iterator danceq::internal::SparseMatrix::get_range_iter(const uint64_t row = 0UL) const
Returns
const_iterator
for range.The
const_iterator
points to the start in range of the given row.uint64_t row = 42; const auto iter = matrix.get_range_iter(row); uint64_t number_of_columns = *iter - *(iter+1); std::cout << "Row " << row << " has " << number_of_columns << " columns" << std::endl;
- Parameters:
row – Row of interest
- Returns:
const_iterator
of range
-
std::vector<std::pair<uint64_t, ScalarType>>::const_iterator danceq::internal::SparseMatrix::get_data_iter(const uint64_t offset = 0UL) const
Returns
const_iterator
for data.The
const_iterator
points to the data with a given offset.uint64_t row = 42; const auto iter_range = matrix.get_range_iter(row); const auto iter_data = matrix.get_data_iter(*iter_range); std::cout << "First element of row " << row << " is at column " << iter_data->first << " with a value " << iter_data->second << std::endl;
- Parameters:
offset – Offset of interest
- Returns:
const_iterator
of data