AutomorphismPermutation -> AutoPerm

This commit is contained in:
Jean-Philippe Bossuat
2025-01-16 11:10:58 +01:00
parent 8de8af8fa9
commit 7c8f2f3a63
3 changed files with 9 additions and 9 deletions

View File

@@ -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.

View File

@@ -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 @@ impl Ring<u64> {
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 @@ impl Ring<u64> {
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 @@ impl Ring<u64> {
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 @@ impl Ring<u64> {
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!(

View File

@@ -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 @@ fn test_automorphism_from_perm_u64<const NTT: bool>(ring: &Ring<u64>, nth_root:
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);