@@ -21,7 +21,7 @@ fn mod_mul(a: i64, b: i64, p: i64) -> i64 {
2121///
2222/// # Returns
2323/// The result of the exponentiation modulo `p`.
24- pub fn mod_exp ( mut base : i64 , mut exp : i64 , p : i64 ) -> i64 {
24+ fn mod_exp ( mut base : i64 , mut exp : i64 , p : i64 ) -> i64 {
2525 let mut result = 1 ;
2626 base %= p;
2727 while exp > 0 {
@@ -72,15 +72,16 @@ fn mod_inv(a: i64, modulus: i64) -> i64 {
7272/// # Examples
7373///
7474/// ```
75- /// // For modulus = 17^2 = 289 and n = 8 , we compute an 8th root of unity.
75+ /// // For modulus = 17^2 = 289, we compute and verify an 8th root of unity.
7676/// let modulus = 17 * 17;
7777/// let n = 8;
78- ///
79- /// // Compute the omega for the given modulus and order.
8078/// let omega = ntt::omega(modulus, n);
81- ///
82- /// // Verify that omega^n is congruent to 1 modulo modulus.
83- /// assert_eq!(ntt::mod_exp(omega, n as i64, modulus), 1);
79+ /// assert!(ntt::verify_root_of_unity(omega,n.try_into().unwrap(),modulus));
80+ ///
81+ /// // For modulus = 17*41*73, we compute and verify an 8th root of unity.
82+ /// let modulus = 17*41*73;
83+ /// let omega = ntt::omega(modulus, n);
84+ /// assert!(ntt::verify_root_of_unity(omega,n.try_into().unwrap(),modulus));
8485/// ```
8586pub fn omega ( modulus : i64 , n : usize ) -> i64 {
8687 let factors = factorize ( modulus as i64 ) ;
0 commit comments