Fix API consistency

This commit is contained in:
Pro7ech
2025-11-04 15:55:43 +01:00
parent 5f30168cb5
commit f84bb02bc9
13 changed files with 54 additions and 54 deletions

View File

@@ -23,7 +23,7 @@ pub struct FheUintPrepared<D: Data, T: UnsignedInteger, B: Backend> {
pub(crate) _phantom: PhantomData<T>,
}
impl<T: UnsignedInteger, BE: Backend> FheUintBlocksPreparedFactory<T, BE> for Module<BE> where
impl<T: UnsignedInteger, BE: Backend> FheUintPreparedFactory<T, BE> for Module<BE> where
Self: Sized + GGSWPreparedFactory<BE>
{
}
@@ -50,7 +50,7 @@ impl<D: DataMut, T: UnsignedInteger, BE: Backend> GetGGSWBitMut<T, BE> for FheUi
}
}
pub trait FheUintBlocksPreparedFactory<T: UnsignedInteger, BE: Backend>
pub trait FheUintPreparedFactory<T: UnsignedInteger, BE: Backend>
where
Self: Sized + GGSWPreparedFactory<BE>,
{
@@ -88,25 +88,25 @@ impl<T: UnsignedInteger, BE: Backend> FheUintPrepared<Vec<u8>, T, BE> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGSWInfos,
M: FheUintBlocksPreparedFactory<T, BE>,
M: FheUintPreparedFactory<T, BE>,
{
module.alloc_fhe_uint_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, dnum: Dnum, dsize: Dsize, rank: Rank) -> Self
where
M: FheUintBlocksPreparedFactory<T, BE>,
M: FheUintPreparedFactory<T, BE>,
{
module.alloc_fhe_uint_prepared(base2k, k, dnum, dsize, rank)
}
}
impl<T: UnsignedInteger + ToBits, BE: Backend> FheUintBlocksPreparedEncryptSk<T, BE> for Module<BE> where
impl<T: UnsignedInteger + ToBits, BE: Backend> FheUintPreparedEncryptSk<T, BE> for Module<BE> where
Self: Sized + ModuleN + GGSWEncryptSk<BE> + GGSWPreparedFactory<BE>
{
}
pub trait FheUintBlocksPreparedEncryptSk<T: UnsignedInteger + ToBits, BE: Backend>
pub trait FheUintPreparedEncryptSk<T: UnsignedInteger + ToBits, BE: Backend>
where
Self: Sized + ModuleN + GGSWEncryptSk<BE> + GGSWPreparedFactory<BE>,
{
@@ -153,7 +153,7 @@ impl<D: DataMut, T: UnsignedInteger + ToBits, BE: Backend> FheUintPrepared<D, T,
scratch: &mut Scratch<BE>,
) where
S: GLWESecretPreparedToRef<BE> + GLWEInfos,
M: FheUintBlocksPreparedEncryptSk<T, BE>,
M: FheUintPreparedEncryptSk<T, BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.fhe_uint_prepared_encrypt_sk(self, value, sk, source_xa, source_xe, scratch);

View File

@@ -205,7 +205,7 @@ impl<D: DataMut, BRA: BlindRotationAlgo, BE: Backend> BDDKeyPrepared<D, BRA, BE>
}
}
pub trait FheUintBlocksPrepare<BRA: BlindRotationAlgo, T: UnsignedInteger, BE: Backend> {
pub trait FheUintPrepare<BRA: BlindRotationAlgo, T: UnsignedInteger, BE: Backend> {
fn fhe_uint_prepare_tmp_bytes<R, A>(&self, block_size: usize, extension_factor: usize, res_infos: &R, infos: &A) -> usize
where
R: GGSWInfos,
@@ -223,7 +223,7 @@ pub trait FheUintBlocksPrepare<BRA: BlindRotationAlgo, T: UnsignedInteger, BE: B
K: BDDKeyHelper<DK, BRA, BE>;
}
impl<BRA: BlindRotationAlgo, BE: Backend, T: UnsignedInteger> FheUintBlocksPrepare<BRA, T, BE> for Module<BE>
impl<BRA: BlindRotationAlgo, BE: Backend, T: UnsignedInteger> FheUintPrepare<BRA, T, BE> for Module<BE>
where
Self: LWEFromGLWE<BE> + CirtuitBootstrappingExecute<BRA, BE> + GGSWPreparedFactory<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
@@ -281,7 +281,7 @@ impl<D: DataMut, T: UnsignedInteger, BE: Backend> FheUintPrepared<D, T, BE> {
O: DataRef,
DK: DataRef,
K: BDDKeyHelper<DK, BRA, BE>,
M: FheUintBlocksPrepare<BRA, T, BE>,
M: FheUintPrepare<BRA, T, BE>,
Scratch<BE>: ScratchTakeCore<BE>,
{
module.fhe_uint_prepare(self, other, key, scratch);

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
Add, BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
And, BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Or,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Or,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPreparedDebug,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPreparedDebug,
tests::test_suite::{TEST_BASE2K, TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Sll,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Sll,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Slt,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Slt,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Sltu,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Sltu,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Sra,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Sra,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Srl,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Srl,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Sub,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Sub,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,

View File

@@ -12,7 +12,7 @@ use rand::RngCore;
use crate::tfhe::{
bdd_arithmetic::{
BDDKeyEncryptSk, BDDKeyPrepared, BDDKeyPreparedFactory, ExecuteBDDCircuit2WTo1W, FheUint, FheUintBlockDebugPrepare,
FheUintBlocksPrepare, FheUintBlocksPreparedEncryptSk, FheUintBlocksPreparedFactory, FheUintPrepared, Xor,
FheUintPrepare, FheUintPreparedEncryptSk, FheUintPreparedFactory, FheUintPrepared, Xor,
tests::test_suite::{TEST_GGSW_INFOS, TEST_GLWE_INFOS, TestContext},
},
blind_rotation::{BlindRotationAlgo, BlindRotationKey, BlindRotationKeyFactory},
@@ -24,13 +24,13 @@ where
+ GLWESecretPreparedFactory<BE>
+ GLWEDecrypt<BE>
+ GLWENoise<BE>
+ FheUintBlocksPreparedFactory<u32, BE>
+ FheUintBlocksPreparedEncryptSk<u32, BE>
+ FheUintPreparedFactory<u32, BE>
+ FheUintPreparedEncryptSk<u32, BE>
+ FheUintBlockDebugPrepare<BRA, u32, BE>
+ BDDKeyEncryptSk<BRA, BE>
+ BDDKeyPreparedFactory<BRA, BE>
+ GGSWNoise<BE>
+ FheUintBlocksPrepare<BRA, u32, BE>
+ FheUintPrepare<BRA, u32, BE>
+ ExecuteBDDCircuit2WTo1W<u32, BE>
+ GLWEEncryptSk<BE>,
BlindRotationKey<Vec<u8>, BRA>: BlindRotationKeyFactory<BRA>,