fixed automorphism

This commit is contained in:
Jean-Philippe Bossuat
2024-12-20 14:07:47 +01:00
parent ad68ce83cf
commit 45aebc3976
3 changed files with 19 additions and 7 deletions

View File

@@ -5,9 +5,9 @@ use math::dft::ntt::Table;
fn main() {
// Example usage of `Prime<u64>`
let q_base: u64 = 0x1fffffffffe00001; // Example prime base
let q_base: u64 = 65537; // Example prime base
let q_power: usize = 1; // Example power
let mut prime_instance: Prime<u64> = Prime::<u64>::new(q_base, q_power);
let prime_instance: Prime<u64> = Prime::<u64>::new(q_base, q_power);
// Display the fields of `Prime` to verify
println!("Prime instance created:");
@@ -15,7 +15,7 @@ fn main() {
println!("q_base: {}", prime_instance.q_base());
println!("q_power: {}", prime_instance.q_power());
let n: u64 = 1024;
let n: u64 = 32;
let nth_root: u64 = n<<1;
let ntt_table: Table<u64> = Table::<u64>::new(prime_instance, nth_root);
@@ -38,4 +38,15 @@ fn main() {
let r : Ring<u64> = Ring::<u64>::new(n as usize, q_base, q_power);
let mut p0: math::poly::Poly<u64> = r.new_poly();
let mut p1: math::poly::Poly<u64> = r.new_poly();
for i in 0..p0.n(){
p0.0[i] = i as u64
}
r.automorphism(p0, (2*r.n-1) as u64, &mut p1);
println!("{:?}", p1);
}