Auto stash before merge of "dev_bdd_selector" and "origin/dev_bdd_selector"
Pro7ech jeanphilippe.bossuat@gmail.com
Sun, 26 Oct 2025 17:31:07 +0100
2 files changed,
14 insertions(+),
5 deletions(-)
M
poulpy-core/src/operations/glwe.rs
→
poulpy-core/src/operations/glwe.rs
@@ -1,17 +1,25 @@
use poulpy_hal::{ api::{ - ModuleN, VecZnxAdd, VecZnxAddInplace, VecZnxCopy, VecZnxMulXpMinusOne, VecZnxMulXpMinusOneInplace, VecZnxNegateInplace, - VecZnxNormalize, VecZnxNormalizeInplace, VecZnxRotate, VecZnxRotateInplace, VecZnxRshInplace, VecZnxSub, - VecZnxSubInplace, VecZnxSubNegateInplace, VecZnxZero, + Convolution, ModuleN, VecZnxAdd, VecZnxAddInplace, VecZnxCopy, VecZnxMulXpMinusOne, VecZnxMulXpMinusOneInplace, VecZnxNegateInplace, VecZnxNormalize, VecZnxNormalizeInplace, VecZnxRotate, VecZnxRotateInplace, VecZnxRshInplace, VecZnxSub, VecZnxSubInplace, VecZnxSubNegateInplace, VecZnxZero }, layouts::{Backend, Module, Scratch, VecZnx, ZnxZero}, reference::vec_znx::vec_znx_rotate_inplace_tmp_bytes, }; use crate::{ - ScratchTakeCore, - layouts::{GLWE, GLWEInfos, GLWEToMut, GLWEToRef, LWEInfos, SetGLWEInfos, TorusPrecision}, + layouts::{GLWEInfos, GLWETensor, GLWETensorToMut, GLWEToMut, GLWEToRef, LWEInfos, SetGLWEInfos, TorusPrecision, GLWE}, ScratchTakeCore }; + +pub trait GLWETensoring<BE: Backend> where Self: Convolution<BE>, Scratch<BE>: ScratchTakeCore<BE> { + fn glwe_tensor<R, A, B>(&self, res: &mut R, res_scale: i64, a: &A, b: &B, scratch: &mut Scratch<BE>) where R: GLWETensorToMut, A: GLWEToRef, B: GLWEToRef{ + + let res: &mut GLWETensor<&mut [u8]> = &mut res.to_mut(); + let a: &mut GLWE<&[u8]> = &mut a.to_ref(); + let b: &GLWE<&[u8]> = &b.to_ref(); + + self.bivariate_convolution(res.data_mut(), res_scale, a, b, scratch); + } +} pub trait GLWEAdd where
M
poulpy-hal/src/api/convolution.rs
→
poulpy-hal/src/api/convolution.rs
@@ -123,6 +123,7 @@ self.svp_prepare(&mut ppol, 0, &a.as_scalar_znx_ref(a_col, a_limb), 0);
self.svp_apply_dft_to_dft(&mut res_tmp, 0, &ppol, 0, b, b_col); self.vec_znx_dft_add_scaled_inplace(res, res_col, &res_tmp, 0, -(1 + a_limb as i64) + k); } + } fn bivariate_convolution_single<R, A, B>(