polysub function

Poly polysub(
  1. Poly a,
  2. Poly b
)

Returns a new polynomial r = a - b, i.e. for each coefficient, ri = ai - bi mod q.

Implementation

Poly polysub(Poly a, Poly b) {
  Poly r = Poly();
  for (int i = 0; i < KYBER_N; i++) {
    r.coeffs[i] = fqsub(a.coeffs[i], b.coeffs[i]);
  }
  return r;
}