mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
wip
This commit is contained in:
@@ -120,9 +120,9 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_scratch_space(module, &auto_key_in_infos)
|
||||
| AutomorphismKey::encrypt_sk_scratch_space(module, &auto_key_apply_infos)
|
||||
| AutomorphismKey::automorphism_scratch_space(
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_in_infos)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_apply_infos)
|
||||
| AutomorphismKey::automorphism_tmp_bytes(
|
||||
module,
|
||||
&auto_key_out_infos,
|
||||
&auto_key_in_infos,
|
||||
@@ -319,9 +319,9 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_scratch_space(module, &auto_key)
|
||||
| AutomorphismKey::encrypt_sk_scratch_space(module, &auto_key_apply)
|
||||
| AutomorphismKey::automorphism_inplace_scratch_space(module, &auto_key, &auto_key_apply),
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key_apply)
|
||||
| AutomorphismKey::automorphism_inplace_tmp_bytes(module, &auto_key, &auto_key_apply),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&auto_key);
|
||||
|
||||
@@ -139,10 +139,10 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ct_in)
|
||||
| AutomorphismKey::encrypt_sk_scratch_space(module, &auto_key)
|
||||
| TensorKey::encrypt_sk_scratch_space(module, &tensor_key)
|
||||
| GGSW::automorphism_scratch_space(module, &ct_out, &ct_in, &auto_key, &tensor_key),
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ct_in)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tensor_key)
|
||||
| GGSW::automorphism_tmp_bytes(module, &ct_out, &ct_in, &auto_key, &tensor_key),
|
||||
);
|
||||
|
||||
let var_xs: f64 = 0.5;
|
||||
@@ -319,10 +319,10 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ct)
|
||||
| AutomorphismKey::encrypt_sk_scratch_space(module, &auto_key)
|
||||
| TensorKey::encrypt_sk_scratch_space(module, &tensor_key)
|
||||
| GGSW::automorphism_inplace_scratch_space(module, &ct, &auto_key, &tensor_key),
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ct)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &auto_key)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tensor_key)
|
||||
| GGSW::automorphism_inplace_tmp_bytes(module, &ct, &auto_key, &tensor_key),
|
||||
);
|
||||
|
||||
let var_xs: f64 = 0.5;
|
||||
|
||||
@@ -112,10 +112,10 @@ where
|
||||
module.vec_znx_fill_uniform(base2k, &mut pt_want.data, 0, &mut source_xa);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_scratch_space(module, &autokey)
|
||||
| GLWE::decrypt_scratch_space(module, &ct_out)
|
||||
| GLWE::encrypt_sk_scratch_space(module, &ct_in)
|
||||
| GLWE::automorphism_scratch_space(module, &ct_out, &ct_in, &autokey),
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &autokey)
|
||||
| GLWE::decrypt_tmp_bytes(module, &ct_out)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &ct_in)
|
||||
| GLWE::automorphism_tmp_bytes(module, &ct_out, &ct_in, &autokey),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&ct_out);
|
||||
@@ -246,10 +246,10 @@ where
|
||||
module.vec_znx_fill_uniform(base2k, &mut pt_want.data, 0, &mut source_xa);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
AutomorphismKey::encrypt_sk_scratch_space(module, &autokey)
|
||||
| GLWE::decrypt_scratch_space(module, &ct)
|
||||
| GLWE::encrypt_sk_scratch_space(module, &ct)
|
||||
| GLWE::automorphism_inplace_scratch_space(module, &ct, &autokey),
|
||||
AutomorphismKey::encrypt_sk_tmp_bytes(module, &autokey)
|
||||
| GLWE::decrypt_tmp_bytes(module, &ct)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &ct)
|
||||
| GLWE::automorphism_inplace_tmp_bytes(module, &ct, &autokey),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&ct);
|
||||
|
||||
@@ -96,9 +96,9 @@ where
|
||||
};
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
LWEToGLWESwitchingKey::encrypt_sk_scratch_space(module, &lwe_to_glwe_infos)
|
||||
| GLWE::from_lwe_scratch_space(module, &glwe_infos, &lwe_infos, &lwe_to_glwe_infos)
|
||||
| GLWE::decrypt_scratch_space(module, &glwe_infos),
|
||||
LWEToGLWESwitchingKey::encrypt_sk_tmp_bytes(module, &lwe_to_glwe_infos)
|
||||
| GLWE::from_lwe_tmp_bytes(module, &glwe_infos, &lwe_infos, &lwe_to_glwe_infos)
|
||||
| GLWE::decrypt_tmp_bytes(module, &glwe_infos),
|
||||
);
|
||||
|
||||
let mut sk_glwe: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_infos);
|
||||
@@ -213,9 +213,9 @@ where
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWEToLWESwitchingKey::encrypt_sk_scratch_space(module, &glwe_to_lwe_infos)
|
||||
| LWE::from_glwe_scratch_space(module, &lwe_infos, &glwe_infos, &glwe_to_lwe_infos)
|
||||
| GLWE::decrypt_scratch_space(module, &glwe_infos),
|
||||
GLWEToLWESwitchingKey::encrypt_sk_tmp_bytes(module, &glwe_to_lwe_infos)
|
||||
| LWE::from_glwe_tmp_bytes(module, &lwe_infos, &glwe_infos, &glwe_to_lwe_infos)
|
||||
| GLWE::decrypt_tmp_bytes(module, &glwe_infos),
|
||||
);
|
||||
|
||||
let mut sk_glwe: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_infos);
|
||||
|
||||
@@ -90,7 +90,7 @@ where
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(AutomorphismKey::encrypt_sk_scratch_space(
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(AutomorphismKey::encrypt_sk_tmp_bytes(
|
||||
module, &atk_infos,
|
||||
));
|
||||
|
||||
@@ -192,7 +192,7 @@ where
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(AutomorphismKey::encrypt_sk_scratch_space(
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(AutomorphismKey::encrypt_sk_tmp_bytes(
|
||||
module, &atk_infos,
|
||||
));
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ where
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKey::encrypt_sk_scratch_space(
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKey::encrypt_sk_tmp_bytes(
|
||||
module,
|
||||
&gglwe_infos,
|
||||
));
|
||||
@@ -179,7 +179,7 @@ where
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKeyCompressed::encrypt_sk_scratch_space(
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKeyCompressed::encrypt_sk_tmp_bytes(
|
||||
module,
|
||||
&gglwe_infos,
|
||||
));
|
||||
|
||||
@@ -55,7 +55,7 @@ where
|
||||
|
||||
pt_scalar.fill_ternary_hw(0, n, &mut source_xs);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GGSW::encrypt_sk_scratch_space(module, &ggsw_infos));
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GGSW::encrypt_sk_tmp_bytes(module, &ggsw_infos));
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&ggsw_infos);
|
||||
sk.fill_ternary_prob(0.5, &mut source_xs);
|
||||
@@ -144,7 +144,7 @@ where
|
||||
|
||||
pt_scalar.fill_ternary_hw(0, n, &mut source_xs);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GGSWCompressed::encrypt_sk_scratch_space(
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(GGSWCompressed::encrypt_sk_tmp_bytes(
|
||||
module,
|
||||
&ggsw_infos,
|
||||
));
|
||||
|
||||
@@ -85,7 +85,7 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWE::encrypt_sk_scratch_space(module, &glwe_infos) | GLWE::decrypt_scratch_space(module, &glwe_infos),
|
||||
GLWE::encrypt_sk_tmp_bytes(module, &glwe_infos) | GLWE::decrypt_tmp_bytes(module, &glwe_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_infos);
|
||||
@@ -178,7 +178,7 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWECompressed::encrypt_sk_scratch_space(module, &glwe_infos) | GLWE::decrypt_scratch_space(module, &glwe_infos),
|
||||
GLWECompressed::encrypt_sk_tmp_bytes(module, &glwe_infos) | GLWE::decrypt_tmp_bytes(module, &glwe_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_infos);
|
||||
@@ -269,7 +269,7 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWE::decrypt_scratch_space(module, &glwe_infos) | GLWE::encrypt_sk_scratch_space(module, &glwe_infos),
|
||||
GLWE::decrypt_tmp_bytes(module, &glwe_infos) | GLWE::encrypt_sk_tmp_bytes(module, &glwe_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_infos);
|
||||
@@ -349,9 +349,9 @@ where
|
||||
let mut source_xu: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWE::encrypt_sk_scratch_space(module, &glwe_infos)
|
||||
| GLWE::decrypt_scratch_space(module, &glwe_infos)
|
||||
| GLWE::encrypt_pk_scratch_space(module, &glwe_infos),
|
||||
GLWE::encrypt_sk_tmp_bytes(module, &glwe_infos)
|
||||
| GLWE::decrypt_tmp_bytes(module, &glwe_infos)
|
||||
| GLWE::encrypt_pk_tmp_bytes(module, &glwe_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_infos);
|
||||
|
||||
@@ -86,7 +86,7 @@ where
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(TensorKey::encrypt_sk_scratch_space(
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(TensorKey::encrypt_sk_tmp_bytes(
|
||||
module,
|
||||
&tensor_key_infos,
|
||||
));
|
||||
@@ -204,7 +204,7 @@ where
|
||||
let mut source_xs: Source = Source::new([0u8; 32]);
|
||||
let mut source_xe: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(TensorKeyCompressed::encrypt_sk_scratch_space(
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(TensorKeyCompressed::encrypt_sk_tmp_bytes(
|
||||
module,
|
||||
&tensor_key_infos,
|
||||
));
|
||||
|
||||
@@ -121,14 +121,14 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWESwitchingKey::encrypt_sk_scratch_space(module, &gglwe_in_infos)
|
||||
| GLWESwitchingKey::external_product_scratch_space(
|
||||
GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &gglwe_in_infos)
|
||||
| GLWESwitchingKey::external_product_tmp_bytes(
|
||||
module,
|
||||
&gglwe_out_infos,
|
||||
&gglwe_in_infos,
|
||||
&ggsw_infos,
|
||||
)
|
||||
| GGSW::encrypt_sk_scratch_space(module, &ggsw_infos),
|
||||
| GGSW::encrypt_sk_tmp_bytes(module, &ggsw_infos),
|
||||
);
|
||||
|
||||
let r: usize = 1;
|
||||
@@ -292,9 +292,9 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWESwitchingKey::encrypt_sk_scratch_space(module, &gglwe_out_infos)
|
||||
| GLWESwitchingKey::external_product_inplace_scratch_space(module, &gglwe_out_infos, &ggsw_infos)
|
||||
| GGSW::encrypt_sk_scratch_space(module, &ggsw_infos),
|
||||
GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &gglwe_out_infos)
|
||||
| GLWESwitchingKey::external_product_inplace_tmp_bytes(module, &gglwe_out_infos, &ggsw_infos)
|
||||
| GGSW::encrypt_sk_tmp_bytes(module, &ggsw_infos),
|
||||
);
|
||||
|
||||
let r: usize = 1;
|
||||
|
||||
@@ -128,9 +128,9 @@ where
|
||||
pt_apply.to_mut().raw_mut()[k] = 1; //X^{k}
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ggsw_apply_infos)
|
||||
| GGSW::encrypt_sk_scratch_space(module, &ggsw_in_infos)
|
||||
| GGSW::external_product_scratch_space(module, &ggsw_out_infos, &ggsw_in_infos, &ggsw_apply_infos),
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_apply_infos)
|
||||
| GGSW::encrypt_sk_tmp_bytes(module, &ggsw_in_infos)
|
||||
| GGSW::external_product_tmp_bytes(module, &ggsw_out_infos, &ggsw_in_infos, &ggsw_apply_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc(n.into(), rank.into());
|
||||
@@ -282,9 +282,9 @@ where
|
||||
pt_apply.to_mut().raw_mut()[k] = 1; //X^{k}
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ggsw_apply_infos)
|
||||
| GGSW::encrypt_sk_scratch_space(module, &ggsw_out_infos)
|
||||
| GGSW::external_product_inplace_scratch_space(module, &ggsw_out_infos, &ggsw_apply_infos),
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_apply_infos)
|
||||
| GGSW::encrypt_sk_tmp_bytes(module, &ggsw_out_infos)
|
||||
| GGSW::external_product_inplace_tmp_bytes(module, &ggsw_out_infos, &ggsw_apply_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc(n.into(), rank.into());
|
||||
|
||||
@@ -116,9 +116,9 @@ where
|
||||
pt_ggsw.raw_mut()[k] = 1; // X^{k}
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ggsw_apply_infos)
|
||||
| GLWE::encrypt_sk_scratch_space(module, &glwe_in_infos)
|
||||
| GLWE::external_product_scratch_space(module, &glwe_out_infos, &glwe_in_infos, &ggsw_apply_infos),
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_apply_infos)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &glwe_in_infos)
|
||||
| GLWE::external_product_tmp_bytes(module, &glwe_out_infos, &glwe_in_infos, &ggsw_apply_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc(n.into(), rank.into());
|
||||
@@ -259,9 +259,9 @@ where
|
||||
pt_ggsw.raw_mut()[k] = 1; // X^{k}
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ggsw_apply_infos)
|
||||
| GLWE::encrypt_sk_scratch_space(module, &glwe_out_infos)
|
||||
| GLWE::external_product_inplace_scratch_space(module, &glwe_out_infos, &ggsw_apply_infos),
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_apply_infos)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &glwe_out_infos)
|
||||
| GLWE::external_product_inplace_tmp_bytes(module, &glwe_out_infos, &ggsw_apply_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc(n.into(), rank.into());
|
||||
|
||||
@@ -119,11 +119,11 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch_enc: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWESwitchingKey::encrypt_sk_scratch_space(module, &gglwe_s0s1_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_scratch_space(module, &gglwe_s1s2_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_scratch_space(module, &gglwe_s0s2_infos),
|
||||
GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &gglwe_s0s1_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &gglwe_s1s2_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &gglwe_s0s2_infos),
|
||||
);
|
||||
let mut scratch_apply: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKey::keyswitch_scratch_space(
|
||||
let mut scratch_apply: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKey::keyswitch_tmp_bytes(
|
||||
module,
|
||||
&gglwe_s0s1_infos,
|
||||
&gglwe_s0s2_infos,
|
||||
@@ -274,10 +274,10 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch_enc: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWESwitchingKey::encrypt_sk_scratch_space(module, &gglwe_s0s1_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_scratch_space(module, &gglwe_s1s2_infos),
|
||||
GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &gglwe_s0s1_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &gglwe_s1s2_infos),
|
||||
);
|
||||
let mut scratch_apply: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKey::keyswitch_inplace_scratch_space(
|
||||
let mut scratch_apply: ScratchOwned<B> = ScratchOwned::alloc(GLWESwitchingKey::keyswitch_inplace_tmp_bytes(
|
||||
module,
|
||||
&gglwe_s0s1_infos,
|
||||
&gglwe_s1s2_infos,
|
||||
|
||||
@@ -132,10 +132,10 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ggsw_in_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_scratch_space(module, &ksk_apply_infos)
|
||||
| TensorKey::encrypt_sk_scratch_space(module, &tsk_infos)
|
||||
| GGSW::keyswitch_scratch_space(
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_in_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &ksk_apply_infos)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tsk_infos)
|
||||
| GGSW::keyswitch_tmp_bytes(
|
||||
module,
|
||||
&ggsw_out_infos,
|
||||
&ggsw_in_infos,
|
||||
@@ -310,10 +310,10 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GGSW::encrypt_sk_scratch_space(module, &ggsw_out_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_scratch_space(module, &ksk_apply_infos)
|
||||
| TensorKey::encrypt_sk_scratch_space(module, &tsk_infos)
|
||||
| GGSW::keyswitch_inplace_scratch_space(module, &ggsw_out_infos, &ksk_apply_infos, &tsk_infos),
|
||||
GGSW::encrypt_sk_tmp_bytes(module, &ggsw_out_infos)
|
||||
| GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &ksk_apply_infos)
|
||||
| TensorKey::encrypt_sk_tmp_bytes(module, &tsk_infos)
|
||||
| GGSW::keyswitch_inplace_tmp_bytes(module, &ggsw_out_infos, &ksk_apply_infos, &tsk_infos),
|
||||
);
|
||||
|
||||
let var_xs: f64 = 0.5;
|
||||
|
||||
@@ -112,9 +112,9 @@ where
|
||||
module.vec_znx_fill_uniform(base2k, &mut pt_want.data, 0, &mut source_xa);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWESwitchingKey::encrypt_sk_scratch_space(module, &key_apply)
|
||||
| GLWE::encrypt_sk_scratch_space(module, &glwe_in_infos)
|
||||
| GLWE::keyswitch_scratch_space(module, &glwe_out_infos, &glwe_in_infos, &key_apply),
|
||||
GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &key_apply)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &glwe_in_infos)
|
||||
| GLWE::keyswitch_tmp_bytes(module, &glwe_out_infos, &glwe_in_infos, &key_apply),
|
||||
);
|
||||
|
||||
let mut sk_in: GLWESecret<Vec<u8>> = GLWESecret::alloc(n.into(), rank_in.into());
|
||||
@@ -244,9 +244,9 @@ where
|
||||
module.vec_znx_fill_uniform(base2k, &mut pt_want.data, 0, &mut source_xa);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWESwitchingKey::encrypt_sk_scratch_space(module, &key_apply_infos)
|
||||
| GLWE::encrypt_sk_scratch_space(module, &glwe_out_infos)
|
||||
| GLWE::keyswitch_inplace_scratch_space(module, &glwe_out_infos, &key_apply_infos),
|
||||
GLWESwitchingKey::encrypt_sk_tmp_bytes(module, &key_apply_infos)
|
||||
| GLWE::encrypt_sk_tmp_bytes(module, &glwe_out_infos)
|
||||
| GLWE::keyswitch_inplace_tmp_bytes(module, &glwe_out_infos, &key_apply_infos),
|
||||
);
|
||||
|
||||
let mut sk_in: GLWESecret<Vec<u8>> = GLWESecret::alloc(n.into(), rank.into());
|
||||
|
||||
@@ -99,8 +99,8 @@ where
|
||||
};
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
LWESwitchingKey::encrypt_sk_scratch_space(module, &key_apply_infos)
|
||||
| LWE::keyswitch_scratch_space(module, &lwe_out_infos, &lwe_in_infos, &key_apply_infos),
|
||||
LWESwitchingKey::encrypt_sk_tmp_bytes(module, &key_apply_infos)
|
||||
| LWE::keyswitch_tmp_bytes(module, &lwe_out_infos, &lwe_in_infos, &key_apply_infos),
|
||||
);
|
||||
|
||||
let mut sk_lwe_in: LWESecret<Vec<u8>> = LWESecret::alloc(n_lwe_in.into());
|
||||
|
||||
@@ -105,9 +105,9 @@ where
|
||||
};
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWE::encrypt_sk_scratch_space(module, &glwe_out_infos)
|
||||
| AutomorphismKey::encrypt_sk_scratch_space(module, &key_infos)
|
||||
| GLWEPacker::scratch_space(module, &glwe_out_infos, &key_infos),
|
||||
GLWE::encrypt_sk_tmp_bytes(module, &glwe_out_infos)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &key_infos)
|
||||
| GLWEPacker::tmp_bytes(module, &glwe_out_infos, &key_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_out_infos);
|
||||
|
||||
@@ -107,10 +107,10 @@ where
|
||||
let mut source_xa: Source = Source::new([0u8; 32]);
|
||||
|
||||
let mut scratch: ScratchOwned<B> = ScratchOwned::alloc(
|
||||
GLWE::encrypt_sk_scratch_space(module, &glwe_out_infos)
|
||||
| GLWE::decrypt_scratch_space(module, &glwe_out_infos)
|
||||
| AutomorphismKey::encrypt_sk_scratch_space(module, &key_infos)
|
||||
| GLWE::trace_inplace_scratch_space(module, &glwe_out_infos, &key_infos),
|
||||
GLWE::encrypt_sk_tmp_bytes(module, &glwe_out_infos)
|
||||
| GLWE::decrypt_tmp_bytes(module, &glwe_out_infos)
|
||||
| AutomorphismKey::encrypt_sk_tmp_bytes(module, &key_infos)
|
||||
| GLWE::trace_inplace_tmp_bytes(module, &glwe_out_infos, &key_infos),
|
||||
);
|
||||
|
||||
let mut sk: GLWESecret<Vec<u8>> = GLWESecret::alloc_from_infos(&glwe_out_infos);
|
||||
|
||||
Reference in New Issue
Block a user