150#ifndef __ADS_RecSplit
151 #define __ADS_RecSplit
171#include <string_view>
172#include <type_traits>
191 std::vector< std::uint8_t > rice;
192 std::vector< std::uint32_t > low;
193 std::vector< std::uint16_t > nodes;
198[[nodiscard]]
int recSplitSelect( std::uint64_t x ,
int k );
204class RecSplitSequence
208 RecSplitSequence(
void ) =
default;
211 explicit RecSplitSequence(
const std::vector< std::uint64_t > & x );
214 [[nodiscard]] std::uint64_t access( std::size_t i )
const;
217 [[nodiscard]] std::pair< std::uint64_t , std::uint64_t >
218 pair( std::size_t i )
const;
221 [[nodiscard]] std::size_t sizeInBits(
void )
const;
225 void persist( A & a ) {
226 a( f_l , f_low , f_high , f_inv );
227 a.require( ( f_l >= 0 ) && ( f_l < 64 ) ,
"a sequence of a RecSplit" );
232 [[nodiscard]] std::size_t select( std::size_t i )
const;
235 [[nodiscard]] std::uint64_t low( std::size_t i )
const;
238 std::vector< std::uint64_t > f_low;
240 std::vector< std::uint64_t > f_high;
241 std::vector< std::uint64_t > f_inv;
252template<
class T ,
unsigned L = 8 ,
class H = DefaultHash< T > >
256 static_assert( ( L >= 1 ) && ( L <= 24 ) ,
"RecSplit: 1 <= L <= 24" );
299 explicit RecSplit(
const std::vector< T > & keys , std::size_t b = 100 ,
300 std::uint64_t seed = 1 , H h = H() );
329 [[nodiscard]] std::size_t
size(
void )
const;
332 [[nodiscard]]
bool empty(
void )
const;
336 [[nodiscard]] std::size_t
bits(
void )
const;
339 [[nodiscard]] std::size_t
buckets(
void )
const;
342 [[nodiscard]] std::size_t
trials(
void )
const;
350 [[nodiscard]]
static constexpr std::uint64_t
persistTag(
void ) {
351 return( detail::persistMix( {
sizeof( T ) , L } ) );
361 static constexpr std::size_t kMaxTrials = 100;
362 static constexpr std::size_t kMaxBucket = 4096;
364 static constexpr std::size_t kLower =
365 std::max< std::size_t >( 2 , ( 35 * L + 50 + 99 ) / 100 ) * L;
366 static constexpr std::size_t kUpper =
367 ( L >= 7 ? ( 21 * L + 90 + 99 ) / 100 : 2 ) * kLower;
370 [[nodiscard]]
static const detail::RecSplitTables & tables(
void );
373 [[nodiscard]]
static constexpr std::size_t left( std::size_t m );
377 [[nodiscard]]
static std::uint64_t node( std::uint64_t h , std::uint64_t x ,
381 [[nodiscard]]
static std::size_t remap( std::uint64_t g , std::size_t m );
384 [[nodiscard]] std::uint64_t base(
const T & k )
const;
387 [[nodiscard]] std::uint64_t window( std::uint64_t at )
const;
390 [[nodiscard]] std::uint64_t skipOnes( std::uint64_t at ,
391 std::size_t c )
const;
396 static void split( std::uint64_t * K , std::uint64_t * S , std::size_t m ,
397 unsigned d , std::vector< std::uint64_t > & seeds ,
398 std::vector< std::uint8_t > & rice );
402 bool build(
const std::vector< std::uint64_t > & B , std::size_t b );
404 std::uint64_t f_seed;
406 std::size_t f_nb = 0;
408 std::vector< std::uint64_t , MappableAllocator< std::uint64_t > > f_code;
410 detail::RecSplitSequence f_keys;
412 detail::RecSplitSequence f_place;
413 std::uint64_t f_dk = 0;
414 std::int64_t f_dp = 0;
416 std::uint64_t f_beta = 0;
417 const detail::RecSplitTables * f_t =
nullptr;
418 std::size_t f_trials = 0;
431#include "ADS/dictionary/impl/RecSplit.tpp"
The vector of bits on which the succinct structures and the integer codes of ADS are built: the bits ...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The engineered hash functions of ADS, beyond the book [see HashFunctions.h for those of section 7....
A file mapped in memory, shared by the structures that are read from it in place [see Persistence....
std::size_t size(void) const
the number of keys
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
bool empty(void) const
true if there are no keys
RecSplit(void)
the function of no key
Definition RecSplit.h:261
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition RecSplit.h:347
std::size_t operator()(const T &k) const
the value of , in ; some value in it for a key out of
T Key
the type of the keys
Definition RecSplit.h:263
std::size_t trials(void) const
the seeds drawn by the build
RecSplit(const std::vector< T > &keys, std::size_t b=100, std::uint64_t seed=1, H h=H())
the function of the distinct keys, with keys per bucket on average
std::size_t bits(void) const
the bits of the function: the codes, the two Elias-Fano sequences with their directories and the obje...
static constexpr std::uint64_t persistTag(void)
the parameters of the layout, in a file
Definition RecSplit.h:350
std::size_t buckets(void) const
the number of buckets