AutomorphismPermutation -> AutoPerm
Jean-Philippe Bossuat jeanphilippe.bossuat@gmail.com
Thu, 16 Jan 2025 11:10:58 +0100
3 files changed,
9 insertions(+),
9 deletions(-)
M
math/src/automorphism.rs
→
math/src/automorphism.rs
@@ -1,11 +1,11 @@
use crate::modulus::WordOps; -pub struct AutomorphismPermutation { +pub struct AutoPerm { pub gal_el: usize, pub permutation: Vec<usize>, } -impl AutomorphismPermutation { +impl AutoPerm { /// Returns a lookup table for the automorphism X^{i} -> X^{i * k mod nth_root}. /// Method will panic if n or nth_root are not power-of-two. /// Method will panic if gal_el is not coprime with nth_root.
M
math/src/ring/impl_u64/automorphism.rs
→
math/src/ring/impl_u64/automorphism.rs
@@ -1,4 +1,4 @@
-use crate::automorphism::AutomorphismPermutation; +use crate::automorphism::AutoPerm; use crate::modulus::{ScalarOperations, ONCE}; use crate::modulus::{WordOps, REDUCEMOD}; use crate::poly::Poly;@@ -118,7 +118,7 @@ // b <- auto(a)
pub fn a_apply_automorphism_from_perm_into_b<const NTT: bool>( &self, a: &Poly<u64>, - auto_perm: &AutomorphismPermutation, + auto_perm: &AutoPerm, b: &mut Poly<u64>, ) { self.automorphism_from_perm_core::<0, ONCE, NTT>(a, auto_perm, b)@@ -128,7 +128,7 @@ // b <- REDUCEMOD(b + auto(a))
pub fn a_apply_automorphism_from_perm_add_b_into_b<const REDUCE: REDUCEMOD, const NTT: bool>( &self, a: &Poly<u64>, - auto_perm: &AutomorphismPermutation, + auto_perm: &AutoPerm, b: &mut Poly<u64>, ) { self.automorphism_from_perm_core::<1, REDUCE, NTT>(a, auto_perm, b)@@ -138,7 +138,7 @@ // b <- REDUCEMOD(b - auto(a))
pub fn a_apply_automorphism_from_perm_sub_b_into_b<const REDUCE: REDUCEMOD, const NTT: bool>( &self, a: &Poly<u64>, - auto_perm: &AutomorphismPermutation, + auto_perm: &AutoPerm, b: &mut Poly<u64>, ) { self.automorphism_from_perm_core::<2, REDUCE, NTT>(a, auto_perm, b)@@ -148,7 +148,7 @@ // b <- auto(a) if OVERWRITE else b <- REDUCEMOD(b + auto(a))
fn automorphism_from_perm_core<const MOD: u8, const REDUCE: REDUCEMOD, const NTT: bool>( &self, a: &Poly<u64>, - auto_perm: &AutomorphismPermutation, + auto_perm: &AutoPerm, b: &mut Poly<u64>, ) { debug_assert!(
M
math/tests/automorphism.rs
→
math/tests/automorphism.rs
@@ -1,5 +1,5 @@
use itertools::izip; -use math::automorphism::AutomorphismPermutation; +use math::automorphism::AutoPerm; use math::poly::Poly; use math::ring::Ring;@@ -79,7 +79,7 @@ }
let gal_el: usize = 2 * nth_root - 1; - let auto_perm = AutomorphismPermutation::new::<NTT>(n, gal_el, nth_root); + let auto_perm = AutoPerm::new::<NTT>(n, gal_el, nth_root); ring.a_apply_automorphism_from_perm_into_b::<NTT>(&p0, &auto_perm, &mut p1);