tlx
Loading...
Searching...
No Matches
IntegerRank< Int > Class Template Reference

Compute the rank of an integer x (i.e. More...

#include <radix_heap.hpp>

Public Types

using int_type
 
using rank_type
 

Static Public Member Functions

static constexpr rank_type rank_of_int (int_type i)
 Maps value i to its rank in int_type.
 
static constexpr int_type int_at_rank (rank_type r)
 Returns the r-th smallest number of int_r.
 

Static Private Attributes

static constexpr bool use_identity_
 
static constexpr rank_type sign_bit_
 

Detailed Description

template<typename Int>
class tlx::radix_heap_detail::IntegerRank< Int >

Compute the rank of an integer x (i.e.

the number of elements smaller than x that are representable using type Int) and vice versa. If Int is an unsigned integral type, all computations yield identity. If Int is a signed integrals, the smallest (negative) number is mapped to rank zero, the next larger value to one and so on.

The implementation assumes negative numbers are implemented as Two's complement and contains static_asserts failing if this is not the case.

Definition at line 43 of file radix_heap.hpp.

Member Typedef Documentation

◆ int_type

template<typename Int>
using int_type

Definition at line 49 of file radix_heap.hpp.

◆ rank_type

template<typename Int>
using rank_type

Definition at line 50 of file radix_heap.hpp.

Member Function Documentation

◆ int_at_rank()

template<typename Int>
static constexpr int_type int_at_rank ( rank_type r)
inlinestaticconstexpr

Returns the r-th smallest number of int_r.

It is the inverse of rank_of_int, i.e. int_at_rank(rank_of_int(i)) == i for all i.

Definition at line 62 of file radix_heap.hpp.

◆ rank_of_int()

template<typename Int>
static constexpr rank_type rank_of_int ( int_type i)
inlinestaticconstexpr

Maps value i to its rank in int_type.

For any pair T x < y the invariant IntegerRank<T>::rank_of_int(x) < IntegerRank<T>::rank_of_int(y) holds.

Definition at line 54 of file radix_heap.hpp.

Member Data Documentation

◆ sign_bit_

template<typename Int>
rank_type sign_bit_
staticconstexprprivate

Definition at line 71 of file radix_heap.hpp.

◆ use_identity_

template<typename Int>
bool use_identity_
staticconstexprprivate

Definition at line 69 of file radix_heap.hpp.


The documentation for this class was generated from the following file: