macro_rules! impl_longa_monty_lincomb {
($a_b:expr, $u:expr, $modulus:expr, $mod_neg_inv:expr, $nlimbs:expr) => { ... };
}Expand description
Implement the coarse interleaved sum of products (Algorithm 2 for B=1) from Efficient Algorithms for Large Prime Characteristic Fields and Their Application to Bilinear Pairings by Patrick Longa. https://eprint.iacr.org/2022/367
For correct results, the un-reduced sum of products must not exceed p•R where p
is the modulus. Given a list of pairs (a_1, b_1)..(a_k, b_k) in Montgomery form,
where each a_i < p and b_i < p, we have sum(a_i•b_i) < k•p^2 and so up to
k = floor(R/p) pairs may be safely accumulated per call.
This is implemented as a macro to abstract over const fn and boxed use cases, since the latter
needs mutable references and thus the unstable const_mut_refs feature (rust-lang/rust#57349).