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

@@ -78,13 +78,7 @@ where
let dsize: usize = res.dsize().into();
let (mut pt, scratch_1) = scratch.take_glwe_plaintext(res);
pt.data_mut().zero();
self.vec_znx_add_scalar_inplace(
&mut pt.data,
0,
(dsize - 1) + res_row * dsize,
pt_want,
res_col,
);
self.vec_znx_add_scalar_inplace(&mut pt.data, 0, (dsize - 1) + res_row * dsize, pt_want, res_col);
self.glwe_noise(&res.at(res_row, res_col), &pt, sk_prepared, scratch_1)
}
}

View File

@@ -102,7 +102,7 @@ where
self.vec_znx_dft_apply(1, 0, &mut pt_dft, 0, &pt.data, 0);
self.svp_apply_dft_to_dft_inplace(&mut pt_dft, 0, &sk_prepared.data, res_col - 1);
let pt_big = self.vec_znx_idft_apply_consume(pt_dft);
self.vec_znx_big_normalize(base2k, &mut pt.data, 0, base2k, &pt_big, 0, scratch_2);
self.vec_znx_big_normalize(&mut pt.data, base2k, 0, 0, &pt_big, base2k, 0, scratch_2);
}
self.glwe_noise(&res.at(res_row, res_col), &pt, sk_prepared, scratch_1)

View File

@@ -38,10 +38,7 @@ where
where
A: GLWEInfos,
{
GLWEPlaintext::bytes_of_from_infos(infos)
+ self
.glwe_normalize_tmp_bytes()
.max(self.glwe_decrypt_tmp_bytes(infos))
GLWEPlaintext::bytes_of_from_infos(infos) + self.glwe_normalize_tmp_bytes().max(self.glwe_decrypt_tmp_bytes(infos))
}
fn glwe_noise<R, P, S>(&self, res: &R, pt_want: &P, sk_prepared: &S, scratch: &mut Scratch<BE>) -> Stats