Traits reduction, file + structs renaming

This commit is contained in:
Pro7ech
2025-10-21 10:17:52 +02:00
parent 77b49ea530
commit db3b20b8f6
106 changed files with 1026 additions and 1108 deletions

View File

@@ -3,11 +3,50 @@ use poulpy_hal::layouts::{Backend, DataMut, Module, Scratch, ZnxZero};
use crate::{
GLWEExternalProduct, ScratchTakeCore,
layouts::{
GGLWE, GGLWEInfos, GGLWEToMut, GGLWEToRef, GGSWInfos, GLWEInfos, GLWESwitchingKey,
prepared::{GGSWPrepared, GGSWPreparedToRef},
AutomorphismKey, GGLWE, GGLWEInfos, GGLWEToMut, GGLWEToRef, GGSWInfos, GGSWPrepared, GLWEInfos, GLWESwitchingKey,
prepared::GGSWPreparedToRef,
},
};
impl AutomorphismKey<Vec<u8>> {
pub fn external_product_tmp_bytes<R, A, B, M, BE: Backend>(
&self,
module: &M,
res_infos: &R,
a_infos: &A,
b_infos: &B,
) -> usize
where
R: GGLWEInfos,
A: GGLWEInfos,
B: GGSWInfos,
M: GGLWEExternalProduct<BE>,
{
module.gglwe_external_product_tmp_bytes(res_infos, a_infos, b_infos)
}
}
impl<DataSelf: DataMut> AutomorphismKey<DataSelf> {
pub fn external_product<A, B, M, BE: Backend>(&mut self, module: &M, a: &A, b: &B, scratch: &mut Scratch<BE>)
where
M: GGLWEExternalProduct<BE>,
A: GGLWEToRef,
B: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product(self, a, b, scratch);
}
pub fn external_product_inplace<A, M, BE: Backend>(&mut self, module: &M, a: &A, scratch: &mut Scratch<BE>)
where
M: GGLWEExternalProduct<BE>,
A: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product_inplace(self, a, scratch);
}
}
pub trait GGLWEExternalProduct<BE: Backend>
where
Self: GLWEExternalProduct<BE>,

View File

@@ -1,46 +0,0 @@
use poulpy_hal::layouts::{Backend, DataMut, Scratch};
use crate::{
ScratchTakeCore,
external_product::gglwe_ksk::GGLWEExternalProduct,
layouts::{AutomorphismKey, GGLWEInfos, GGLWEToRef, GGSWInfos, prepared::GGSWPreparedToRef},
};
impl AutomorphismKey<Vec<u8>> {
pub fn external_product_tmp_bytes<R, A, B, M, BE: Backend>(
&self,
module: &M,
res_infos: &R,
a_infos: &A,
b_infos: &B,
) -> usize
where
R: GGLWEInfos,
A: GGLWEInfos,
B: GGSWInfos,
M: GGLWEExternalProduct<BE>,
{
module.gglwe_external_product_tmp_bytes(res_infos, a_infos, b_infos)
}
}
impl<DataSelf: DataMut> AutomorphismKey<DataSelf> {
pub fn external_product<A, B, M, BE: Backend>(&mut self, module: &M, a: &A, b: &B, scratch: &mut Scratch<BE>)
where
M: GGLWEExternalProduct<BE>,
A: GGLWEToRef,
B: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product(self, a, b, scratch);
}
pub fn external_product_inplace<A, M, BE: Backend>(&mut self, module: &M, a: &A, scratch: &mut Scratch<BE>)
where
M: GGLWEExternalProduct<BE>,
A: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product_inplace(self, a, scratch);
}
}

View File

@@ -1,8 +1,7 @@
mod gglwe_atk;
mod gglwe_ksk;
mod ggsw_ct;
mod glwe_ct;
mod gglwe;
mod ggsw;
mod glwe;
pub use gglwe_ksk::*;
pub use ggsw_ct::*;
pub use glwe_ct::*;
pub use gglwe::*;
pub use ggsw::*;
pub use glwe::*;