SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
|
A generic vector class for integers of width . More...
#include <int_vector.hpp>
Public Types | |
typedef int_vector_trait < fixedIntWidth, size_type_class >::value_type | value_type |
typedef int_vector_trait < fixedIntWidth, size_type_class >::iterator | iterator |
typedef int_vector_trait < fixedIntWidth, size_type_class > ::const_iterator | const_iterator |
typedef int_vector_trait < fixedIntWidth, size_type_class >::reference | reference |
typedef int_vector_trait < fixedIntWidth, size_type_class > ::const_reference | const_reference |
typedef int_vector_reference < int_vector > * | pointer |
typedef const value_type * | const_pointer |
typedef ptrdiff_t | difference_type |
typedef size_type_class | size_type |
typedef int_vector_trait < fixedIntWidth, size_type_class > ::int_width_type | int_width_type |
typedef rank_support_v< 1, 1 > | rank_1_type |
typedef rank_support_v< 0, 1 > | rank_0_type |
typedef select_support_mcl< 1, 1 > | select_1_type |
typedef select_support_mcl< 0, 1 > | select_0_type |
Public Member Functions | |
int_vector (size_type elements=0, value_type default_value=0, uint8_t intWidth=fixedIntWidth) | |
Constructor for int_vector. | |
int_vector (const int_vector &v) | |
Copy constructor for int_vector. | |
~int_vector () | |
Destructor for int_vector. | |
bool | empty () const |
Equivalent to size() == 0. | |
void | swap (int_vector &v) |
Swap method for int_vector. | |
void | resize (const size_type size) |
Resize the int_vector in terms of elements. | |
void | bit_resize (const size_type size) |
Resize the int_vector in terms of bits. | |
size_type | size () const |
The number of elements in the int_vector. | |
size_type | bit_size () const |
The number of bits in the int_vector. | |
size_type | capacity () const |
Returns the size of the occupied bits of the int_vector. | |
const uint64_t * | data () const |
Pointer to the raw data of the int_vector. | |
const value_type | get_int (size_type idx, const uint8_t len=64) const |
Get the integer value of the binary string of length len starting at position idx in the int_vector. | |
void | set_int (size_type idx, value_type x, const uint8_t len=64) |
Set the bits from position idx to idx+len-1 to the binary representation of integer x. | |
const uint8_t | get_int_width () const |
Returns the width of the integers which are accessed via the [] operator. | |
void | set_int_width (uint8_t intWidth) |
Sets the width of the integers which are accessed via the [] operator, if fixedIntWidth equals 0. | |
size_type | serialize (std::ostream &out, structure_tree_node *v=NULL, std::string name="", bool write_fixed_as_variable=false) const |
Serializes the int_vector to a stream. | |
void | load (std::istream &in) |
Load the int_vector for a stream. | |
reference | operator[] (const size_type &i) |
non const version of [] operator | |
const_reference | operator[] (const size_type &i) const |
const version of [] operator | |
int_vector & | operator= (const int_vector &v) |
Assignment operator for the int_vector. | |
bool | operator== (const int_vector< fixedIntWidth > &v) const |
Equality operator for two int_vectors. | |
bool | operator!= (const int_vector &v) const |
Inequality operator for two int_vectors. | |
bool | operator< (const int_vector &v) const |
Less operator for two int_vectors. | |
bool | operator> (const int_vector &v) const |
Greater operator for two int_vectors. | |
bool | operator<= (const int_vector &v) const |
Less or equal operator. | |
bool | operator>= (const int_vector &v) const |
Greater of equal operator. | |
const iterator | begin () |
Iterator that points to the first element of the int_vector. | |
const iterator | end () |
Iterator that points to the element after the last element of int_vector. | |
const const_iterator | begin () const |
Const iterator that points to the first element of the int_vector. | |
const const_iterator | end () const |
Const iterator that points to the element after the last element of int_vector. | |
template<> | |
int_vector< 64 >::reference | operator[] (const size_type &idx) |
template<> | |
int_vector< 32 >::reference | operator[] (const size_type &idx) |
template<> | |
int_vector< 16 >::reference | operator[] (const size_type &idx) |
template<> | |
int_vector< 8 >::reference | operator[] (const size_type &idx) |
template<> | |
int_vector< 0 >::const_reference | operator[] (const size_type &idx) const |
template<> | |
int_vector< 64 >::const_reference | operator[] (const size_type &idx) const |
template<> | |
int_vector< 32 >::const_reference | operator[] (const size_type &idx) const |
template<> | |
int_vector< 16 >::const_reference | operator[] (const size_type &idx) const |
template<> | |
int_vector< 8 >::const_reference | operator[] (const size_type &idx) const |
template<> | |
int_vector< 1 >::const_reference | operator[] (const size_type &idx) const |
Static Public Member Functions | |
static size_type | max_size () |
Maximum size of the int_vector. | |
Friends | |
struct | int_vector_trait< fixedIntWidth, size_type_class > |
class | int_vector_iterator_base< int_vector > |
class | int_vector_iterator< int_vector > |
class | int_vector_const_iterator< int_vector > |
class | coder::elias_delta |
class | coder::fibonacci |
class | coder::ternary |
class | int_vector_file_buffer< fixedIntWidth, size_type_class > |
std::istream & | operator>> (std::istream &, int_vector< 1 > &) |
Operator to create an int_vector<1> (aka bit_vector) from an input stream. | |
void | util::set_random_bits (int_vector &v, int) |
void | util::set_zero_bits (int_vector &v) |
void | util::set_one_bits (int_vector &v) |
void | util::bit_compress (int_vector &v) |
void | util::set_all_values_to_k (int_vector &v, uint64_t k) |
void | algorithm::calculate_sa (const unsigned char *c, typename int_vector< fixedIntWidth >::size_type len, int_vector< fixedIntWidth > &sa) |
A generic vector class for integers of width .
If you set the fixed width parameter to zero
sdsl::int_vector<0> v(10);
you get a vector v of 10 elements which can each hold a 64-bit integer by default. See the int_vector_variable.e.cpp example for the behavior of the vector if you change the int width by calling the set_int_width() method.
sdsl::int_vector< fixedIntWidth, size_type_class >::int_vector | ( | size_type | elements = 0 , |
value_type | default_value = 0 , |
||
uint8_t | intWidth = fixedIntWidth |
||
) | [inline] |
Constructor for int_vector.
elements | The number of elements in the int_vector. Default value is 0. |
default_value | The default value to initialize the elements. |
intWidth | The width of integers which could be accessed via the [] operator. |
sdsl::int_vector< fixedIntWidth, size_type_class >::int_vector | ( | const int_vector< fixedIntWidth, size_type_class > & | v | ) | [inline] |
Copy constructor for int_vector.
v | The int_vector to copy Required for the STL Assignable Concept |
const int_vector< fixedIntWidth, size_type_class >::iterator sdsl::int_vector< fixedIntWidth, size_type_class >::begin | ( | ) | [inline] |
Iterator that points to the first element of the int_vector.
Required for Container Concept of the STL. Complexity guaranty is O(1).
const int_vector< fixedIntWidth, size_type_class >::const_iterator sdsl::int_vector< fixedIntWidth, size_type_class >::begin | ( | ) | const [inline] |
Const iterator that points to the first element of the int_vector.
Required for Container Concept of the STL.
void sdsl::int_vector< fixedIntWidth, size_type_class >::bit_resize | ( | const size_type | size | ) |
Resize the int_vector in terms of bits.
size | The size to resize the int_vector in terms of bits. |
int_vector< fixedIntWidth, size_type_class >::size_type sdsl::int_vector< fixedIntWidth, size_type_class >::bit_size | ( | ) | const |
The number of bits in the int_vector.
int_vector< fixedIntWidth, size_type_class >::size_type sdsl::int_vector< fixedIntWidth, size_type_class >::capacity | ( | ) | const [inline] |
Returns the size of the occupied bits of the int_vector.
The capacity of a int_vector is greater or equal to the bit_size of the vector: capacity() >= bit_size().
const uint64_t* sdsl::int_vector< fixedIntWidth, size_type_class >::data | ( | ) | const [inline] |
Pointer to the raw data of the int_vector.
bool sdsl::int_vector< fixedIntWidth, size_type_class >::empty | ( | ) | const |
const int_vector< fixedIntWidth, size_type_class >::iterator sdsl::int_vector< fixedIntWidth, size_type_class >::end | ( | ) | [inline] |
Iterator that points to the element after the last element of int_vector.
Required for Container Concept of the STL. Complexity guaranty is O(1).
const int_vector< fixedIntWidth, size_type_class >::const_iterator sdsl::int_vector< fixedIntWidth, size_type_class >::end | ( | ) | const [inline] |
Const iterator that points to the element after the last element of int_vector.
Required for Container Concept of the STL.
const int_vector< fixedIntWidth, size_type_class >::value_type sdsl::int_vector< fixedIntWidth, size_type_class >::get_int | ( | size_type | idx, |
const uint8_t | len = 64 |
||
) | const [inline] |
Get the integer value of the binary string of length len starting at position idx in the int_vector.
idx | Starting index of the binary representation of the integer. |
len | Length of the binary representation of the integer. Default value is 64. |
const uint8_t sdsl::int_vector< fixedIntWidth, size_type_class >::get_int_width | ( | ) | const |
Returns the width of the integers which are accessed via the [] operator.
int_vector< fixedIntWidth, size_type_class >::size_type sdsl::int_vector< fixedIntWidth, size_type_class >::max_size | ( | ) | [static] |
Maximum size of the int_vector.
Required for the Container Concept of the STL.
bool sdsl::int_vector< fixedIntWidth, size_type_class >::operator!= | ( | const int_vector< fixedIntWidth, size_type_class > & | v | ) | const |
Inequality operator for two int_vectors.
Two int_vectors are not equal if
capacities and sizes are not equal or
Required for the STL Equality Comparable Concept.
bool sdsl::int_vector< fixedIntWidth, size_type_class >::operator< | ( | const int_vector< fixedIntWidth, size_type_class > & | v | ) | const |
Less operator for two int_vectors.
int_vector w is less than v if
or w[i]==v[i] for all i < min(w.size(), v.size()) and w.size()<v.size().
Required for the STL LessThan Comparable Concept.
bool sdsl::int_vector< fixedIntWidth, size_type_class >::operator<= | ( | const int_vector< fixedIntWidth, size_type_class > & | v | ) | const |
Less or equal operator.
Required for the STL LessThan Comparable Concept.
int_vector< fixedIntWidth, size_type_class > & sdsl::int_vector< fixedIntWidth, size_type_class >::operator= | ( | const int_vector< fixedIntWidth, size_type_class > & | v | ) |
Assignment operator for the int_vector.
v | The vector v which should be assigned |
Required for the Assignable Conecpt of the STL.
bool sdsl::int_vector< fixedIntWidth, size_type_class >::operator== | ( | const int_vector< fixedIntWidth > & | v | ) | const |
Equality operator for two int_vectors.
Two int_vectors are equal if
capacities and sizes are equal and
Required for the STL Equality Comparable Concept.
bool sdsl::int_vector< fixedIntWidth, size_type_class >::operator> | ( | const int_vector< fixedIntWidth, size_type_class > & | v | ) | const |
Greater operator for two int_vectors.
int_vector w is greater than v if
or w[i]==v[i] for all i < min(w.size(), v.size()) and w.size()>v.size().
Required for the STL LessThan Comparable Concept.
bool sdsl::int_vector< fixedIntWidth, size_type_class >::operator>= | ( | const int_vector< fixedIntWidth, size_type_class > & | v | ) | const |
Greater of equal operator.
Required for the STL LessThan Comparable Concept.
int_vector< fixedIntWidth, size_type_class >::reference sdsl::int_vector< fixedIntWidth, size_type_class >::operator[] | ( | const size_type & | i | ) | [inline] |
non const version of [] operator
i | Index the i-th integer of length get_int_width(). |
Required for the STL Random Access Container Concept.
int_vector< fixedIntWidth, size_type_class >::const_reference sdsl::int_vector< fixedIntWidth, size_type_class >::operator[] | ( | const size_type & | i | ) | const [inline] |
const version of [] operator
i | Index the i-th integer of length get_int_width(). |
Required for the STL Random Access Container Concept.
void sdsl::int_vector< fixedIntWidth, size_type_class >::resize | ( | const size_type | size | ) |
Resize the int_vector in terms of elements.
size | The size to resize the int_vector in terms of elements. |
Required for the Sequence Concept of the STL.
int_vector< fixedIntWidth, size_type_class >::size_type sdsl::int_vector< fixedIntWidth, size_type_class >::serialize | ( | std::ostream & | out, |
structure_tree_node * | v = NULL , |
||
std::string | name = "" , |
||
bool | write_fixed_as_variable = false |
||
) | const |
void sdsl::int_vector< fixedIntWidth, size_type_class >::set_int | ( | size_type | idx, |
value_type | x, | ||
const uint8_t | len = 64 |
||
) | [inline] |
Set the bits from position idx to idx+len-1 to the binary representation of integer x.
The bit at position idx represents the least significant bit(lsb), and the bit at position idx+len-1 the most significant bit (msb) of x.
idx | Starting index of the binary representation of x. |
x | The integer to store in the int_vector. |
len | The length used to store x in the int_vector. Default value is 64. |
void sdsl::int_vector< fixedIntWidth, size_type_class >::set_int_width | ( | uint8_t | intWidth | ) |
Sets the width of the integers which are accessed via the [] operator, if fixedIntWidth equals 0.
intWidth | New width of the integers accessed via the [] operator. |
int_vector< fixedIntWidth, size_type_class >::size_type sdsl::int_vector< fixedIntWidth, size_type_class >::size | ( | ) | const |
The number of elements in the int_vector.
Required for the Container Concept of the STL.