mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
rename to what it actually does
This commit is contained in:
@@ -21,16 +21,16 @@ where
|
|||||||
Self: GLWEBlindRotation<T, BE> + VecZnxAddScalarInplace + VecZnxNormalizeInplace<BE>,
|
Self: GLWEBlindRotation<T, BE> + VecZnxAddScalarInplace + VecZnxNormalizeInplace<BE>,
|
||||||
Scratch<BE>: ScratchTakeCore<BE>,
|
Scratch<BE>: ScratchTakeCore<BE>,
|
||||||
{
|
{
|
||||||
fn ggsw_blind_rotate_from_ggsw_tmp_bytes<R, K>(&self, res_infos: &R, k_infos: &K) -> usize
|
fn ggsw_to_ggsw_blind_rotation_tmp_bytes<R, K>(&self, res_infos: &R, k_infos: &K) -> usize
|
||||||
where
|
where
|
||||||
R: GLWEInfos,
|
R: GLWEInfos,
|
||||||
K: GGSWInfos,
|
K: GGSWInfos,
|
||||||
{
|
{
|
||||||
self.glwe_blind_rotation_tmp_bytes(res_infos, k_infos)
|
self.glwe_to_glwe_blind_rotation_tmp_bytes(res_infos, k_infos)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// res <- a * X^{((k>>bit_rsh) % 2^bit_mask) << bit_lsh}.
|
/// res <- a * X^{((k>>bit_rsh) % 2^bit_mask) << bit_lsh}.
|
||||||
fn ggsw_blind_rotate_from_ggsw<R, A, K>(
|
fn ggsw_to_ggsw_blind_rotation<R, A, K>(
|
||||||
&self,
|
&self,
|
||||||
res: &mut R,
|
res: &mut R,
|
||||||
a: &A,
|
a: &A,
|
||||||
@@ -53,7 +53,7 @@ where
|
|||||||
|
|
||||||
for col in 0..(res.rank() + 1).into() {
|
for col in 0..(res.rank() + 1).into() {
|
||||||
for row in 0..res.dnum().into() {
|
for row in 0..res.dnum().into() {
|
||||||
self.glwe_blind_rotation(
|
self.glwe_to_glwe_blind_rotation(
|
||||||
&mut res.at_mut(row, col),
|
&mut res.at_mut(row, col),
|
||||||
&a.at(row, col),
|
&a.at(row, col),
|
||||||
k,
|
k,
|
||||||
@@ -66,15 +66,15 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ggsw_blind_rotate_from_scalar_tmp_bytes<R, K>(&self, res_infos: &R, k_infos: &K) -> usize
|
fn scalar_to_ggsw_blind_rotation_tmp_bytes<R, K>(&self, res_infos: &R, k_infos: &K) -> usize
|
||||||
where
|
where
|
||||||
R: GLWEInfos,
|
R: GLWEInfos,
|
||||||
K: GGSWInfos,
|
K: GGSWInfos,
|
||||||
{
|
{
|
||||||
self.glwe_blind_rotation_tmp_bytes(res_infos, k_infos) + GLWE::bytes_of_from_infos(res_infos)
|
self.glwe_to_glwe_blind_rotation_tmp_bytes(res_infos, k_infos) + GLWE::bytes_of_from_infos(res_infos)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ggsw_blind_rotate_from_scalar<R, S, K>(
|
fn scalar_to_ggsw_blind_rotation<R, S, K>(
|
||||||
&self,
|
&self,
|
||||||
res: &mut R,
|
res: &mut R,
|
||||||
test_vector: &S,
|
test_vector: &S,
|
||||||
@@ -109,7 +109,7 @@ where
|
|||||||
);
|
);
|
||||||
self.vec_znx_normalize_inplace(base2k, tmp_glwe.data_mut(), col, scratch_1);
|
self.vec_znx_normalize_inplace(base2k, tmp_glwe.data_mut(), col, scratch_1);
|
||||||
|
|
||||||
self.glwe_blind_rotation(
|
self.glwe_to_glwe_blind_rotation(
|
||||||
&mut res.at_mut(row, col),
|
&mut res.at_mut(row, col),
|
||||||
&tmp_glwe,
|
&tmp_glwe,
|
||||||
k,
|
k,
|
||||||
@@ -135,7 +135,7 @@ where
|
|||||||
Self: GLWECopy + GLWERotate<BE> + Cmux<BE>,
|
Self: GLWECopy + GLWERotate<BE> + Cmux<BE>,
|
||||||
Scratch<BE>: ScratchTakeCore<BE>,
|
Scratch<BE>: ScratchTakeCore<BE>,
|
||||||
{
|
{
|
||||||
fn glwe_blind_rotation_tmp_bytes<R, K>(&self, res_infos: &R, k_infos: &K) -> usize
|
fn glwe_to_glwe_blind_rotation_tmp_bytes<R, K>(&self, res_infos: &R, k_infos: &K) -> usize
|
||||||
where
|
where
|
||||||
R: GLWEInfos,
|
R: GLWEInfos,
|
||||||
K: GGSWInfos,
|
K: GGSWInfos,
|
||||||
@@ -144,7 +144,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// res <- a * X^{((k>>bit_rsh) % 2^bit_mask) << bit_lsh}.
|
/// res <- a * X^{((k>>bit_rsh) % 2^bit_mask) << bit_lsh}.
|
||||||
fn glwe_blind_rotation<R, A, K>(
|
fn glwe_to_glwe_blind_rotation<R, A, K>(
|
||||||
&self,
|
&self,
|
||||||
res: &mut R,
|
res: &mut R,
|
||||||
a: &A,
|
a: &A,
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
mod bdd_2w_to_1w;
|
mod bdd_2w_to_1w;
|
||||||
mod bdd_rotation;
|
mod blind_rotation;
|
||||||
mod ciphertexts;
|
mod ciphertexts;
|
||||||
mod circuits;
|
mod circuits;
|
||||||
mod eval;
|
mod eval;
|
||||||
mod key;
|
mod key;
|
||||||
|
|
||||||
pub use bdd_2w_to_1w::*;
|
pub use bdd_2w_to_1w::*;
|
||||||
pub use bdd_rotation::*;
|
pub use blind_rotation::*;
|
||||||
pub use ciphertexts::*;
|
pub use ciphertexts::*;
|
||||||
pub(crate) use circuits::*;
|
pub(crate) use circuits::*;
|
||||||
pub(crate) use eval::*;
|
pub(crate) use eval::*;
|
||||||
|
|||||||
@@ -3,19 +3,19 @@ use poulpy_backend::FFT64Ref;
|
|||||||
use crate::tfhe::{
|
use crate::tfhe::{
|
||||||
bdd_arithmetic::tests::test_suite::{
|
bdd_arithmetic::tests::test_suite::{
|
||||||
test_bdd_add, test_bdd_and, test_bdd_or, test_bdd_prepare, test_bdd_sll, test_bdd_slt, test_bdd_sltu, test_bdd_sra,
|
test_bdd_add, test_bdd_and, test_bdd_or, test_bdd_prepare, test_bdd_sll, test_bdd_slt, test_bdd_sltu, test_bdd_sra,
|
||||||
test_bdd_srl, test_bdd_sub, test_bdd_xor, test_ggsw_blind_rotation, test_glwe_blind_rotation,
|
test_bdd_srl, test_bdd_sub, test_bdd_xor, test_scalar_to_ggsw_blind_rotation, test_glwe_to_glwe_blind_rotation,
|
||||||
},
|
},
|
||||||
blind_rotation::CGGI,
|
blind_rotation::CGGI,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_glwe_blind_rotation_fft64_ref() {
|
fn test_glwe_to_glwe_blind_rotation_fft64_ref() {
|
||||||
test_glwe_blind_rotation::<FFT64Ref>()
|
test_glwe_to_glwe_blind_rotation::<FFT64Ref>()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ggsw_blind_rotation_fft64_ref() {
|
fn test_scalar_to_ggsw_blind_rotation_fft64_ref() {
|
||||||
test_ggsw_blind_rotation::<FFT64Ref>()
|
test_scalar_to_ggsw_blind_rotation::<FFT64Ref>()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use rand::RngCore;
|
|||||||
|
|
||||||
use crate::tfhe::bdd_arithmetic::{FheUintBlocksPrepared, GGSWBlindRotation};
|
use crate::tfhe::bdd_arithmetic::{FheUintBlocksPrepared, GGSWBlindRotation};
|
||||||
|
|
||||||
pub fn test_ggsw_blind_rotation<BE: Backend>()
|
pub fn test_scalar_to_ggsw_blind_rotation<BE: Backend>()
|
||||||
where
|
where
|
||||||
Module<BE>: ModuleNew<BE>
|
Module<BE>: ModuleNew<BE>
|
||||||
+ GLWESecretPreparedFactory<BE>
|
+ GLWESecretPreparedFactory<BE>
|
||||||
@@ -117,7 +117,7 @@ where
|
|||||||
// How many bits to take
|
// How many bits to take
|
||||||
let bit_size: usize = (32 - bit_start).min(digit);
|
let bit_size: usize = (32 - bit_start).min(digit);
|
||||||
|
|
||||||
module.ggsw_blind_rotate_from_scalar(
|
module.scalar_to_ggsw_blind_rotation(
|
||||||
&mut res,
|
&mut res,
|
||||||
&scalar,
|
&scalar,
|
||||||
&k_enc_prep,
|
&k_enc_prep,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use rand::RngCore;
|
|||||||
|
|
||||||
use crate::tfhe::bdd_arithmetic::{FheUintBlocksPrepared, GLWEBlindRotation};
|
use crate::tfhe::bdd_arithmetic::{FheUintBlocksPrepared, GLWEBlindRotation};
|
||||||
|
|
||||||
pub fn test_glwe_blind_rotation<BE: Backend>()
|
pub fn test_glwe_to_glwe_blind_rotation<BE: Backend>()
|
||||||
where
|
where
|
||||||
Module<BE>: ModuleNew<BE>
|
Module<BE>: ModuleNew<BE>
|
||||||
+ GLWESecretPreparedFactory<BE>
|
+ GLWESecretPreparedFactory<BE>
|
||||||
@@ -106,7 +106,7 @@ where
|
|||||||
// How many bits to take
|
// How many bits to take
|
||||||
let bit_size: usize = (32 - bit_start).min(digit);
|
let bit_size: usize = (32 - bit_start).min(digit);
|
||||||
|
|
||||||
module.glwe_blind_rotation(
|
module.glwe_to_glwe_blind_rotation(
|
||||||
&mut res,
|
&mut res,
|
||||||
&test_glwe,
|
&test_glwe,
|
||||||
&k_enc_prep,
|
&k_enc_prep,
|
||||||
|
|||||||
Reference in New Issue
Block a user