a permutation of \( [ 0 , n ) \) that shifts each of its intervals alike, with the image of a place and its interval in \( O( 1 ) \) time
More...
#include <ADS/succinct/MoveStructure.h>
|
| | MoveStructure (void)=default |
| | the permutation of no place
|
| | MoveStructure (std::span< const std::uint64_t > p, std::span< const std::uint64_t > q, std::span< const std::uint32_t > tag, std::uint64_t n) |
| | the permutation of the intervals that start at \( p \) (sorted, the first at 0) onto those that start at \( q \), of \( [ 0 , n ) \), each with its tag
|
| std::size_t | intervals (void) const |
| | the number of the intervals, after the balance
|
| std::uint64_t | size (void) const |
| | the number of places, \( n \)
|
| std::uint64_t | start (std::size_t i) const |
| | the start of the interval \( i \), \( n \) for \( i \) equal to intervals()
|
| std::uint32_t | tag (std::size_t i) const |
| | the tag of the interval \( i \)
|
| std::pair< std::uint64_t, std::size_t > | move (std::uint64_t x, std::size_t i) const |
| | the image of \( x \), of the interval \( i \), and its interval
|
| std::size_t | interval (std::uint64_t x) const |
| | the interval of \( x \), by a binary search on the starts (for the first place of a walk)
|
| std::size_t | sizeInBits (void) const |
| | the bits of the starts, of the images, of their intervals and of the tags
|
| template<class A> |
| void | persist (A &a) |
| | the members written to, or read from, the archive \( a \) [see Persistence.h]
|
a permutation of \( [ 0 , n ) \) that shifts each of its intervals alike, with the image of a place and its interval in \( O( 1 ) \) time
◆ MoveStructure() [1/2]
| ADS::MoveStructure::MoveStructure |
( |
void | | ) |
|
|
default |
the permutation of no place
◆ MoveStructure() [2/2]
| ADS::MoveStructure::MoveStructure |
( |
std::span< const std::uint64_t > | p, |
|
|
std::span< const std::uint64_t > | q, |
|
|
std::span< const std::uint32_t > | tag, |
|
|
std::uint64_t | n ) |
the permutation of the intervals that start at \( p \) (sorted, the first at 0) onto those that start at \( q \), of \( [ 0 , n ) \), each with its tag
In pseudocode (the balance of Nishimoto and Tabei, beyond the book), \( I \) the intervals by start, each with its image, and \( P \) the starts:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{balance}( I ) \cr
2 & \quad S \gets \text{the images of } I \cr
3 & \quad \textbf{while}\ S \ne \emptyset\ \textbf{do} \cr
4 & \qquad [ q , q + \lambda ) \gets \mathrm{pop}( S ) \text{, the image }
\text{of } [ p , p + \lambda ) \cr
5 & \qquad \textbf{if}\ [ q , q + \lambda ) \text{ holds 4 starts or }
\text{more of } P\ \textbf{then} \cr
6 & \qquad\quad t \gets \text{the third of them} - q \cr
7 & \qquad\quad \text{cut } [ p , p + \lambda ) \text{ into } [ p , p + t
) \text{ and } [ p + t , p + \lambda ) \text{, the tag kept} \cr
8 & \qquad\quad \mathrm{push}( S , [ q , q + t ) );\ \mathrm{push}( S , [
q + t , q + \lambda ) ) \cr
9 & \qquad\quad \mathrm{push}( S , \text{the image that holds the new }
\text{start } p + t )
\end{array}}
\]
- Precondition
- \( p \), \( q \) and the tags of the same size, the images a partition of \( [ 0 , n ) \)
◆ interval()
| std::size_t ADS::MoveStructure::interval |
( |
std::uint64_t | x | ) |
const |
|
nodiscard |
the interval of \( x \), by a binary search on the starts (for the first place of a walk)
- Precondition
- \( x < n \)
◆ intervals()
| std::size_t ADS::MoveStructure::intervals |
( |
void | | ) |
const |
|
inlinenodiscard |
the number of the intervals, after the balance
◆ move()
| std::pair< std::uint64_t, std::size_t > ADS::MoveStructure::move |
( |
std::uint64_t | x, |
|
|
std::size_t | i ) const |
|
nodiscard |
the image of \( x \), of the interval \( i \), and its interval
In pseudocode (Nishimoto and Tabei, beyond the book):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{move}( x , i ) \cr
2 & \quad y \gets q_i + ( x - p_i );\ j \gets d_i \cr
3 & \quad \textbf{while}\ p_{j+1} \le y\ \textbf{do}\ j \gets j + 1\quad
\triangleright\ \text{at most 3 steps, by the balance} \cr
4 & \quad \textbf{return}\ ( y , j )
\end{array}}
\]
- Precondition
- start( i ) \( \le x < \) start( i + 1 )
◆ persist()
template<class A>
| void ADS::MoveStructure::persist |
( |
A & | a | ) |
|
the members written to, or read from, the archive \( a \) [see Persistence.h]
◆ size()
| std::uint64_t ADS::MoveStructure::size |
( |
void | | ) |
const |
|
inlinenodiscard |
the number of places, \( n \)
◆ sizeInBits()
| std::size_t ADS::MoveStructure::sizeInBits |
( |
void | | ) |
const |
|
nodiscard |
the bits of the starts, of the images, of their intervals and of the tags
◆ start()
| std::uint64_t ADS::MoveStructure::start |
( |
std::size_t | i | ) |
const |
|
inlinenodiscard |
the start of the interval \( i \), \( n \) for \( i \) equal to intervals()
◆ tag()
| std::uint32_t ADS::MoveStructure::tag |
( |
std::size_t | i | ) |
const |
|
inlinenodiscard |
the tag of the interval \( i \)
◆ persistName
| std::string_view ADS::MoveStructure::persistName = "MoveStructure" |
|
staticconstexpr |
The documentation for this class was generated from the following file: