mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
fmt
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
use math::ring::Ring;
|
||||
use math::modulus::prime::Prime;
|
||||
use math::dft::ntt::Table;
|
||||
use math::modulus::prime::Prime;
|
||||
use math::ring::Ring;
|
||||
|
||||
fn main() {
|
||||
// Example usage of `Prime<u64>`
|
||||
let q_base: u64 = 65537; // Example prime base
|
||||
let q_power: usize = 1; // Example power
|
||||
let q_base: u64 = 65537; // Example prime base
|
||||
let q_power: usize = 1; // Example power
|
||||
let prime_instance: Prime<u64> = Prime::<u64>::new(q_base, q_power);
|
||||
|
||||
|
||||
// Display the fields of `Prime` to verify
|
||||
println!("Prime instance created:");
|
||||
println!("q: {}", prime_instance.q());
|
||||
@@ -15,13 +15,13 @@ fn main() {
|
||||
println!("q_power: {}", prime_instance.q_power());
|
||||
|
||||
let n: u64 = 32;
|
||||
let nth_root: u64 = n<<1;
|
||||
let nth_root: u64 = n << 1;
|
||||
|
||||
let ntt_table: Table<u64> = Table::<u64>::new(prime_instance, nth_root);
|
||||
|
||||
let mut a: Vec<u64> = vec![0; (nth_root >> 1) as usize];
|
||||
|
||||
for i in 0..a.len(){
|
||||
for i in 0..a.len() {
|
||||
a[i] = i as u64;
|
||||
}
|
||||
|
||||
@@ -35,17 +35,16 @@ fn main() {
|
||||
|
||||
println!("{:?}", a);
|
||||
|
||||
let r : Ring<u64> = Ring::<u64>::new(n as usize, q_base, q_power);
|
||||
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(){
|
||||
for i in 0..p0.n() {
|
||||
p0.0[i] = i as u64
|
||||
}
|
||||
|
||||
r.automorphism(p0, (2*r.n-1) as u64, &mut p1);
|
||||
r.automorphism(p0, (2 * r.n - 1) as u64, &mut p1);
|
||||
|
||||
println!("{:?}", p1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user