Template Function ADS::arithmeticCodeExact

Function Documentation

template<class C>
std::string ADS::arithmeticCodeExact(std::span<const C> text, const std::map<C, Rational> &prob)

the arithmetic code of text: the first ceil( log2( 2 / s ) ) bits of l + s / 2, a string of ‘0’ and ‘1’

Pre:

as arithmeticInterval()

Post:

the code, as a fraction, is in [ l , l + s )