|
ADS
Algorithms and Data Structures
|
The FM-index of Ferragina and Manzini (chapter 14, Block-Sorting Compression, of Ferragina's book, beyond the book of Montresor): the transform of Burrows and Wheeler of \( s \) [see BurrowsWheeler.h] as an index of its substrings, which replaces the suffix array and the text. More...
#include "ADS/Contract.h"#include "ADS/compression/BurrowsWheeler.h"#include "ADS/succinct/RankSelect.h"#include <algorithm>#include <array>#include <bit>#include <cstddef>#include <cstdint>#include <cstring>#include <string>#include <string_view>#include <utility>#include <vector>#include "ADS/compression/impl/FMIndex.tpp"Go to the source code of this file.
Classes | |
| class | ADS::FMIndex |
| the FM-index of a text: its transform with the counts for the rank every \( b \) places and the places of the suffixes at the multiples of \( \mu \) More... | |
Namespaces | |
| namespace | ADS |
The FM-index of Ferragina and Manzini (chapter 14, Block-Sorting Compression, of Ferragina's book, beyond the book of Montresor): the transform of Burrows and Wheeler of \( s \) [see BurrowsWheeler.h] as an index of its substrings, which replaces the suffix array and the text.
The rank of a symbol in \( L \), the number of its occurrences in a prefix, is the count stored every \( b \) places for each symbol of the text plus a scan of fewer than \( b \) symbols, 8 at a time by the zero bytes of a word, i.e., \( O( b ) \) time and \( \sigma ( n / b ) \) counts of 32 bits; the marks of the rows are a vector of bits with the rank directory of RankSelect [see RankSelect.h], so that a row is tested and its sample found in \( O( 1 ) \) time. The counts of \( L \) are the simplest rank on a sequence, which any structure of rank and select on sequences can replace [see WaveletMatrix.h]: the wavelet tree of Grossi, Gupta and Vitter gives the rank in \( O( \log \sigma ) \) time on \( n H_0 + o( n \log \sigma ) \) bits, and the compressed representations of Ferragina, Manzini, Mäkinen and Navarro reach \( n H_k + o( n \log \sigma ) \) bits, the space of the compressed text. The transform is built from the suffix array of SA-IS, in \( O( n ) \) time [see BurrowsWheeler.h]. Against the suffix array, which counts by binary search in \( O( p \log n ) \) time on \( n \log n \) bits plus the text, the FM-index counts in \( O( p b ) \) time here, \( O( p ) \) with a rank in \( O( 1 ) \), at the price of random accesses to \( L \) at each step; the r-index of Gagie, Navarro and Prezza samples only the ends of the runs of \( L \), and takes space proportional to their number \( r \), small on repetitive texts [see RIndex.h].
The contracts [see Contract.h]: \( b \) and \( \mu \) are positive, \( n < 2^{32} \), a pattern is not empty, \( i \le j \le n \); each place found by locate() is an occurrence, an audit. The operations are defined in FMIndex.tpp.