86 #define __ADS_PGMIndex
103#include <string_view>
104#include <type_traits>
121template<
class K , std::
size_t E = 64 , std::
size_t R = 4 >
122 requires std::is_arithmetic_v< K >
126 static_assert( ( E >= 1 ) && ( R >= 1 ) ,
"the errors are at least 1" );
213 [[nodiscard]] std::size_t
size(
void )
const;
216 [[nodiscard]]
bool empty(
void )
const;
225 [[nodiscard]] std::size_t
bytes(
void )
const;
233 [[nodiscard]]
static constexpr std::uint64_t
persistTag(
void ) {
234 return( detail::persistMix( {
sizeof( K ) , std::is_signed_v< K > ,
235 std::is_floating_point_v< K > , E , R } ) );
251 using persist_unit = std::uint64_t;
259 std::vector< std::uint64_t > key;
260 std::vector< Line > line;
261 std::vector< std::uint32_t > start;
265 void persist( A & a ) {
266 a( key , line , start );
267 a.require( ( line.size() == key.size() ) &&
268 ( start.size() == key.size() + 1 ) ,
269 "a level of a PGMIndex" );
274 [[nodiscard]]
static std::uint64_t ord(
const K & k );
278 static Level approximate(
const std::vector< std::uint64_t > & x ,
279 const std::vector< std::uint32_t > & y ,
280 std::int64_t e , std::size_t total );
284 [[nodiscard]]
static std::size_t predict(
const Level & l , std::size_t s ,
287 std::vector< K , HugePageAllocator< K > > f_A;
288 std::vector< Level > f_L;
300#include "ADS/search/impl/PGMIndex.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
An allocator for the large blocks of a structure, beyond the book: a request of at least one huge pag...
A file mapped in memory, shared by the structures that are read from it in place [see Persistence....
The primitives of the processor that the compilers spell each in their own way, in one form for all: ...
The prefetch of a line of the cache, beyond the book: ADS::prefetch( p ) asks the processor to bring ...
The arithmetic of two words that C++20 does not spell, in one form for every compiler: the product of...
PGMIndex(const std::vector< K > &A)
the index on the sorted items of , a level of segments of error on the distinct keys and their first...
bool empty(void) const
true if there are no items
std::size_t bytes(void) const
the bytes of the index, the items aside
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
std::size_t segments(void) const
the segments of the last level
bool contains(const K &v) const
true if is an item, by lowerBound( v )
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition PGMIndex.h:230
K Item
the type of the items
Definition PGMIndex.h:130
const K & operator[](std::size_t i) const
the item of place
static constexpr std::uint64_t persistTag(void)
the type of the keys and the errors, in a file
Definition PGMIndex.h:233
std::size_t lowerBound(const K &v) const
the first place of an item not smaller than , size() if none
int height(void) const
the levels of segments
PGMIndex(void)=default
an empty index
std::size_t size(void) const
the number of the items