Add Zn type

This commit is contained in:
Pro7ech
2025-08-21 12:16:53 +02:00
parent ccd94e36cc
commit bf513dc555
129 changed files with 1400 additions and 686 deletions

View File

@@ -44,11 +44,10 @@ fn bench_external_product_glwe_fft64(c: &mut Criterion) {
let pt_rgsw: ScalarZnx<Vec<u8>> = ScalarZnx::alloc(n, 1);
let mut scratch: ScratchOwned<FFT64> = ScratchOwned::alloc(
GGSWCiphertext::encrypt_sk_scratch_space(&module, n, basek, ct_ggsw.k(), rank)
| GLWECiphertext::encrypt_sk_scratch_space(&module, n, basek, ct_glwe_in.k())
GGSWCiphertext::encrypt_sk_scratch_space(&module, basek, ct_ggsw.k(), rank)
| GLWECiphertext::encrypt_sk_scratch_space(&module, basek, ct_glwe_in.k())
| GLWECiphertext::external_product_scratch_space(
&module,
n,
basek,
ct_glwe_out.k(),
ct_glwe_in.k(),
@@ -137,17 +136,9 @@ fn bench_external_product_glwe_inplace_fft64(c: &mut Criterion) {
let pt_rgsw: ScalarZnx<Vec<u8>> = ScalarZnx::alloc(n, 1);
let mut scratch: ScratchOwned<FFT64> = ScratchOwned::alloc(
GGSWCiphertext::encrypt_sk_scratch_space(&module, n, basek, ct_ggsw.k(), rank)
| GLWECiphertext::encrypt_sk_scratch_space(&module, n, basek, ct_glwe.k())
| GLWECiphertext::external_product_inplace_scratch_space(
&module,
n,
basek,
ct_glwe.k(),
ct_ggsw.k(),
digits,
rank,
),
GGSWCiphertext::encrypt_sk_scratch_space(&module, basek, ct_ggsw.k(), rank)
| GLWECiphertext::encrypt_sk_scratch_space(&module, basek, ct_glwe.k())
| GLWECiphertext::external_product_inplace_scratch_space(&module, basek, ct_glwe.k(), ct_ggsw.k(), digits, rank),
);
let mut source_xs = Source::new([0u8; 32]);

View File

@@ -45,11 +45,10 @@ fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
let mut ct_out: GLWECiphertext<Vec<u8>> = GLWECiphertext::alloc(n, basek, k_rlwe_out, rank_out);
let mut scratch: ScratchOwned<FFT64> = ScratchOwned::alloc(
GGLWESwitchingKey::encrypt_sk_scratch_space(&module, n, basek, ksk.k(), rank_in, rank_out)
| GLWECiphertext::encrypt_sk_scratch_space(&module, n, basek, ct_in.k())
GGLWESwitchingKey::encrypt_sk_scratch_space(&module, basek, ksk.k(), rank_in, rank_out)
| GLWECiphertext::encrypt_sk_scratch_space(&module, basek, ct_in.k())
| GLWECiphertext::keyswitch_scratch_space(
&module,
n,
basek,
ct_out.k(),
ct_in.k(),
@@ -148,9 +147,9 @@ fn bench_keyswitch_glwe_inplace_fft64(c: &mut Criterion) {
let mut ct: GLWECiphertext<Vec<u8>> = GLWECiphertext::alloc(n, basek, k_ct, rank);
let mut scratch: ScratchOwned<FFT64> = ScratchOwned::alloc(
GGLWESwitchingKey::encrypt_sk_scratch_space(&module, n, basek, ksk.k(), rank, rank)
| GLWECiphertext::encrypt_sk_scratch_space(&module, n, basek, ct.k())
| GLWECiphertext::keyswitch_inplace_scratch_space(&module, n, basek, ct.k(), ksk.k(), digits, rank),
GGLWESwitchingKey::encrypt_sk_scratch_space(&module, basek, ksk.k(), rank, rank)
| GLWECiphertext::encrypt_sk_scratch_space(&module, basek, ct.k())
| GLWECiphertext::keyswitch_inplace_scratch_space(&module, basek, ct.k(), ksk.k(), digits, rank),
);
let mut source_xs: Source = Source::new([0u8; 32]);