mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
compiling CBT but failing tests
This commit is contained in:
@@ -7,11 +7,12 @@ use crate::{
|
||||
ScratchTakeCore,
|
||||
automorphism::glwe_ct::GLWEAutomorphism,
|
||||
layouts::{
|
||||
AutomorphismKey, GGLWE, GGLWEInfos, GGLWEPreparedToRef, GGLWEToMut, GGLWEToRef, GLWE, GetGaloisElement, SetGaloisElement,
|
||||
GGLWE, GGLWEInfos, GGLWEPreparedToRef, GGLWEToMut, GGLWEToRef, GLWE, GLWEAutomorphismKey, GetGaloisElement,
|
||||
SetGaloisElement,
|
||||
},
|
||||
};
|
||||
|
||||
impl AutomorphismKey<Vec<u8>> {
|
||||
impl GLWEAutomorphismKey<Vec<u8>> {
|
||||
pub fn automorphism_tmp_bytes<R, A, K, M, BE: Backend>(module: &M, res_infos: &R, a_infos: &A, key_infos: &K) -> usize
|
||||
where
|
||||
R: GGLWEInfos,
|
||||
@@ -19,11 +20,11 @@ impl AutomorphismKey<Vec<u8>> {
|
||||
K: GGLWEInfos,
|
||||
M: GLWEAutomorphismKeyAutomorphism<BE>,
|
||||
{
|
||||
module.automorphism_key_automorphism_tmp_bytes(res_infos, a_infos, key_infos)
|
||||
module.glwe_automorphism_key_automorphism_tmp_bytes(res_infos, a_infos, key_infos)
|
||||
}
|
||||
}
|
||||
|
||||
impl<DataSelf: DataMut> AutomorphismKey<DataSelf> {
|
||||
impl<DataSelf: DataMut> GLWEAutomorphismKey<DataSelf> {
|
||||
pub fn automorphism<A, K, M, BE: Backend>(&mut self, module: &M, a: &A, key: &K, scratch: &mut Scratch<BE>)
|
||||
where
|
||||
A: GGLWEToRef + GetGaloisElement + GGLWEInfos,
|
||||
@@ -31,7 +32,7 @@ impl<DataSelf: DataMut> AutomorphismKey<DataSelf> {
|
||||
Scratch<BE>: ScratchTakeCore<BE>,
|
||||
M: GLWEAutomorphismKeyAutomorphism<BE>,
|
||||
{
|
||||
module.automorphism_key_automorphism(self, a, key, scratch);
|
||||
module.glwe_automorphism_key_automorphism(self, a, key, scratch);
|
||||
}
|
||||
|
||||
pub fn automorphism_inplace<K, M, BE: Backend>(&mut self, module: &M, key: &K, scratch: &mut Scratch<BE>)
|
||||
@@ -40,7 +41,7 @@ impl<DataSelf: DataMut> AutomorphismKey<DataSelf> {
|
||||
Scratch<BE>: ScratchTakeCore<BE>,
|
||||
M: GLWEAutomorphismKeyAutomorphism<BE>,
|
||||
{
|
||||
module.automorphism_key_automorphism_inplace(self, key, scratch);
|
||||
module.glwe_automorphism_key_automorphism_inplace(self, key, scratch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +54,7 @@ pub trait GLWEAutomorphismKeyAutomorphism<BE: Backend>
|
||||
where
|
||||
Self: GaloisElement + GLWEAutomorphism<BE> + VecZnxAutomorphism,
|
||||
{
|
||||
fn automorphism_key_automorphism_tmp_bytes<R, A, K>(&self, res_infos: &R, a_infos: &A, key_infos: &K) -> usize
|
||||
fn glwe_automorphism_key_automorphism_tmp_bytes<R, A, K>(&self, res_infos: &R, a_infos: &A, key_infos: &K) -> usize
|
||||
where
|
||||
R: GGLWEInfos,
|
||||
A: GGLWEInfos,
|
||||
@@ -62,7 +63,7 @@ where
|
||||
self.glwe_keyswitch_tmp_bytes(res_infos, a_infos, key_infos)
|
||||
}
|
||||
|
||||
fn automorphism_key_automorphism<R, A, K>(&self, res: &mut R, a: &A, key: &K, scratch: &mut Scratch<BE>)
|
||||
fn glwe_automorphism_key_automorphism<R, A, K>(&self, res: &mut R, a: &A, key: &K, scratch: &mut Scratch<BE>)
|
||||
where
|
||||
R: GGLWEToMut + SetGaloisElement + GGLWEInfos,
|
||||
A: GGLWEToRef + GetGaloisElement + GGLWEInfos,
|
||||
@@ -118,7 +119,7 @@ where
|
||||
res.set_p((p * key.p()) % (self.cyclotomic_order() as i64));
|
||||
}
|
||||
|
||||
fn automorphism_key_automorphism_inplace<R, K>(&self, res: &mut R, key: &K, scratch: &mut Scratch<BE>)
|
||||
fn glwe_automorphism_key_automorphism_inplace<R, K>(&self, res: &mut R, key: &K, scratch: &mut Scratch<BE>)
|
||||
where
|
||||
R: GGLWEToMut + SetGaloisElement + GetGaloisElement + GGLWEInfos,
|
||||
K: GGLWEPreparedToRef<BE> + GetGaloisElement + GGLWEInfos,
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
automorphism::glwe_ct::GLWEAutomorphism,
|
||||
layouts::{
|
||||
GGLWEInfos, GGLWEPreparedToRef, GGSW, GGSWInfos, GGSWToMut, GGSWToRef, GetGaloisElement,
|
||||
prepared::{TensorKeyPrepared, TensorKeyPreparedToRef},
|
||||
prepared::{GLWETensorKeyPrepared, GLWETensorKeyPreparedToRef},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ impl<D: DataMut> GGSW<D> {
|
||||
where
|
||||
A: GGSWToRef,
|
||||
K: GetGaloisElement + GGLWEPreparedToRef<BE> + GGLWEInfos,
|
||||
T: TensorKeyPreparedToRef<BE>,
|
||||
T: GLWETensorKeyPreparedToRef<BE>,
|
||||
Scratch<BE>: ScratchTakeCore<BE>,
|
||||
M: GGSWAutomorphism<BE>,
|
||||
{
|
||||
@@ -46,7 +46,7 @@ impl<D: DataMut> GGSW<D> {
|
||||
pub fn automorphism_inplace<K, T, M, BE: Backend>(&mut self, module: &M, key: &K, tsk: &T, scratch: &mut Scratch<BE>)
|
||||
where
|
||||
K: GetGaloisElement + GGLWEPreparedToRef<BE> + GGLWEInfos,
|
||||
T: TensorKeyPreparedToRef<BE>,
|
||||
T: GLWETensorKeyPreparedToRef<BE>,
|
||||
Scratch<BE>: ScratchTakeCore<BE>,
|
||||
M: GGSWAutomorphism<BE>,
|
||||
{
|
||||
@@ -79,12 +79,12 @@ where
|
||||
R: GGSWToMut,
|
||||
A: GGSWToRef,
|
||||
K: GetGaloisElement + GGLWEPreparedToRef<BE> + GGLWEInfos,
|
||||
T: TensorKeyPreparedToRef<BE>,
|
||||
T: GLWETensorKeyPreparedToRef<BE>,
|
||||
Scratch<BE>: ScratchTakeCore<BE>,
|
||||
{
|
||||
let res: &mut GGSW<&mut [u8]> = &mut res.to_mut();
|
||||
let a: &GGSW<&[u8]> = &a.to_ref();
|
||||
let tsk: &TensorKeyPrepared<&[u8], BE> = &tsk.to_ref();
|
||||
let tsk: &GLWETensorKeyPrepared<&[u8], BE> = &tsk.to_ref();
|
||||
|
||||
assert_eq!(res.dsize(), a.dsize());
|
||||
assert!(res.dnum() <= a.dnum());
|
||||
@@ -104,11 +104,11 @@ where
|
||||
where
|
||||
R: GGSWToMut,
|
||||
K: GetGaloisElement + GGLWEPreparedToRef<BE> + GGLWEInfos,
|
||||
T: TensorKeyPreparedToRef<BE>,
|
||||
T: GLWETensorKeyPreparedToRef<BE>,
|
||||
Scratch<BE>: ScratchTakeCore<BE>,
|
||||
{
|
||||
let res: &mut GGSW<&mut [u8]> = &mut res.to_mut();
|
||||
let tsk: &TensorKeyPrepared<&[u8], BE> = &tsk.to_ref();
|
||||
let tsk: &GLWETensorKeyPrepared<&[u8], BE> = &tsk.to_ref();
|
||||
|
||||
// Keyswitch the j-th row of the col 0
|
||||
for row in 0..res.dnum().as_usize() {
|
||||
|
||||
@@ -54,7 +54,7 @@ impl<DataSelf: DataMut> GLWE<DataSelf> {
|
||||
module.glwe_automorphism_sub(self, a, key, scratch);
|
||||
}
|
||||
|
||||
pub fn glwe_automorphism_sub_negate<M, A, K, BE: Backend>(&mut self, module: &M, a: &A, key: &K, scratch: &mut Scratch<BE>)
|
||||
pub fn automorphism_sub_negate<M, A, K, BE: Backend>(&mut self, module: &M, a: &A, key: &K, scratch: &mut Scratch<BE>)
|
||||
where
|
||||
M: GLWEAutomorphism<BE>,
|
||||
A: GLWEToRef,
|
||||
|
||||
Reference in New Issue
Block a user