FleCSI Core API Version: 2.4.2
Loading...
Searching...
No Matches
crs Struct Reference

Efficient (compressed-row) storage for a sequence of sequences of integers. More...

Public Member Functions

template<class InputIt>
void add_row (InputIt first, InputIt last)
 Append onto the crs (via data copy) a row of values pointed to by a beginning and an ending iterator.
template<typename Range>
void add_row (Range const &it)
 Append onto the crs (via data copy) a row of values acquired by traversing a range.
template<class U>
void add_row (std::initializer_list< U > init)
 Append onto the crs (via data copy) a row of values.
void clear ()
 Discard all data (offsets and values).
 crs ()=default
 Create an empty sequence of sequences.
size_type size () const
 Return the number of rows.
util::span< const value_type > operator[] (size_type i) const
 Return a row.
util::span< value_type > operator[] (size_type i)
 Return a row.

Public Attributes

util::offsets offsets
 The rows in values.
std::vector< value_type > values
 The concatenated rows.

Detailed Description

Efficient (compressed-row) storage for a sequence of sequences of integers.

There are no constraints on the size or contents of either the sequences or sequences of sequences: sequences can be different sizes, can have overlapping values, can include values in any order, and can hold duplicate values.

This type is a random-access range of span objects. Because the offsets and values fields must be kept in sync they are best treated as read-only. Use the add_row methods to modify those fields in a consistent manner.

Constructor & Destructor Documentation

◆ crs()

crs ( )
default

Create an empty sequence of sequences.

Member Function Documentation

◆ add_row() [1/3]

template<class InputIt>
void add_row ( InputIt first,
InputIt last )

Append onto the crs (via data copy) a row of values pointed to by a beginning and an ending iterator.

◆ add_row() [2/3]

template<class U>
void add_row ( std::initializer_list< U > init)

Append onto the crs (via data copy) a row of values.

◆ add_row() [3/3]

template<typename Range>
void add_row ( Range const & it)

Append onto the crs (via data copy) a row of values acquired by traversing a range.

◆ size()

size_type size ( ) const

Return the number of rows.

◆ clear()

void clear ( )

Discard all data (offsets and values).

◆ operator[]() [1/2]

util::span< const value_type > operator[] ( size_type i) const

Return a row.

Returns
substring of values

◆ operator[]() [2/2]

util::span< value_type > operator[] ( size_type i)

Return a row.

Returns
substring of values

Member Data Documentation

◆ offsets

util::offsets offsets

The rows in values.

◆ values

std::vector<value_type> values

The concatenated rows.