Support for bivariate convolution & normalization with offset (#126)

* Add bivariate-convolution
* Add pair-wise convolution + tests + benches
* Add take_cnv_pvec_[left/right] to Scratch & updated CHANGELOG.md
* cross-base2k normalization with positive offset
* clippy & fix CI doctest avx compile error
* more streamlined bounds derivation for normalization
* Working cross-base2k normalization with pos/neg offset
* Update normalization API & tests
* Add glwe tensoring test
* Add relinearization + preliminary test
* Fix GGLWEToGGSW key infos
* Add (X,Y) convolution by const (1, Y) poly
* Faster normalization test + add bench for cnv_by_const
* Update changelog
This commit is contained in:
Jean-Philippe Bossuat
2025-12-21 16:56:42 +01:00
committed by GitHub
parent 76424d0ab5
commit 4e90e08a71
219 changed files with 6571 additions and 5041 deletions

View File

@@ -105,13 +105,13 @@ where
scratch.available(),
);
let base2k_a: usize = a.base2k().into();
let base2k_key: usize = key.base2k().into();
let base2k_res: usize = res.base2k().into();
let a_base2k: usize = a.base2k().into();
let key_base2k: usize = key.base2k().into();
let res_base2k: usize = res.base2k().into();
let (res_dft, scratch_1) = scratch.take_vec_znx_dft(self, (res.rank() + 1).into(), key.size()); // Todo optimise
let res_big: VecZnxBig<&mut [u8], BE> = if base2k_a != base2k_key {
let res_big: VecZnxBig<&mut [u8], BE> = if a_base2k != key_base2k {
let (mut a_conv, scratch_2) = scratch_1.take_glwe(&GLWELayout {
n: a.n(),
base2k: key.base2k(),
@@ -126,15 +126,7 @@ where
let res: &mut GLWE<&mut [u8]> = &mut res.to_mut();
for i in 0..(res.rank() + 1).into() {
self.vec_znx_big_normalize(
base2k_res,
res.data_mut(),
i,
base2k_key,
&res_big,
i,
scratch_1,
);
self.vec_znx_big_normalize(res.data_mut(), res_base2k, 0, i, &res_big, key_base2k, i, scratch_1);
}
}
@@ -169,12 +161,12 @@ where
scratch.available(),
);
let base2k_res: usize = res.base2k().as_usize();
let base2k_key: usize = key.base2k().as_usize();
let res_base2k: usize = res.base2k().as_usize();
let key_base2k: usize = key.base2k().as_usize();
let (res_dft, scratch_1) = scratch.take_vec_znx_dft(self, (res.rank() + 1).into(), key.size()); // Todo optimise
let res_big: VecZnxBig<&mut [u8], BE> = if base2k_res != base2k_key {
let res_big: VecZnxBig<&mut [u8], BE> = if res_base2k != key_base2k {
let (mut res_conv, scratch_2) = scratch_1.take_glwe(&GLWELayout {
n: res.n(),
base2k: key.base2k(),
@@ -190,15 +182,7 @@ where
let res: &mut GLWE<&mut [u8]> = &mut res.to_mut();
for i in 0..(res.rank() + 1).into() {
self.vec_znx_big_normalize(
base2k_res,
res.data_mut(),
i,
base2k_key,
&res_big,
i,
scratch_1,
);
self.vec_znx_big_normalize(res.data_mut(), res_base2k, 0, i, &res_big, key_base2k, i, scratch_1);
}
}
}