mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Reorganized other crates
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use backend::{FFT64, Module, ScratchOwned};
|
||||
use core::{AutomorphismKey, GLWECiphertext, GLWESecret, GLWESwitchingKey, Infos};
|
||||
use core::{FourierGLWESecret, GLWEAutomorphismKey, GLWECiphertext, GLWESecret, GLWESwitchingKey, Infos};
|
||||
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
|
||||
use sampling::source::Source;
|
||||
use std::{hint::black_box, time::Duration};
|
||||
@@ -32,7 +32,8 @@ fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
||||
let rows: usize = (p.k_ct_in + (p.basek * digits) - 1) / (p.basek * digits);
|
||||
let sigma: f64 = 3.2;
|
||||
|
||||
let mut ksk: AutomorphismKey<Vec<u8>, FFT64> = AutomorphismKey::alloc(&module, basek, k_grlwe, rows, digits, rank_out);
|
||||
let mut ksk: GLWEAutomorphismKey<Vec<u8>, FFT64> =
|
||||
GLWEAutomorphismKey::alloc(&module, basek, k_grlwe, rows, digits, rank_out);
|
||||
let mut ct_in: GLWECiphertext<Vec<u8>> = GLWECiphertext::alloc(&module, basek, k_rlwe_in, rank_in);
|
||||
let mut ct_out: GLWECiphertext<Vec<u8>> = GLWECiphertext::alloc(&module, basek, k_rlwe_out, rank_out);
|
||||
|
||||
@@ -55,11 +56,12 @@ fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
||||
let mut source_xe = Source::new([0u8; 32]);
|
||||
let mut source_xa = Source::new([0u8; 32]);
|
||||
|
||||
let mut sk_in: GLWESecret<Vec<u8>, FFT64> = GLWESecret::alloc(&module, rank_in);
|
||||
sk_in.fill_ternary_prob(&module, 0.5, &mut source_xs);
|
||||
let mut sk_in: GLWESecret<Vec<u8>> = GLWESecret::alloc(&module, rank_in);
|
||||
sk_in.fill_ternary_prob(0.5, &mut source_xs);
|
||||
let sk_in_dft: FourierGLWESecret<Vec<u8>, FFT64> = FourierGLWESecret::from(&module, &sk_in);
|
||||
|
||||
let mut sk_out: GLWESecret<Vec<u8>, FFT64> = GLWESecret::alloc(&module, rank_out);
|
||||
sk_out.fill_ternary_prob(&module, 0.5, &mut source_xs);
|
||||
let mut sk_out: GLWESecret<Vec<u8>> = GLWESecret::alloc(&module, rank_out);
|
||||
sk_out.fill_ternary_prob(0.5, &mut source_xs);
|
||||
|
||||
ksk.generate_from_sk(
|
||||
&module,
|
||||
@@ -73,7 +75,7 @@ fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
||||
|
||||
ct_in.encrypt_zero_sk(
|
||||
&module,
|
||||
&sk_in,
|
||||
&sk_in_dft,
|
||||
&mut source_xa,
|
||||
&mut source_xe,
|
||||
sigma,
|
||||
@@ -146,16 +148,18 @@ fn bench_keyswitch_glwe_inplace_fft64(c: &mut Criterion) {
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut sk_in: GLWESecret<Vec<u8>, FFT64> = GLWESecret::alloc(&module, rank);
|
||||
sk_in.fill_ternary_prob(&&module, 0.5, &mut source_xs);
|
||||
let mut sk_in: GLWESecret<Vec<u8>> = GLWESecret::alloc(&module, rank);
|
||||
sk_in.fill_ternary_prob(0.5, &mut source_xs);
|
||||
let sk_in_dft: FourierGLWESecret<Vec<u8>, FFT64> = FourierGLWESecret::from(&module, &sk_in);
|
||||
|
||||
let mut sk_out: GLWESecret<Vec<u8>, FFT64> = GLWESecret::alloc(&module, rank);
|
||||
sk_out.fill_ternary_prob(&&module, 0.5, &mut source_xs);
|
||||
let mut sk_out: GLWESecret<Vec<u8>> = GLWESecret::alloc(&module, rank);
|
||||
sk_out.fill_ternary_prob(0.5, &mut source_xs);
|
||||
let sk_out_dft: FourierGLWESecret<Vec<u8>, FFT64> = FourierGLWESecret::from(&module, &sk_out);
|
||||
|
||||
ksk.generate_from_sk(
|
||||
&module,
|
||||
&sk_in,
|
||||
&sk_out,
|
||||
&sk_out_dft,
|
||||
&mut source_xa,
|
||||
&mut source_xe,
|
||||
sigma,
|
||||
@@ -164,7 +168,7 @@ fn bench_keyswitch_glwe_inplace_fft64(c: &mut Criterion) {
|
||||
|
||||
ct.encrypt_zero_sk(
|
||||
&module,
|
||||
&sk_in,
|
||||
&sk_in_dft,
|
||||
&mut source_xa,
|
||||
&mut source_xe,
|
||||
sigma,
|
||||
|
||||
Reference in New Issue
Block a user