pub fn modular_reduction<T, U>(f: &U, m: &[T]) -> Vec<U> where
    T: Sized + Clone + One + for<'x> From<<&'x T as Mul>::Output>,
    for<'x> &'x T: Mul,
    U: Sized + for<'x> From<<&'x U as Rem<&'x T>>::Output>,
    for<'x> &'x U: Rem<&'x T>, 
Expand description

modular reduction

m.len() must be $2^k~(k=1,2,3,\ldots)$

use ring_algorithm::modular_reduction;
let t = 997u128;
let m = vec![2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53];
let v = modular_reduction::<u128, u128>(&t, &m);
let w = m.iter().map(|m| t % m).collect::<Vec<_>>();
assert_eq!(v, w);