mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
Add Zn type
This commit is contained in:
@@ -9,13 +9,12 @@ use poulpy_hal::{
|
||||
use crate::layouts::{GLWECiphertext, GLWEPlaintext, Infos, prepared::GLWESecretPrepared};
|
||||
|
||||
impl GLWECiphertext<Vec<u8>> {
|
||||
pub fn decrypt_scratch_space<B: Backend>(module: &Module<B>, n: usize, basek: usize, k: usize) -> usize
|
||||
pub fn decrypt_scratch_space<B: Backend>(module: &Module<B>, basek: usize, k: usize) -> usize
|
||||
where
|
||||
Module<B>: VecZnxDftAllocBytes + VecZnxNormalizeTmpBytes + VecZnxDftAllocBytes,
|
||||
{
|
||||
let size: usize = k.div_ceil(basek);
|
||||
(module.vec_znx_normalize_tmp_bytes(n) | module.vec_znx_dft_alloc_bytes(n, 1, size))
|
||||
+ module.vec_znx_dft_alloc_bytes(n, 1, size)
|
||||
(module.vec_znx_normalize_tmp_bytes() | module.vec_znx_dft_alloc_bytes(1, size)) + module.vec_znx_dft_alloc_bytes(1, size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use poulpy_hal::{
|
||||
api::{ScratchOwnedAlloc, ScratchOwnedBorrow, VecZnxNormalizeInplace, ZnxView, ZnxViewMut},
|
||||
api::{ScratchOwnedAlloc, ScratchOwnedBorrow, ZnNormalizeInplace, ZnxView, ZnxViewMut},
|
||||
layouts::{Backend, DataMut, DataRef, Module, ScratchOwned},
|
||||
oep::{ScratchOwnedAllocImpl, ScratchOwnedBorrowImpl},
|
||||
};
|
||||
@@ -14,7 +14,7 @@ where
|
||||
where
|
||||
DataPt: DataMut,
|
||||
DataSk: DataRef,
|
||||
Module<B>: VecZnxNormalizeInplace<B>,
|
||||
Module<B>: ZnNormalizeInplace<B>,
|
||||
B: Backend + ScratchOwnedAllocImpl<B> + ScratchOwnedBorrowImpl<B>,
|
||||
{
|
||||
#[cfg(debug_assertions)]
|
||||
@@ -30,7 +30,8 @@ where
|
||||
.map(|(x, y)| x * y)
|
||||
.sum::<i64>();
|
||||
});
|
||||
module.vec_znx_normalize_inplace(
|
||||
module.zn_normalize_inplace(
|
||||
pt.n(),
|
||||
self.basek(),
|
||||
&mut pt.data,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user