Expand description
Computations with polynomials modulo X^n+1 and modulo q = 12289.
§Computations modulo q = 12289
External callers should only see polynomials modulo X^n+1 and
modulo q. Such polynomials use slices of u16. There are three
distinct representations:
-
External representation: plain coefficients, in the
[0,q-1]range. -
Internal representation: plain coefficients, but with a storage convention that may differ from the external representation.
-
NTT representation: NTT format, coefficients may also have an internal range that differs from the external representation.
Appropriate functions are provided to convert between these representations.
Constants§
- SQBETA
- Maximum squared norm for “small” vectors (floor(beta^2)).
Functions§
- mqpoly_
NTT_ to_ int - Convert a polynomial from NTT to internal representation (in-place).
- mqpoly_
div_ ntt - Divide polynomial
aby polynomialb; both must be in NTT representation. - mqpoly_
div_ small - Compute
h = g/f mod X^n+1 mod q. - mqpoly_
ext_ to_ int - Given a polynomial in external representation, convert it to internal representation (in-place).
- mqpoly_
int_ to_ NTT - Convert a polynomial from internal representation to NTT (in-place).
- mqpoly_
int_ to_ ext - Given a polynomial in internal representation, convert it to external representation (in-place).
- mqpoly_
int_ to_ small - Given a polynomial in internal representation, convert it to small coefficients.
- mqpoly_
mul_ ntt - Multiply polynomial
aby polynomialb; both must be in NTT representation. - mqpoly_
signed_ to_ ext - Convert a polynomial with signed coefficients into a polynomial modulo q (external representation).
- mqpoly_
small_ is_ invertible - Check whether the provided polynomial with small coefficient is
invertible modulo
X^n+1and modulo q. - mqpoly_
small_ to_ int - Given a polynomial with small coefficients, convert it to internal representation.
- mqpoly_
sqnorm - Get the squared norm of a polynomial modulo q (assuming normalization
of coefficients in
[-q/2,+q/2]). - mqpoly_
sub_ int - Subtract polynomial
bfrom polynomiala; both must be in internal representation, or both must be in NTT representation. - signed_
poly_ sqnorm - Get the square norm of a polynomial with signed integer coefficients.