ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Capabilities.h

The capabilities of the structures, beyond the book. More...

Files

file  ADS/Capabilities.h
 The capabilities of the structures, beyond the book: what an algorithm may ask of its argument to choose the faster path at compile time, in one vocabulary shared by all the areas (see Capabilities).

Concepts

concept  ADS::declares_monotone
 whether S declares the only direction in which its values move
concept  ADS::forwarding_query_tag
 a tag of a forwarded query
concept  ADS::meetable_query
 whether the query T composes two answers
concept  ADS::bulk_insertable
 insert_bulk( r ) of the range \( r \) of items as one operation (the generic insertion of a range, the event BulkInserted)
concept  ADS::bulk_erasable
 erase_bulk( r ) of the range \( r \) of keys as one operation (the event BulkErased)
concept  ADS::splittable
 std::move( s ).split( k ), the keys before \( k \), its value and the keys after it (the set operations of Blelloch, Ferizovic and Sun, the cut of a batch)
concept  ADS::joinable
 S::join2( l , r ), the tree of the keys of \( l \) and of \( r \) when those of \( l \) are smaller (the union of Blelloch, Ferizovic and Sun in \( O( m \log( n / m + 1 ) ) \), the link of a batch)
concept  ADS::rankable
 rank( k ), the number of keys smaller than \( k \) (the order statistics); its time is the query rank_complexity_t
concept  ADS::selectable
 select( i ), the key of rank \( i \) (the order statistics); with an augmentation G, augSelect( p ), the first key whose prefix of the values of G satisfies the monotone predicate \( p \)
concept  ADS::prefetchable
 prefetch( k ), a hint that \( k \) (a key or its hash) is looked up next (a batch of lookups by group prefetching)
concept  ADS::reservable
 reserve( n ), room for \( n \) items (the builders)
concept  ADS::augmented_by
 augRange( lo , hi ), the values of the augmentation G of the keys in \( [ \mathit{lo} , \mathit{hi} ] \) combined, kept by the structure as S::Augmented (the aggregates of a range without a scan)
concept  ADS::range_actionable
 applyRange( lo , hi , a ), the action \( a \) applied to every value of the keys in \( [ \mathit{lo} , \mathit{hi} ] \) in \( O( \log n ) \) by a lazy tag (the lazy updates of a range)
concept  ADS::addressable
 an AddressablePriorityQueue with increase( h , p ) and erase( h ) on its handles as well (the open lists whose priorities rise, the native decrease-key)
concept  ADS::observes_values
 update( id ), the key of the item \( \mathit{id} \) read again from the table the queue observes (the queue of the open nodes as an observer of the node table, in the form of LaB-PQ, e.g., TableHeap)
concept  ADS::batch_extract
 extract( theta , out ), every item of priority at most \( \theta \) moved to out at once (the stepping algorithms, the bulk-synchronous search; IndexedDaryHeap, TableHeap, RadixHeap, DialQueue and BucketQueue, by its first key)
concept  ADS::shiftable_keys
 shift_all( delta ), every key moved by \( \delta \) in \( O( 1 ) \) (D* Lite, Generalized Adaptive A*)
concept  ADS::monotone_extract
 a queue whose extractions never decrease, with rebase(), which lets the next episode start below the last key extracted (the radix and Dial queues between the episodes of a search, RadixHeap and DialQueue)
concept  ADS::rekeyable
 rekey( f ), the key of each item recomputed by \( f \) and the order rebuilt in \( O( n ) \) (the change of the key function; IndexedDaryHeap)
concept  ADS::erasable
 erase( k ) of a key (the node tables that reuse their places within an episode)
concept  ADS::epoch_clearable
 clear() in \( O( 1 ) \) by epochs: a policy of clear(), T::Clear, that stamps the places, and epoch() (the node tables of a sequence of searches)
concept  ADS::undoable
 checkpoint() and rollback( t ) back to a checkpoint (a speculative change, a batch that exits by an exception)
concept  ADS::snapshotable
 snapshot(), a view of the present state in \( O( 1 ) \) which later changes do not touch (the audits, a persistent structure)
concept  ADS::in_arcs
 forEachIn( v , f ), the arcs entering \( v \) (the observers that repair a tree from the heads of the arcs that changed)
concept  ADS::stable_edge_ids
 arcId( u , v ), an id of the arc that does not change while the arc is in the graph (the observers that keep their data by arc)
concept  ADS::batch_updatable
 batch(), a group of changes told as one (the observers of a batch of changes)

Classes

struct  ADS::mod::list< E >
 a list of types, the events of a structure [see Modification.h] More...
struct  ADS::forwarding_query
 the base of the tags of the queries that a wrapper forwards to what it wraps More...
struct  ADS::stable_references_t
 the query of whether the items keep their addresses; by default enable_stable_references< S >, and both structures of a composition must have them More...
struct  ADS::thread_safe_reads_t
 the query of whether reads may run with other reads and with writes from other threads; false by default, and both structures of a composition must allow them More...
struct  ADS::rank_complexity_t
 the query of the time of rank(), so that an \( O( n ) \) rank is not taken for an \( O( 1 ) \) one; linear by default, the worse of the two in a composition More...
struct  ADS::event_set_t
 the query of the events of a structure, as std::type_identity of a mod::list; by default modifications_of< S >, and with no meet: a composition emits the events it declares More...

Typedefs

template<class S>
using ADS::key_type_t = typename detail::key_type_of< S >::type
 the keys of S, which its lookups take: S::Key, else S::key_type, else S::value_type, else std::size_t (a position)
template<class S>
using ADS::modifications_of = typename detail::modifications_of< S >::type
 the events of S [see Modification.h], S::modifications if it declares them, the empty list otherwise: what an observer is checked against when it is attached
template<class Q>
using ADS::priority_t = typename detail::priority_of< Q >::type
 the priorities of the queue Q: Q::Priority, else Q::Key (the first key of a queue of two, e.g., BucketQueue), else its items

Enumerations

enum class  ADS::complexity { ADS::complexity::constant , ADS::complexity::logarithmic , ADS::complexity::linear }
 a class of time, from the cheapest More...
enum class  ADS::decrease_key_kind { ADS::decrease_key_kind::none , ADS::decrease_key_kind::lazy , ADS::decrease_key_kind::native }
 how a priority queue lowers the priority of an item: it cannot (none), by a new insertion and the stale copies skipped when they come out (lazy), by decrease() on its handle (native) More...

Functions

template<class S>
constexpr unsigned ADS::monotone_of (void)
 the directions in which the values of S may move, as the bits up and down of mod::effect: S::monotone if it declares it (e.g., static constexpr unsigned monotone = mod::effect::down; for a table of \( g \) under A*), every bit otherwise; an observer compiles out the path of a direction whose bit is not set
template<class Q>
constexpr decrease_key_kind ADS::decrease_key_of (void)
 how the queue Q lowers a priority: Q::decrease_key if it declares it (e.g., a queue whose decrease() is an insertion), else native if queue_decrease( q , h , p ) of QueueCustomization.h takes its handles (its member decrease( h , p ), or a free function for a queue of another library), else lazy if it is a PriorityQueue, else none (the shortest paths and Prim's algorithm)

Variables

template<class S>
constexpr bool ADS::enable_stable_references = false
 whether the items of S keep their addresses while they are in it, so that a handle may be a pointer and the structure never emits Relocated: an explicit opt-in, false unless a structure specializes it, since no syntax shows it; read by the default of stable_references_t, which the wrappers forward (the handles of the observers, the node tables of a search)
template<class T>
constexpr bool ADS::nonmonotone_values = false
 whether the values of the nodes of the table T may grow as well as fall, so that its concurrent fields are atomics under a seqlock instead of the monotone ones read without a lock: an explicit opt-in for the incremental searches whose \( g \) may rise (LPA*, D* Lite), false by default, so that A* pays nothing.
constexpr stable_references_t ADS::stable_references {}
 the tags of the queries
template<class S, forwarding_query_tag T>
constexpr auto ADS::query_v
 the answer of S to the query T, at compile time: the static S::query( T() ) if it has one, T::fallback< S >() otherwise
template<class A, class B, meetable_query T>
constexpr auto ADS::query_meet_v
 the answer of the composition of A and B to the query T
constexpr detail::Query ADS::query {}
 the answer of \( s \) to the query of the tag \( t \), query_v< S , T >
constexpr detail::Reserve ADS::reserve {}
 room for \( n \) items in \( s \): s.reserve( n ), else reserve( s , n ) found by ADL, else nothing (the builders)
constexpr detail::Prefetch ADS::prefetch {}
 a hint that \( k \) is looked up next: s.prefetch( k ), else prefetch( s , k ) found by ADL, else nothing (a batch of lookups that prefetches the next ones, by group prefetching); on a pointer \( p \), prefetch( p ) and prefetch( p , l ) bring the line of \( p \) into the cache [see Prefetch.h]
constexpr detail::InsertBulk ADS::insert_bulk {}
 the items of the range \( r \) inserted in \( s \): s.insert_bulk( r ), else insert_bulk( s , r ) found by ADL, else s.insert( x ) for each item \( x \) of \( r \)

Detailed description

The capabilities of the structures, beyond the book.

The definitions, the invariants and the costs of the area are in Theory of the foundations.

Typedef documentation

◆ key_type_t

template<class S>
using ADS::key_type_t = typename detail::key_type_of< S >::type

the keys of S, which its lookups take: S::Key, else S::key_type, else S::value_type, else std::size_t (a position)

◆ modifications_of

template<class S>
using ADS::modifications_of = typename detail::modifications_of< S >::type

the events of S [see Modification.h], S::modifications if it declares them, the empty list otherwise: what an observer is checked against when it is attached

◆ priority_t

template<class Q>
using ADS::priority_t = typename detail::priority_of< Q >::type

the priorities of the queue Q: Q::Priority, else Q::Key (the first key of a queue of two, e.g., BucketQueue), else its items

Enumeration type documentation

◆ complexity

enum class ADS::complexity
strong

a class of time, from the cheapest

Enumerator
constant 
logarithmic 
linear 

◆ decrease_key_kind

enum class ADS::decrease_key_kind
strong

how a priority queue lowers the priority of an item: it cannot (none), by a new insertion and the stale copies skipped when they come out (lazy), by decrease() on its handle (native)

Enumerator
none 
lazy 
native 

Function documentation

◆ decrease_key_of()

template<class Q>
decrease_key_kind ADS::decrease_key_of ( void )
constexpr

how the queue Q lowers a priority: Q::decrease_key if it declares it (e.g., a queue whose decrease() is an insertion), else native if queue_decrease( q , h , p ) of QueueCustomization.h takes its handles (its member decrease( h , p ), or a free function for a queue of another library), else lazy if it is a PriorityQueue, else none (the shortest paths and Prim's algorithm)

In pseudocode, each test made at compile time:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{decrease\_key\_of}( Q ) \cr 2 & \quad \textbf{if}\ Q \text{ declares } \mathtt{decrease\_key} \ \textbf{then return}\ \text{its value}\quad \triangleright \ \text{the opt-in wins} \cr 3 & \quad \textbf{if}\ \mathrm{queue\_decrease}( q , h , p ) \text{ takes its handles}\ \textbf{then return} \ \mathit{native} \cr 4 & \quad \textbf{if}\ Q \text{ models } \mathtt{PriorityQueue} \ \textbf{then return}\ \mathit{lazy} \cr 5 & \quad \textbf{return}\ \mathit{none} \end{array}} \]

◆ monotone_of()

template<class S>
unsigned ADS::monotone_of ( void )
constexpr

the directions in which the values of S may move, as the bits up and down of mod::effect: S::monotone if it declares it (e.g., static constexpr unsigned monotone = mod::effect::down; for a table of \( g \) under A*), every bit otherwise; an observer compiles out the path of a direction whose bit is not set

Variable documentation

◆ enable_stable_references

template<class S>
bool ADS::enable_stable_references = false
inlineconstexpr

whether the items of S keep their addresses while they are in it, so that a handle may be a pointer and the structure never emits Relocated: an explicit opt-in, false unless a structure specializes it, since no syntax shows it; read by the default of stable_references_t, which the wrappers forward (the handles of the observers, the node tables of a search)

◆ insert_bulk

detail::InsertBulk ADS::insert_bulk {}
inlineconstexpr

the items of the range \( r \) inserted in \( s \): s.insert_bulk( r ), else insert_bulk( s , r ) found by ADL, else s.insert( x ) for each item \( x \) of \( r \)

◆ nonmonotone_values

template<class T>
bool ADS::nonmonotone_values = false
inlineconstexpr

whether the values of the nodes of the table T may grow as well as fall, so that its concurrent fields are atomics under a seqlock instead of the monotone ones read without a lock: an explicit opt-in for the incremental searches whose \( g \) may rise (LPA*, D* Lite), false by default, so that A* pays nothing.

ConcurrentCuckooTable opts in, since a lookup reads a pair under the version of its region (a seqlock) or under its lock, so that a value that holds \( g \) and the parent together is read as one write left it, while a table whose readers assume that \( g \) only falls (a minimum written by a compare-and-swap and read with no version) does not

◆ prefetch

detail::Prefetch ADS::prefetch {}
inlineconstexpr

a hint that \( k \) is looked up next: s.prefetch( k ), else prefetch( s , k ) found by ADL, else nothing (a batch of lookups that prefetches the next ones, by group prefetching); on a pointer \( p \), prefetch( p ) and prefetch( p , l ) bring the line of \( p \) into the cache [see Prefetch.h]

◆ query

detail::Query ADS::query {}
inlineconstexpr

the answer of \( s \) to the query of the tag \( t \), query_v< S , T >

◆ query_meet_v

template<class A, class B, meetable_query T>
auto ADS::query_meet_v
inlineconstexpr
Initial value:
=
constexpr auto query_v
the answer of S to the query T, at compile time: the static S::query( T() ) if it has one,...
Definition Capabilities.h:336

the answer of the composition of A and B to the query T

◆ query_v

template<class S, forwarding_query_tag T>
auto ADS::query_v
inlineconstexpr
Initial value:
=
detail::query_of< std::remove_cvref_t< S > , T >()

the answer of S to the query T, at compile time: the static S::query( T() ) if it has one, T::fallback< S >() otherwise

◆ reserve

detail::Reserve ADS::reserve {}
inlineconstexpr

room for \( n \) items in \( s \): s.reserve( n ), else reserve( s , n ) found by ADL, else nothing (the builders)

◆ stable_references

stable_references_t ADS::stable_references {}
inlineconstexpr

the tags of the queries