Module mayda::uniform [] [src]

Uniform encoding of integer arrays. Intended for cases where encoding and decoding speed is desired, or the probability distribution of the entries is uniform within certain bounds. Implemented for all primitive integer types.

This type targets encoding and decoding speed by performing minimal transformations of the input array, and only subtracts the minimum value from the entires. The result is that compression decays with the magnitude of the difference between the largest and smallest entries.

Examples

use mayda::{Access, Encode, Uniform};

let input: Vec<u32> = vec![1, 4, 2, 8, 5, 7];
let mut bits = Uniform::new();
bits.encode(&input).unwrap();

let length = bits.len();
assert_eq!(length, 6);

let output = bits.decode();
assert_eq!(input, output);

let value = bits.access(4);
assert_eq!(value, 5);

let range = bits.access(1..4);
assert_eq!(range, vec![4, 2, 8]); 

Structs

Uniform

The type of a uniform encoded integer array. Designed for moderate compression and efficient decoding through the Encode trait, and efficient random access through the Access and AccessInto traits.