mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
removed prints
This commit is contained in:
@@ -214,7 +214,6 @@ pub fn reim_to_znx_i64_inplace_bnd63_avx2_fma(res: &mut [f64], divisor: f64) {
|
|||||||
reim_to_znx_i64_inplace_ref(&mut res[span << 2..], divisor)
|
reim_to_znx_i64_inplace_ref(&mut res[span << 2..], divisor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Correctness
|
/// # Correctness
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ impl<D: DataRef> GGSWCiphertext<D> {
|
|||||||
|
|
||||||
let std_pt: f64 = pt_have.data.std(basek, 0).log2();
|
let std_pt: f64 = pt_have.data.std(basek, 0).log2();
|
||||||
let noise: f64 = max_noise(col_j);
|
let noise: f64 = max_noise(col_j);
|
||||||
println!("{} {}", std_pt, noise);
|
|
||||||
assert!(std_pt <= noise, "{} > {}", std_pt, noise);
|
assert!(std_pt <= noise, "{} > {}", std_pt, noise);
|
||||||
|
|
||||||
pt.data.zero();
|
pt.data.zero();
|
||||||
|
|||||||
@@ -256,10 +256,7 @@ where
|
|||||||
let p1: i64 = -5;
|
let p1: i64 = -5;
|
||||||
(1..3).for_each(|rank| {
|
(1..3).for_each(|rank| {
|
||||||
(1..digits + 1).for_each(|di| {
|
(1..digits + 1).for_each(|di| {
|
||||||
println!(
|
|
||||||
"test_gglwe_automorphism_key_automorphism_inplace: {} rank: {}",
|
|
||||||
di, rank
|
|
||||||
);
|
|
||||||
let k_apply: usize = (digits + di) * basek;
|
let k_apply: usize = (digits + di) * basek;
|
||||||
|
|
||||||
let n: usize = module.n();
|
let n: usize = module.n();
|
||||||
|
|||||||
@@ -201,10 +201,6 @@ where
|
|||||||
(1..4).for_each(|rank| {
|
(1..4).for_each(|rank| {
|
||||||
(1..digits + 1).for_each(|di| {
|
(1..digits + 1).for_each(|di| {
|
||||||
let k_ksk: usize = k_ct + basek * di;
|
let k_ksk: usize = k_ct + basek * di;
|
||||||
println!(
|
|
||||||
"test_glwe_automorphism_inplace digits: {} rank: {}",
|
|
||||||
di, rank
|
|
||||||
);
|
|
||||||
|
|
||||||
let n: usize = module.n();
|
let n: usize = module.n();
|
||||||
let rows: usize = k_ct.div_ceil(basek * digits);
|
let rows: usize = k_ct.div_ceil(basek * digits);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ where
|
|||||||
(1..3).for_each(|rank| {
|
(1..3).for_each(|rank| {
|
||||||
(1..digits + 1).for_each(|di| {
|
(1..digits + 1).for_each(|di| {
|
||||||
let k_ggsw: usize = k_in + basek * di;
|
let k_ggsw: usize = k_in + basek * di;
|
||||||
println!("test external_product digits: {} ranks: {}", di, rank);
|
|
||||||
let k_out: usize = k_in; // Better capture noise.
|
let k_out: usize = k_in; // Better capture noise.
|
||||||
|
|
||||||
let n: usize = module.n();
|
let n: usize = module.n();
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ where
|
|||||||
pt.sub_inplace_ab(module, &pt_want);
|
pt.sub_inplace_ab(module, &pt_want);
|
||||||
|
|
||||||
let noise_have: f64 = pt.std().log2();
|
let noise_have: f64 = pt.std().log2();
|
||||||
// println!("noise_have: {}", noise_have);
|
|
||||||
assert!(
|
assert!(
|
||||||
noise_have < -((k_ct - basek) as f64),
|
noise_have < -((k_ct - basek) as f64),
|
||||||
"noise: {}",
|
"noise: {}",
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ pub fn reim4_vec_mat1col_product_ref(
|
|||||||
assert!(v.len() >= nrows * 8, "v must be at least nrows * 8 doubles");
|
assert!(v.len() >= nrows * 8, "v must be at least nrows * 8 doubles");
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("u_ref: {:?}", &u[..nrows * 8]);
|
|
||||||
println!("v_ref: {:?}", &v[..nrows * 8]);
|
|
||||||
|
|
||||||
let mut acc: [f64; 8] = [0f64; 8];
|
let mut acc: [f64; 8] = [0f64; 8];
|
||||||
let mut j = 0;
|
let mut j = 0;
|
||||||
for _ in 0..nrows {
|
for _ in 0..nrows {
|
||||||
@@ -123,8 +120,6 @@ pub fn reim4_vec_mat1col_product_ref(
|
|||||||
}
|
}
|
||||||
dst[0..8].copy_from_slice(&acc);
|
dst[0..8].copy_from_slice(&acc);
|
||||||
|
|
||||||
println!("dst_ref: {:?}", &dst[..8]);
|
|
||||||
println!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|||||||
@@ -206,9 +206,6 @@ where
|
|||||||
let res_big_ref: crate::layouts::VecZnxBig<Vec<u8>, BR> = module_ref.vec_znx_idft_apply_consume(res_dft_ref);
|
let res_big_ref: crate::layouts::VecZnxBig<Vec<u8>, BR> = module_ref.vec_znx_idft_apply_consume(res_dft_ref);
|
||||||
let res_big_test: crate::layouts::VecZnxBig<Vec<u8>, BT> = module_test.vec_znx_idft_apply_consume(res_dft_test);
|
let res_big_test: crate::layouts::VecZnxBig<Vec<u8>, BT> = module_test.vec_znx_idft_apply_consume(res_dft_test);
|
||||||
|
|
||||||
println!("res_big_ref: {}", res_big_ref);
|
|
||||||
println!("res_big_test: {}", res_big_test);
|
|
||||||
|
|
||||||
let mut res_ref: VecZnx<Vec<u8>> = VecZnx::alloc(n, cols, res_size);
|
let mut res_ref: VecZnx<Vec<u8>> = VecZnx::alloc(n, cols, res_size);
|
||||||
let mut res_test: VecZnx<Vec<u8>> = VecZnx::alloc(n, cols, res_size);
|
let mut res_test: VecZnx<Vec<u8>> = VecZnx::alloc(n, cols, res_size);
|
||||||
|
|
||||||
@@ -462,8 +459,7 @@ pub fn test_svp_apply_dft_to_dft_inplace<BR: Backend, BT: Backend>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("res_ref: {}", res_ref);
|
|
||||||
println!("res_test: {}", res_test);
|
|
||||||
|
|
||||||
assert_eq!(res_ref, res_test);
|
assert_eq!(res_ref, res_test);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use poulpy_hal::{
|
|||||||
source::Source,
|
source::Source,
|
||||||
};
|
};
|
||||||
|
|
||||||
use poulpy_backend::cpu_spqlios::FFT64Spqlios;
|
use poulpy_backend::{FFT64Avx};
|
||||||
|
|
||||||
use poulpy_schemes::tfhe::{
|
use poulpy_schemes::tfhe::{
|
||||||
blind_rotation::CGGI,
|
blind_rotation::CGGI,
|
||||||
@@ -27,7 +27,7 @@ fn main() {
|
|||||||
let n_glwe: usize = 1024;
|
let n_glwe: usize = 1024;
|
||||||
|
|
||||||
// Module provides access to the backend arithmetic
|
// Module provides access to the backend arithmetic
|
||||||
let module: Module<FFT64Spqlios> = Module::<FFT64Spqlios>::new(n_glwe as u64);
|
let module: Module<FFT64Avx> = Module::<FFT64Avx>::new(n_glwe as u64);
|
||||||
|
|
||||||
// Base 2 loga
|
// Base 2 loga
|
||||||
let basek: usize = 13;
|
let basek: usize = 13;
|
||||||
@@ -75,7 +75,7 @@ fn main() {
|
|||||||
let k_tsk: usize = (rows_tsk + 1) * basek;
|
let k_tsk: usize = (rows_tsk + 1) * basek;
|
||||||
|
|
||||||
// Scratch space (4MB)
|
// Scratch space (4MB)
|
||||||
let mut scratch: ScratchOwned<FFT64Spqlios> = ScratchOwned::alloc(1 << 22);
|
let mut scratch: ScratchOwned<FFT64Avx> = ScratchOwned::alloc(1 << 22);
|
||||||
|
|
||||||
// Secret key sampling source
|
// Secret key sampling source
|
||||||
let mut source_xs: Source = Source::new([1u8; 32]);
|
let mut source_xs: Source = Source::new([1u8; 32]);
|
||||||
@@ -97,7 +97,7 @@ fn main() {
|
|||||||
// sk_glwe.fill_zero();
|
// sk_glwe.fill_zero();
|
||||||
|
|
||||||
// GLWE secret prepared (opaque backend dependant write only struct)
|
// GLWE secret prepared (opaque backend dependant write only struct)
|
||||||
let sk_glwe_prepared: GLWESecretPrepared<Vec<u8>, FFT64Spqlios> = sk_glwe.prepare_alloc(&module, scratch.borrow());
|
let sk_glwe_prepared: GLWESecretPrepared<Vec<u8>, FFT64Avx> = sk_glwe.prepare_alloc(&module, scratch.borrow());
|
||||||
|
|
||||||
// Plaintext value to circuit bootstrap
|
// Plaintext value to circuit bootstrap
|
||||||
let data: i64 = 1 % (1 << k_lwe_pt);
|
let data: i64 = 1 % (1 << k_lwe_pt);
|
||||||
@@ -142,7 +142,7 @@ fn main() {
|
|||||||
let mut res: GGSWCiphertext<Vec<u8>> = GGSWCiphertext::alloc(n_glwe, basek, k_ggsw_res, rows_ggsw_res, 1, rank);
|
let mut res: GGSWCiphertext<Vec<u8>> = GGSWCiphertext::alloc(n_glwe, basek, k_ggsw_res, rows_ggsw_res, 1, rank);
|
||||||
|
|
||||||
// Circuit bootstrapping key prepared (opaque backend dependant write only struct)
|
// Circuit bootstrapping key prepared (opaque backend dependant write only struct)
|
||||||
let cbt_prepared: CircuitBootstrappingKeyPrepared<Vec<u8>, CGGI, FFT64Spqlios> =
|
let cbt_prepared: CircuitBootstrappingKeyPrepared<Vec<u8>, CGGI, FFT64Avx> =
|
||||||
cbt_key.prepare_alloc(&module, scratch.borrow());
|
cbt_key.prepare_alloc(&module, scratch.borrow());
|
||||||
|
|
||||||
// Apply circuit bootstrapping: LWE(data * 2^{- (k_lwe_pt + 2)}) -> GGSW(data)
|
// Apply circuit bootstrapping: LWE(data * 2^{- (k_lwe_pt + 2)}) -> GGSW(data)
|
||||||
@@ -194,7 +194,7 @@ fn main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Prepare GGSW output of circuit bootstrapping (opaque backend dependant write only struct)
|
// Prepare GGSW output of circuit bootstrapping (opaque backend dependant write only struct)
|
||||||
let res_prepared: GGSWCiphertextPrepared<Vec<u8>, FFT64Spqlios> = res.prepare_alloc(&module, scratch.borrow());
|
let res_prepared: GGSWCiphertextPrepared<Vec<u8>, FFT64Avx> = res.prepare_alloc(&module, scratch.borrow());
|
||||||
|
|
||||||
// Apply GLWE x GGSW
|
// Apply GLWE x GGSW
|
||||||
ct_glwe.external_product_inplace(&module, &res_prepared, scratch.borrow());
|
ct_glwe.external_product_inplace(&module, &res_prepared, scratch.borrow());
|
||||||
|
|||||||
Reference in New Issue
Block a user