Index Mathematics Conjectures nbv lettuce Widgets

ext_mul

stdlib/ext/ext_mul.nbv

ext_mul(a, b)

Product of two elements of the extension, schoolbook reduced with x^D = c (dags Ext::mul): D^2 base products. Coefficient k is <a, b'> with b'_i = b_{k-i} for i <= k and c b_{k-i+D} for i > k. Works on static and witness values.

Calls
dilithium/ext/ext_degree, dilithium/ext/ext_nonresidue, inner_prod
Precompiles
assert_eq!, clone!, if_lt!, len!, loop_flat_map!
Used by
ext/ext_eq_eval, ext/ext_poly_eval, ext/ext_vec_mul, slip/slip_r1cs_arg_verify

Source

# Product of two elements of the extension, schoolbook reduced with x^D = c (dags Ext::mul):
# D^2 base products. Coefficient k is <a, b'> with b'_i = b_{k-i} for i <= k and
# c b_{k-i+D} for i > k. Works on static and witness values.
(a, b)

static d = ext_degree()
static nr = ext_nonresidue()
assert_eq! d, len! a
assert_eq! d, len! b

loop_flat_map! d, k {
  inner_prod((clone! a), loop_flat_map! d, i {
    static j = k + d - i
    static mut idx = j
    static mut w = nr
    if_lt! d - 1, j {
      idx = j - d
      w = 1
    }
    b[idx] * w
  })
}