mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 21:26:41 +01:00
Traits reduction, file + structs renaming
This commit is contained in:
@@ -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>,
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user