keyswitch tests

This commit is contained in:
Pro7ech
2025-10-20 15:32:52 +02:00
parent 0c894c19db
commit 252eda36fe
60 changed files with 918 additions and 945 deletions

View File

@@ -3,7 +3,7 @@ use poulpy_hal::layouts::{Backend, DataMut, Scratch};
use crate::{
ScratchTakeCore,
external_product::gglwe_ksk::GGLWEExternalProduct,
layouts::{AutomorphismKey, AutomorphismKeyToRef, GGLWEInfos, GGSWInfos, prepared::GGSWPreparedToRef},
layouts::{AutomorphismKey, GGLWEInfos, GGLWEToRef, GGSWInfos, prepared::GGSWPreparedToRef},
};
impl AutomorphismKey<Vec<u8>> {
@@ -28,11 +28,11 @@ 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: AutomorphismKeyToRef,
A: GGLWEToRef,
B: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product(&mut self.key.key, &a.to_ref().key.key, b, scratch);
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>)
@@ -41,6 +41,6 @@ impl<DataSelf: DataMut> AutomorphismKey<DataSelf> {
A: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product_inplace(&mut self.key.key, a, scratch);
module.gglwe_external_product_inplace(self, a, scratch);
}
}

View File

@@ -3,7 +3,7 @@ use poulpy_hal::layouts::{Backend, DataMut, Module, Scratch, ZnxZero};
use crate::{
GLWEExternalProduct, ScratchTakeCore,
layouts::{
GGLWE, GGLWEInfos, GGLWEToMut, GGLWEToRef, GGSWInfos, GLWEInfos, GLWESwitchingKey, GLWESwitchingKeyToRef,
GGLWE, GGLWEInfos, GGLWEToMut, GGLWEToRef, GGSWInfos, GLWEInfos, GLWESwitchingKey,
prepared::{GGSWPrepared, GGSWPreparedToRef},
},
};
@@ -116,11 +116,11 @@ impl<DataSelf: DataMut> GLWESwitchingKey<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: GLWESwitchingKeyToRef,
A: GGLWEToRef,
B: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product(&mut self.key, &a.to_ref().key, b, scratch);
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>)
@@ -129,6 +129,6 @@ impl<DataSelf: DataMut> GLWESwitchingKey<DataSelf> {
A: GGSWPreparedToRef<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.gglwe_external_product_inplace(&mut self.key, a, scratch);
module.gglwe_external_product_inplace(self, a, scratch);
}
}