Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
painless::vector2D< T > Class Template Reference

A 2D vector implementation optimized for sparse data. More...

#include <vector2D.hpp>

Collaboration diagram for painless::vector2D< T >:

Public Member Functions

skipzero_span< T > operator[] (row_id_t id)
 Accesses a row in the 2D vector.
 
skipzero_span< const T > operator[] (row_id_t id) const
 Accesses a row in the 2D vector (const version).
 
T * begin (row_id_t id)
 Gets the beginning iterator for a specific row.
 
T * end (row_id_t id)
 Gets the end iterator for a specific row.
 
const T * begin (row_id_t id) const
 Gets the beginning const iterator for a specific row.
 
const T * end (row_id_t id) const
 Gets the end const iterator for a specific row.
 
row_size_t getRowSize (row_id_t id) const
 Gets the size of a specific row.
 
row_size_t getRowsCount () const
 Gets the number of rows in the 2D vector.
 
void push_row (const std::vector< int > &row)
 Adds a new row to the 2D vector.
 
void emplace_row (std::initializer_list< int > row)
 Adds a new row to the 2D vector using an initializer list.
 
void delete_row (row_id_t id)
 Marks a row as deleted.
 
bool delete_element (row_id_t rowId, row_size_t offset)
 Deletes an element in a specific row.
 
void cleanup ()
 Cleans up the 2D vector by removing deleted rows and compacting data.
 

Detailed Description

template<typename T>
class painless::vector2D< T >

A 2D vector implementation optimized for sparse data.

Template Parameters
TThe type of elements in the vector (must be arithmetic).

Member Function Documentation

◆ begin() [1/2]

template<typename T >
T * painless::vector2D< T >::begin ( row_id_t id)
inline

Gets the beginning iterator for a specific row.

Parameters
idThe row ID.
Returns
Pointer to the first element of the row.

◆ begin() [2/2]

template<typename T >
const T * painless::vector2D< T >::begin ( row_id_t id) const
inline

Gets the beginning const iterator for a specific row.

Parameters
idThe row ID.
Returns
Const pointer to the first element of the row.

◆ delete_element()

template<typename T >
bool painless::vector2D< T >::delete_element ( row_id_t rowId,
row_size_t offset )

Deletes an element in a specific row.

Parameters
rowIdThe ID of the row.
offsetThe offset of the element in the row.
Returns
False if the entire row is deleted after this operation, true otherwise.

◆ delete_row()

template<typename T >
void painless::vector2D< T >::delete_row ( row_id_t id)
inline

Marks a row as deleted.

Parameters
idThe ID of the row to be deleted.

◆ emplace_row()

template<typename T >
void painless::vector2D< T >::emplace_row ( std::initializer_list< int > row)

Adds a new row to the 2D vector using an initializer list.

Parameters
rowThe row to be added as an initializer list.

◆ end() [1/2]

template<typename T >
T * painless::vector2D< T >::end ( row_id_t id)
inline

Gets the end iterator for a specific row.

Parameters
idThe row ID.
Returns
Pointer to one past the last element of the row.

◆ end() [2/2]

template<typename T >
const T * painless::vector2D< T >::end ( row_id_t id) const
inline

Gets the end const iterator for a specific row.

Parameters
idThe row ID.
Returns
Const pointer to one past the last element of the row.

◆ getRowsCount()

template<typename T >
row_size_t painless::vector2D< T >::getRowsCount ( ) const
inline

Gets the number of rows in the 2D vector.

Returns
The number of rows.

◆ getRowSize()

template<typename T >
row_size_t painless::vector2D< T >::getRowSize ( row_id_t id) const
inline

Gets the size of a specific row.

Parameters
idThe row ID.
Returns
The number of non-zero elements in the row.

◆ operator[]() [1/2]

template<typename T >
skipzero_span< T > painless::vector2D< T >::operator[] ( row_id_t id)
inline

Accesses a row in the 2D vector.

Parameters
idThe row ID.
Returns
A skipzero_span of the row.

◆ operator[]() [2/2]

template<typename T >
skipzero_span< const T > painless::vector2D< T >::operator[] ( row_id_t id) const
inline

Accesses a row in the 2D vector (const version).

Parameters
idThe row ID.
Returns
A const skipzero_span of the row.

◆ push_row()

template<typename T >
void painless::vector2D< T >::push_row ( const std::vector< int > & row)

Adds a new row to the 2D vector.

Parameters
rowThe row to be added.

The documentation for this class was generated from the following file: