pub fn mod_reduce(poly: &Polynomial, modulus: i64) -> Polynomial
The mod_reduce function performs modular reduction on a polynomial's coefficients using a specified modulus.
Each coefficient is reduced to its remainder when divided by the modulus, ensuring all coefficients fall within the range defined by the modulus.
Description
Inputs:
poly: A reference to the inputPolynomialwhose coefficients will undergo modular reduction.modulus: Ani64value representing the modulus used for reduction.
Output:
A new Polynomial object with coefficients reduced modulo the given modulus.
Use Case: Modular reduction is widely used in cryptographic operations to ensure coefficients remain within a finite field, preventing overflow and maintaining consistency in polynomial computations.