Template Class FixedLinearCongruentialMap

Class Documentation

template<typename T>
class FixedLinearCongruentialMap

Computes a bijection f:[p]->[p], x -> (a*x+b) mod p where p is chosen as the smallest p >= n and p prime. a and b are drawn unif at random.

Template Parameters:

T

Public Types

using value_type = T

Public Functions

inline FixedLinearCongruentialMap()
inline explicit FixedLinearCongruentialMap(value_type n, unsigned seed = 0)
inline FixedLinearCongruentialMap(value_type n, std::mt19937_64 &prng)
inline FixedLinearCongruentialMap(value_type n, value_type a, value_type b)
FixedLinearCongruentialMap(const FixedLinearCongruentialMap&) = default
FixedLinearCongruentialMap(FixedLinearCongruentialMap&&) noexcept = default
FixedLinearCongruentialMap &operator=(const FixedLinearCongruentialMap&) = default
FixedLinearCongruentialMap &operator=(FixedLinearCongruentialMap&&) noexcept = default
inline value_type hash(value_type n) const

Hashes [n] to [p] with (a*x+b) mod p.

inline value_type operator()(value_type n) const

Alias to hash(n)

inline value_type invert(value_type y) const

invert(hash(x)) == x

inline bool isGap(value_type y) const

Is true if there exists no x in [n], s.t. h(x) == y, i.e. it can be used to determine if the map maps to y

inline void sampleParameters(std::mt19937_64 &prng)

randomly samples parameters a and b

inline void setAsIdentity()

Sets parameters a = 1 and b = 0.

inline value_type param_a() const
inline value_type param_ainv() const
inline value_type param_b() const
inline value_type param_p() const