pub fn encode(indices: &[usize], m: usize) -> Result<Vec<usize>>Expand description
Differential encoding: the n + 1 phase indices $c_{-1} = 0, c_{0}, \dots, c_{n-1}$
with $c_{k} = (a_{k} + c_{k-1}) \bmod M$.
§Errors
Error::Config unless m is a power of two ≥ 2 and every index is below m.
§Examples
use comnum_mapping::differential::encode;
assert_eq!(encode(&[1, 1, 1, 1], 2).unwrap(), vec![0, 1, 0, 1, 0]);