SDSL 3.0.3
Succinct Data Structure Library
Loading...
Searching...
No Matches
sdsl::util Namespace Reference

A namespace for helper functions. More...

Functions

template<typename T >
std::string to_string (T const &t, int w=1)
 
uint64_t pid ()
 
uint64_t id ()
 
void set_zero_bits (nn_dict_dynamic &nn)
 
void set_verbose ()
 
template<class t_int_vec >
void set_random_bits (t_int_vec &v, int seed=0)
 Sets all bits of the int_vector to pseudo-random bits.
 
template<class t_int_vec >
void _set_zero_bits (t_int_vec &v)
 Sets all bits of the int_vector to 0-bits.
 
template<class t_int_vec >
void _set_one_bits (t_int_vec &v)
 Sets all bits of the int_vector to 1-bits.
 
template<class t_int_vec >
void bit_compress (t_int_vec &v)
 Bit compress the int_vector.
 
template<class t_int_vec >
void expand_width (t_int_vec &v, uint8_t new_width)
 Expands the integer width to new_width >= v.width()
 
template<class t_int_vec >
void mod (t_int_vec &v, typename t_int_vec::size_type m)
 All elements of v modulo m.
 
void cyclic_shifts (uint64_t *vec, uint8_t &n, uint64_t k, uint8_t int_width)
 
template<class t_int_vec >
void set_to_value (t_int_vec &v, uint64_t k)
 Set all entries of int_vector to value k.
 
template<class t_int_vec , class t_int_vec_iterator >
void set_to_value (t_int_vec &v, uint64_t k, t_int_vec_iterator it)
 Set all entries of int_vector starting from iterator it to value k.
 
template<class t_int_vec >
void set_to_id (t_int_vec &v)
 Sets each entry of the numerical vector v at position $fi .
 
template<class t_int_vec >
Number of set bits in v t_int_vec::size_type cnt_one_bits (t_int_vec const &v)
 
template<class t_int_vec >
Number of occurrences of bit pattern in v t_int_vec::size_type cnt_onezero_bits (t_int_vec const &v)
 
template<class t_int_vec >
Number of occurrences of bit pattern in v t_int_vec::size_type cnt_zeroone_bits (t_int_vec const &v)
 
template<class t_int_vec >
Get the smallest position f$i geq idx f$ where a bit is set t_int_vec::size_type next_bit (t_int_vec const &v, uint64_t idx)
 
template<class t_int_vec >
Get the greatest position f$i leq idx f$ where a bit is set t_int_vec::size_type prev_bit (t_int_vec const &v, uint64_t idx)
 
Get the size of a file in bytes size_t file_size (std::string const &file)
 
Returns the basename of a file std::string basename (std::string file)
 
Returns the directory of a file A trailing will be removed std::string dirname (std::string file)
 
Demangle the class name of typeid (...).name() inline std
 

Detailed Description

A namespace for helper functions.

Function Documentation

◆ _set_one_bits()

template<class t_int_vec >
void sdsl::util::_set_one_bits ( t_int_vec & v)

Sets all bits of the int_vector to 1-bits.

Definition at line 563 of file util.hpp.

◆ _set_zero_bits()

template<class t_int_vec >
void sdsl::util::_set_zero_bits ( t_int_vec & v)

Sets all bits of the int_vector to 0-bits.

Definition at line 552 of file util.hpp.

◆ basename()

Returns the basename of a file std::string sdsl::util::basename ( std::string file)
inline
Parameters
filePath to a file.
Returns
Basename of the specified file.

Definition at line 191 of file util.hpp.

◆ bit_compress()

template<class t_int_vec >
void sdsl::util::bit_compress ( t_int_vec & v)

Bit compress the int_vector.

Determine the biggest value X and then set the int_width to the smallest possible so that we still can represent X

Definition at line 502 of file util.hpp.

◆ cnt_one_bits()

template<class t_int_vec >
Number of set bits in v t_int_vec::size_type sdsl::util::cnt_one_bits ( t_int_vec const & v)
Parameters
vint_vector object.
Returns
The number of 1-bits in v.

◆ cnt_onezero_bits()

template<class t_int_vec >
Number of occurrences of bit pattern in v t_int_vec::size_type sdsl::util::cnt_onezero_bits ( t_int_vec const & v)
See also
getOneBits, getOneZeroBits

◆ cnt_zeroone_bits()

template<class t_int_vec >
Number of occurrences of bit pattern in v t_int_vec::size_type sdsl::util::cnt_zeroone_bits ( t_int_vec const & v)
See also
getOneBits, getZeroOneBits

◆ cyclic_shifts()

void sdsl::util::cyclic_shifts ( uint64_t * vec,
uint8_t & n,
uint64_t k,
uint8_t int_width )
inline

Definition at line 573 of file util.hpp.

◆ dirname()

Returns the directory of a file A trailing will be removed std::string sdsl::util::dirname ( std::string file)
inline
Parameters
filePath to a file.
Returns
Directory name part of the specified path.

Definition at line 215 of file util.hpp.

◆ expand_width()

template<class t_int_vec >
void sdsl::util::expand_width ( t_int_vec & v,
uint8_t new_width )

Expands the integer width to new_width >= v.width()

Definition at line 530 of file util.hpp.

◆ file_size()

Get the size of a file in bytes size_t sdsl::util::file_size ( std::string const & file)
inline
Parameters
filePath to a file.
Returns
Size of the specified file in bytes.

Definition at line 173 of file util.hpp.

◆ id()

uint64_t sdsl::util::id ( )

◆ mod()

template<class t_int_vec >
void sdsl::util::mod ( t_int_vec & v,
typename t_int_vec::size_type m )

All elements of v modulo m.

Definition at line 493 of file util.hpp.

◆ next_bit()

template<class t_int_vec >
Get the smallest position f$i geq idx f$ where a bit is set t_int_vec::size_type sdsl::util::next_bit ( t_int_vec const & v,
uint64_t idx )
Parameters
vThe int_vector in which the bit is searched
idxThe start position for the search $ 0\leq idx < v.bit_size()$
Returns
The smallest position greater or equal to idx, where corresponding bit is 1 or v.bit_size() if no such position exists
Time complexity $ 0\leq idx < v.bit_size()$#12

◆ pid()

uint64_t sdsl::util::pid ( )

◆ prev_bit()

template<class t_int_vec >
Get the greatest position f$i leq idx f$ where a bit is set t_int_vec::size_type sdsl::util::prev_bit ( t_int_vec const & v,
uint64_t idx )
Parameters
vThe int_vector in which the bit is searched
idxThe start position for the search $ 0\leq idx < v.bit_size()$
Returns
The greatest position smaller or equal to idx, where corresponding bit is 1 or v.bit_size() if no such position exists
Time complexity $ 0\leq idx < v.bit_size()$#12

◆ set_random_bits()

template<class t_int_vec >
void sdsl::util::set_random_bits ( t_int_vec & v,
int seed = 0 )

Sets all bits of the int_vector to pseudo-random bits.

Parameters
vThe int_vector whose bits should be set to random bits
seedIf seed = 0, the time is used to initialize the pseudo random number generator, otherwise the seed parameter is used.

Definition at line 471 of file util.hpp.

◆ set_to_id()

template<class t_int_vec >
void sdsl::util::set_to_id ( t_int_vec & v)

Sets each entry of the numerical vector v at position $fi .

◆ set_to_value() [1/2]

template<class t_int_vec >
void sdsl::util::set_to_value ( t_int_vec & v,
uint64_t k )

Set all entries of int_vector to value k.

Parameters
vThe int_vector which should be set
kThe value which should be inserted into v.
Details
This method pre-calculates the content of at most 64 words and then repeatedly inserts these words into v.

Definition at line 597 of file util.hpp.

◆ set_to_value() [2/2]

template<class t_int_vec , class t_int_vec_iterator >
void sdsl::util::set_to_value ( t_int_vec & v,
uint64_t k,
t_int_vec_iterator it )

Set all entries of int_vector starting from iterator it to value k.

Parameters
vThe int_vector which should be set
kThe value which should be inserted into v.
itThe iterator from which on all elements are set to value k.
Details
This method pre-calculates the content of at most 64 words and then repeatedly inserts these words into v.

Definition at line 632 of file util.hpp.

◆ set_verbose()

void sdsl::util::set_verbose ( )
inline

Definition at line 65 of file util.hpp.

◆ set_zero_bits()

void sdsl::util::set_zero_bits ( nn_dict_dynamic & nn)
inline

Definition at line 429 of file nn_dict_dynamic.hpp.

◆ to_string()

template<typename T >
std::string sdsl::util::to_string ( T const & t,
int w = 1 )

◆ typeid()

Demangle the class name of sdsl::util::typeid ( ...)
Parameters
nameA pointer to the result of typeid(...).name()

Definition at line 259 of file util.hpp.