pub fn decode_u64(ones: u64, ordinal: u64) -> u64
Expand description
Implementation of Cover’s algorithm to enumerate of sequences of weight w, cf. “Enumerative Source Encoding”. Thomas M. Cover. Appears in IEEE Transactions on Information Theory. Vol 19, Issue: 1, Jan 1973
The implementation corresponds to Section “Example 2 - Enumeration of Sequences of Weight w”.
§Examples
use toolbox_rs::enumerative_source_coding::decode_u64;
// 0th number with 3 bits set in a 64 bit number
assert_eq!(decode_u64(3, 0), 0b000_0111);