arnaucube
arnaucube/poulpyPublic Self-hosted repository
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
commit

6e9cef5ecd69dc28c6777e86e36cffa7ace53a88

parent

f2a29f31fa07ae16e12d4781c710b17728e6b1ff

2 files changed, 14 insertions(+), 5 deletions(-)

jump to
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>(