Added PrepareScratchSpace trait

This commit is contained in:
Jean-Philippe Bossuat
2025-10-09 17:07:53 +02:00
parent 8eafcaff1f
commit 2884935a38
11 changed files with 114 additions and 16 deletions

View File

@@ -5,7 +5,7 @@ use poulpy_hal::{
use crate::layouts::{
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWESwitchingKey, GLWEInfos, LWEInfos, Rank, TorusPrecision,
prepared::{GGLWECiphertextPrepared, Prepare, PrepareAlloc},
prepared::{GGLWECiphertextPrepared, Prepare, PrepareAlloc, PrepareScratchSpace},
};
#[derive(PartialEq, Eq)]
@@ -115,6 +115,15 @@ impl<B: Backend> GGLWESwitchingKeyPrepared<Vec<u8>, B> {
}
}
impl<DR: DataRef, B: Backend, A: GGLWEInfos> PrepareScratchSpace<B, A> for GGLWESwitchingKeyPrepared<DR, B>
where
GGLWECiphertextPrepared<DR, B>: PrepareScratchSpace<B, A>,
{
fn prepare_scratch_space(&self, module: &Module<B>, infos: &A) -> usize {
self.key.prepare_scratch_space(module, infos)
}
}
impl<D: DataMut, DR: DataRef, B: Backend> Prepare<B, GGLWESwitchingKey<DR>> for GGLWESwitchingKeyPrepared<D, B>
where
Module<B>: VmpPrepare<B>,