79#ifndef __ADS_WaveletMatrix
80 #define __ADS_WaveletMatrix
193 template< Executor E >
199 requires( std::is_same_v< U , std::uint8_t > ||
200 std::is_same_v< U , std::uint16_t > ||
201 std::is_same_v< U , std::uint32_t > )
206 template< Executor E ,
class U >
207 requires( std::is_same_v< U , std::uint8_t > ||
208 std::is_same_v< U , std::uint16_t > ||
209 std::is_same_v< U , std::uint32_t > )
213 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
216 [[nodiscard]]
bool empty(
void )
const {
return( f_n == 0 ); }
219 [[nodiscard]]
int width(
void )
const {
return(
int( f_lev.size() ) ); }
237 [[nodiscard]] std::uint64_t
access( std::size_t i )
const;
240 [[nodiscard]] std::uint64_t
operator[]( std::size_t i )
const {
263 [[nodiscard]] std::size_t
rank( std::uint64_t c , std::size_t i )
const;
287 [[nodiscard]] std::size_t
select( std::uint64_t c , std::size_t k )
const;
308 [[nodiscard]] std::uint64_t
quantile( std::size_t i , std::size_t j ,
309 std::size_t k )
const;
331 [[nodiscard]] std::size_t
countLess( std::size_t i , std::size_t j ,
332 std::uint64_t c )
const;
374 [[nodiscard]]
bool bit( std::uint64_t c , std::size_t l )
const {
375 return( ( c >> ( f_lev.size() - 1 - l ) ) & 1 );
379 [[nodiscard]] std::size_t start( std::uint64_t c )
const;
382#ifndef ADS_WAVELET_SLICE
383 static constexpr std::size_t kSlice = std::size_t( 1 ) << 16;
385 static constexpr std::size_t kSlice = ADS_WAVELET_SLICE;
389#ifndef ADS_WAVELET_SLICE_MAX
390 static constexpr std::size_t kSliceMax = std::size_t( 1 ) << 18;
392 static constexpr std::size_t kSliceMax = ADS_WAVELET_SLICE_MAX;
397 template<
class U , Executor E >
398 void init( E & ex , std::span< const U > x ,
int w );
402 template<
class T ,
class U , Executor E >
403 void build( E & ex , std::span< const U > x ,
int w );
406 std::vector< RankSelect > f_lev;
407 std::vector< std::size_t > f_zeros;
419#include "ADS/succinct/impl/WaveletMatrix.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 layer of execution of the parallel algorithms of ADS, beyond the book: an executor runs the calls...
Rank and select on a static vector of bits of bits with 1s (chapter 15, Compressed Data Structures...
the random-access constant iterator on the items T of the owner O, read by ( *o )[ i ]
Definition BitVector.h:372
WaveletMatrix(void)=default
the empty sequence
std::ptrdiff_t difference_type
the type of a distance
Definition WaveletMatrix.h:351
WaveletMatrix(std::span< const std::uint64_t > x, int w=0)
the sequence , its items of bits (0: the bits of the largest one), built by the passes of up to 8 le...
WaveletMatrix(std::span< const U > x, int w=0)
the sequence of items of 8, 16 or 32 bits, which the construction reads as they are,...
const_iterator cbegin(void) const
the first item
Definition WaveletMatrix.h:367
std::uint64_t operator[](std::size_t i) const
the item , by access()
Definition WaveletMatrix.h:240
const_iterator iterator
the items are read only
Definition WaveletMatrix.h:356
WaveletMatrix(E &ex, std::span< const U > x, int w=0)
the sequence of items of 8, 16 or 32 bits on the threads of ex, as WaveletMatrix( ex ,...
bool empty(void) const
whether there is no item
Definition WaveletMatrix.h:216
WaveletMatrix(E &ex, std::span< const std::uint64_t > x, int w=0)
the matrix of WaveletMatrix( x , w ) above, the same levels and directories, built on the threads of ...
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
std::uint64_t quantile(std::size_t i, std::size_t j, std::size_t k) const
the -th smallest item of the places , from
int width(void) const
the bits of an item
Definition WaveletMatrix.h:219
const_iterator end(void) const
one past the last item
Definition WaveletMatrix.h:363
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition WaveletMatrix.h:340
std::size_t countLess(std::size_t i, std::size_t j, std::uint64_t c) const
the number of the items below in the places
const_iterator begin(void) const
the first item
Definition WaveletMatrix.h:359
std::size_t select(std::uint64_t c, std::size_t k) const
the place of the -th
std::uint64_t const_reference
an item, by value
Definition WaveletMatrix.h:353
std::size_t size_type
the type of a size
Definition WaveletMatrix.h:350
std::size_t sizeInBits(void) const
the bits of the levels and of their directories
SubscriptIterator< WaveletMatrix, std::uint64_t > const_iterator
an iterator on the items, by access()
Definition WaveletMatrix.h:355
std::size_t size(void) const
the number of items
Definition WaveletMatrix.h:213
const_iterator cend(void) const
one past the last item
Definition WaveletMatrix.h:369
std::uint64_t access(std::size_t i) const
the item
std::uint64_t value_type
the type of an item
Definition WaveletMatrix.h:349
std::uint64_t reference
an item, by value
Definition WaveletMatrix.h:352
std::size_t rank(std::uint64_t c, std::size_t i) const
the number of in the places