mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
wip
This commit is contained in:
@@ -8,9 +8,9 @@ use poulpy_hal::{
|
||||
oep::{ScratchOwnedAllocImpl, ScratchOwnedBorrowImpl, TakeVecZnxBigImpl, TakeVecZnxDftImpl},
|
||||
};
|
||||
|
||||
use crate::layouts::{GLWECiphertext, GLWEPlaintext, LWEInfos, prepared::GLWESecretPrepared};
|
||||
use crate::layouts::{GLWE, GLWEPlaintext, LWEInfos, prepared::GLWESecretPrepared};
|
||||
|
||||
impl<D: DataRef> GLWECiphertext<D> {
|
||||
impl<D: DataRef> GLWE<D> {
|
||||
pub fn noise<B, DataSk, DataPt>(
|
||||
&self,
|
||||
module: &Module<B>,
|
||||
@@ -32,7 +32,7 @@ impl<D: DataRef> GLWECiphertext<D> {
|
||||
+ VecZnxBigNormalize<B>,
|
||||
Scratch<B>: TakeVecZnxDft<B> + TakeVecZnxBig<B>,
|
||||
{
|
||||
let mut pt_have: GLWEPlaintext<Vec<u8>> = GLWEPlaintext::alloc(self);
|
||||
let mut pt_have: GLWEPlaintext<Vec<u8>> = GLWEPlaintext::alloc_from_infos(self);
|
||||
self.decrypt(module, &mut pt_have, sk_prepared, scratch);
|
||||
module.vec_znx_sub_inplace(&mut pt_have.data, 0, &pt_want.data, 0);
|
||||
module.vec_znx_normalize_inplace(self.base2k().into(), &mut pt_have.data, 0, scratch);
|
||||
@@ -61,7 +61,7 @@ impl<D: DataRef> GLWECiphertext<D> {
|
||||
+ VecZnxNormalizeInplace<B>,
|
||||
B: Backend + TakeVecZnxDftImpl<B> + TakeVecZnxBigImpl<B> + ScratchOwnedAllocImpl<B> + ScratchOwnedBorrowImpl<B>,
|
||||
{
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GLWECiphertext::decrypt_scratch_space(module, self));
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GLWE::decrypt_scratch_space(module, self));
|
||||
let noise_have: f64 = self.noise(module, sk_prepared, pt_want, scratch.borrow());
|
||||
assert!(noise_have <= max_noise, "{noise_have} {max_noise}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user