mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
clippy + cleanup
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use poulpy_core::{
|
||||
GLWEDecrypt, GLWEEncryptSk, GLWEExternalProduct, LWEEncryptSk, ScratchTakeCore,
|
||||
GLWEDecrypt, GLWEEncryptSk, ScratchTakeCore,
|
||||
layouts::{
|
||||
Base2K, Degree, Dnum, Dsize, GGLWEToGGSWKeyLayout, GGSWLayout, GGSWPreparedFactory, GLWEAutomorphismKeyLayout,
|
||||
GLWELayout, GLWESecret, GLWESecretPrepared, GLWESecretPreparedFactory, GLWESwitchingKeyLayout, GLWEToLWEKeyLayout,
|
||||
@@ -9,7 +9,7 @@ use poulpy_core::{
|
||||
},
|
||||
};
|
||||
use poulpy_hal::{
|
||||
api::{ModuleN, ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow, VecZnxRotateInplace},
|
||||
api::{ModuleN, ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow},
|
||||
layouts::{Backend, Module, Scratch, ScratchOwned},
|
||||
source::Source,
|
||||
};
|
||||
@@ -41,18 +41,17 @@ use poulpy_cpu_ref::FFT64Ref;
|
||||
//
|
||||
// - Result Decryption
|
||||
//
|
||||
// There also is an example use of the GLWE Blind Selection operation,
|
||||
// which can choose between any number of encrypted fheuint inputs
|
||||
|
||||
fn example_bdd_arithmetic<BE: Backend, BRA: BlindRotationAlgo>()
|
||||
where
|
||||
Module<BE>: ModuleNew<BE>
|
||||
+ ModuleN
|
||||
+ GLWESecretPreparedFactory<BE>
|
||||
+ GLWEExternalProduct<BE>
|
||||
+ GLWEDecrypt<BE>
|
||||
+ LWEEncryptSk<BE>
|
||||
+ GGSWPreparedFactory<BE>
|
||||
+ GLWEEncryptSk<BE>
|
||||
+ VecZnxRotateInplace<BE>
|
||||
+ BDDKeyEncryptSk<BRA, BE>
|
||||
+ BDDKeyPreparedFactory<BRA, BE>
|
||||
+ FheUintPrepare<BRA, BE>
|
||||
|
||||
@@ -76,37 +76,34 @@ where
|
||||
dsize: Dsize(1),
|
||||
};
|
||||
|
||||
// Used to generate CBT Keys
|
||||
let cbt_layout = CircuitBootstrappingKeyLayout {
|
||||
brk_layout: BlindRotationKeyLayout {
|
||||
n_glwe: Degree(N_GLWE),
|
||||
n_lwe: Degree(N_LWE),
|
||||
base2k: Base2K(BASE2K),
|
||||
k: TorusPrecision(4 * BASE2K),
|
||||
dnum: Dnum(4),
|
||||
rank: Rank(RANK),
|
||||
},
|
||||
atk_layout: GLWEAutomorphismKeyLayout {
|
||||
n: Degree(N_GLWE),
|
||||
base2k: Base2K(BASE2K),
|
||||
k: TorusPrecision(4 * BASE2K),
|
||||
dnum: Dnum(4),
|
||||
dsize: Dsize(1),
|
||||
rank: Rank(RANK),
|
||||
},
|
||||
tsk_layout: GGLWEToGGSWKeyLayout {
|
||||
n: Degree(N_GLWE),
|
||||
base2k: Base2K(BASE2K),
|
||||
k: TorusPrecision(4 * BASE2K),
|
||||
dnum: Dnum(4),
|
||||
dsize: Dsize(1),
|
||||
rank: Rank(RANK),
|
||||
},
|
||||
};
|
||||
|
||||
// Used to generate BDD Keys, for the arithmetic operations
|
||||
let bdd_layout = BDDKeyLayout {
|
||||
cbt_layout: cbt_layout,
|
||||
cbt_layout: CircuitBootstrappingKeyLayout {
|
||||
brk_layout: BlindRotationKeyLayout {
|
||||
n_glwe: Degree(N_GLWE),
|
||||
n_lwe: Degree(N_LWE),
|
||||
base2k: Base2K(BASE2K),
|
||||
k: TorusPrecision(4 * BASE2K),
|
||||
dnum: Dnum(4),
|
||||
rank: Rank(RANK),
|
||||
},
|
||||
atk_layout: GLWEAutomorphismKeyLayout {
|
||||
n: Degree(N_GLWE),
|
||||
base2k: Base2K(BASE2K),
|
||||
k: TorusPrecision(4 * BASE2K),
|
||||
dnum: Dnum(4),
|
||||
dsize: Dsize(1),
|
||||
rank: Rank(RANK),
|
||||
},
|
||||
tsk_layout: GGLWEToGGSWKeyLayout {
|
||||
n: Degree(N_GLWE),
|
||||
base2k: Base2K(BASE2K),
|
||||
k: TorusPrecision(4 * BASE2K),
|
||||
dnum: Dnum(4),
|
||||
dsize: Dsize(1),
|
||||
rank: Rank(RANK),
|
||||
},
|
||||
},
|
||||
ks_glwe_layout: Some(GLWESwitchingKeyLayout {
|
||||
n: Degree(N_GLWE),
|
||||
base2k: Base2K(BASE2K),
|
||||
@@ -212,7 +209,7 @@ where
|
||||
|
||||
let mut input_i_enc_prepared: FheUintPrepared<Vec<u8>, u32, BE> =
|
||||
FheUintPrepared::alloc_from_infos(&module, &ggsw_layout);
|
||||
input_i_enc_prepared.prepare(&module, &input_i, &bdd_key_prepared, scratch.borrow());
|
||||
input_i_enc_prepared.prepare(&module, input_i, &bdd_key_prepared, scratch.borrow());
|
||||
|
||||
// b = (input_i < max)
|
||||
compare_enc.sltu(
|
||||
|
||||
Reference in New Issue
Block a user