mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Auto stash before merge of "dev_bdd_selector" and "origin/dev_bdd_selector"
This commit is contained in:
@@ -1,18 +1,26 @@
|
|||||||
use poulpy_hal::{
|
use poulpy_hal::{
|
||||||
api::{
|
api::{
|
||||||
ModuleN, VecZnxAdd, VecZnxAddInplace, VecZnxCopy, VecZnxMulXpMinusOne, VecZnxMulXpMinusOneInplace, VecZnxNegateInplace,
|
Convolution, ModuleN, VecZnxAdd, VecZnxAddInplace, VecZnxCopy, VecZnxMulXpMinusOne, VecZnxMulXpMinusOneInplace, VecZnxNegateInplace, VecZnxNormalize, VecZnxNormalizeInplace, VecZnxRotate, VecZnxRotateInplace, VecZnxRshInplace, VecZnxSub, VecZnxSubInplace, VecZnxSubNegateInplace, VecZnxZero
|
||||||
VecZnxNormalize, VecZnxNormalizeInplace, VecZnxRotate, VecZnxRotateInplace, VecZnxRshInplace, VecZnxSub,
|
|
||||||
VecZnxSubInplace, VecZnxSubNegateInplace, VecZnxZero,
|
|
||||||
},
|
},
|
||||||
layouts::{Backend, Module, Scratch, VecZnx, ZnxZero},
|
layouts::{Backend, Module, Scratch, VecZnx, ZnxZero},
|
||||||
reference::vec_znx::vec_znx_rotate_inplace_tmp_bytes,
|
reference::vec_znx::vec_znx_rotate_inplace_tmp_bytes,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ScratchTakeCore,
|
layouts::{GLWEInfos, GLWETensor, GLWETensorToMut, GLWEToMut, GLWEToRef, LWEInfos, SetGLWEInfos, TorusPrecision, GLWE}, ScratchTakeCore
|
||||||
layouts::{GLWE, GLWEInfos, GLWEToMut, GLWEToRef, LWEInfos, SetGLWEInfos, TorusPrecision},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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
|
pub trait GLWEAdd
|
||||||
where
|
where
|
||||||
Self: ModuleN + VecZnxAdd + VecZnxCopy + VecZnxAddInplace,
|
Self: ModuleN + VecZnxAdd + VecZnxCopy + VecZnxAddInplace,
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ where
|
|||||||
self.svp_apply_dft_to_dft(&mut res_tmp, 0, &ppol, 0, b, b_col);
|
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);
|
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>(
|
fn bivariate_convolution_single<R, A, B>(
|
||||||
|
|||||||
Reference in New Issue
Block a user