mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Add BDD Arithmetic (#98)
* Added some circuit, evaluation + some layouts * Refactor + memory reduction * Rows -> Dnum, Digits -> Dsize * fix #96 + glwe_packing (indirectly CBT) * clippy
This commit is contained in:
committed by
GitHub
parent
37e13b965c
commit
6357a05509
@@ -1,5 +1,5 @@
|
||||
use poulpy_core::layouts::{
|
||||
Base2K, Degree, Digits, GGSWCiphertext, GGSWCiphertextLayout, GLWECiphertext, GLWECiphertextLayout, GLWESecret, Rank, Rows,
|
||||
Base2K, Degree, Dnum, Dsize, GGSWCiphertext, GGSWCiphertextLayout, GLWECiphertext, GLWECiphertextLayout, GLWESecret, Rank,
|
||||
TorusPrecision,
|
||||
prepared::{GGSWCiphertextPrepared, GLWESecretPrepared, PrepareAlloc},
|
||||
};
|
||||
@@ -35,16 +35,16 @@ fn bench_external_product_glwe_fft64(c: &mut Criterion) {
|
||||
let k_ct_out: TorusPrecision = p.k_ct_out;
|
||||
let k_ggsw: TorusPrecision = p.k_ggsw;
|
||||
let rank: Rank = p.rank;
|
||||
let digits: Digits = Digits(1);
|
||||
let dsize: Dsize = Dsize(1);
|
||||
|
||||
let rows: Rows = Rows(1); //(p.k_ct_in.div_ceil(p.base2k);
|
||||
let dnum: Dnum = Dnum(1); //(p.k_ct_in.div_ceil(p.base2k);
|
||||
|
||||
let ggsw_layout: GGSWCiphertextLayout = GGSWCiphertextLayout {
|
||||
n,
|
||||
base2k,
|
||||
k: k_ggsw,
|
||||
rows,
|
||||
digits,
|
||||
dnum: dnum,
|
||||
dsize: dsize,
|
||||
rank,
|
||||
};
|
||||
|
||||
@@ -143,16 +143,16 @@ fn bench_external_product_glwe_inplace_fft64(c: &mut Criterion) {
|
||||
let k_glwe: TorusPrecision = p.k_ct;
|
||||
let k_ggsw: TorusPrecision = p.k_ggsw;
|
||||
let rank: Rank = p.rank;
|
||||
let digits: Digits = Digits(1);
|
||||
let dsize: Dsize = Dsize(1);
|
||||
|
||||
let rows: Rows = p.k_ct.div_ceil(p.base2k).into();
|
||||
let dnum: Dnum = p.k_ct.div_ceil(p.base2k).into();
|
||||
|
||||
let ggsw_layout: GGSWCiphertextLayout = GGSWCiphertextLayout {
|
||||
n,
|
||||
base2k,
|
||||
k: k_ggsw,
|
||||
rows,
|
||||
digits,
|
||||
dnum: dnum,
|
||||
dsize: dsize,
|
||||
rank,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use poulpy_core::layouts::{
|
||||
Base2K, Degree, Digits, GGLWEAutomorphismKey, GGLWEAutomorphismKeyLayout, GGLWESwitchingKey, GGLWESwitchingKeyLayout,
|
||||
GLWECiphertext, GLWECiphertextLayout, GLWESecret, Rank, Rows, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGLWEAutomorphismKey, GGLWEAutomorphismKeyLayout, GGLWESwitchingKey, GGLWESwitchingKeyLayout,
|
||||
GLWECiphertext, GLWECiphertextLayout, GLWESecret, Rank, TorusPrecision,
|
||||
prepared::{GGLWEAutomorphismKeyPrepared, GGLWESwitchingKeyPrepared, GLWESecretPrepared, PrepareAlloc},
|
||||
};
|
||||
use std::{hint::black_box, time::Duration};
|
||||
@@ -22,7 +22,7 @@ fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
||||
k_ct_in: TorusPrecision,
|
||||
k_ct_out: TorusPrecision,
|
||||
k_ksk: TorusPrecision,
|
||||
digits: Digits,
|
||||
dsize: Dsize,
|
||||
rank: Rank,
|
||||
}
|
||||
|
||||
@@ -35,17 +35,17 @@ fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
||||
let k_glwe_out: TorusPrecision = p.k_ct_out;
|
||||
let k_gglwe: TorusPrecision = p.k_ksk;
|
||||
let rank: Rank = p.rank;
|
||||
let digits: Digits = p.digits;
|
||||
let dsize: Dsize = p.dsize;
|
||||
|
||||
let rows: Rows = p.k_ct_in.div_ceil(p.base2k.0 * digits.0).into();
|
||||
let dnum: Dnum = p.k_ct_in.div_ceil(p.base2k.0 * dsize.0).into();
|
||||
|
||||
let gglwe_atk_layout: GGLWEAutomorphismKeyLayout = GGLWEAutomorphismKeyLayout {
|
||||
n,
|
||||
base2k,
|
||||
k: k_gglwe,
|
||||
rows,
|
||||
dnum,
|
||||
rank,
|
||||
digits,
|
||||
dsize,
|
||||
};
|
||||
|
||||
let glwe_in_layout: GLWECiphertextLayout = GLWECiphertextLayout {
|
||||
@@ -111,15 +111,15 @@ fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
||||
}
|
||||
|
||||
let base2k: usize = 19;
|
||||
let digits = 1;
|
||||
let dsize = 1;
|
||||
|
||||
let params_set: Vec<Params> = vec![Params {
|
||||
log_n: 15,
|
||||
base2k: base2k.into(),
|
||||
k_ct_in: (874 - digits * base2k).into(),
|
||||
k_ct_out: (874 - digits * base2k).into(),
|
||||
k_ct_in: (874 - dsize * base2k).into(),
|
||||
k_ct_out: (874 - dsize * base2k).into(),
|
||||
k_ksk: 874_u32.into(),
|
||||
digits: 1_u32.into(),
|
||||
dsize: 1_u32.into(),
|
||||
rank: 1_u32.into(),
|
||||
}];
|
||||
|
||||
@@ -153,16 +153,16 @@ fn bench_keyswitch_glwe_inplace_fft64(c: &mut Criterion) {
|
||||
let k_ct: TorusPrecision = p.k_ct;
|
||||
let k_ksk: TorusPrecision = p.k_ksk;
|
||||
let rank: Rank = p.rank;
|
||||
let digits: Digits = Digits(1);
|
||||
let dsize: Dsize = Dsize(1);
|
||||
|
||||
let rows: Rows = p.k_ct.div_ceil(p.base2k).into();
|
||||
let dnum: Dnum = p.k_ct.div_ceil(p.base2k).into();
|
||||
|
||||
let gglwe_layout: GGLWESwitchingKeyLayout = GGLWESwitchingKeyLayout {
|
||||
n,
|
||||
base2k,
|
||||
k: k_ksk,
|
||||
rows,
|
||||
digits,
|
||||
dnum,
|
||||
dsize,
|
||||
rank_in: rank,
|
||||
rank_out: rank,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user