mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
fixed scratch API
This commit is contained in:
@@ -142,7 +142,7 @@ where
|
||||
|
||||
let mut source_xa = Source::new(seed);
|
||||
|
||||
let (mut tmp_pt, scrach_1) = scratch.take_glwe_plaintext(self, res);
|
||||
let (mut tmp_pt, scrach_1) = scratch.take_glwe_plaintext(res);
|
||||
for col_i in 0..rank_in {
|
||||
for d_i in 0..dnum {
|
||||
// Adds the scalar_znx_pt to the i-th limb of the vec_znx_pt
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
ScratchTakeCore,
|
||||
encryption::{GGSWEncryptSk, GLWEEncryptSkInternal, SIGMA},
|
||||
layouts::{
|
||||
GGSWCompressedSeedMut, GGSWInfos, GLWEInfos, LWEInfos,
|
||||
GGSWCompressedSeedMut, GGSWInfos, LWEInfos,
|
||||
compressed::{GGSWCompressed, GGSWCompressedToMut},
|
||||
prepared::{GLWESecretPrepared, GLWESecretPreparedToRef},
|
||||
},
|
||||
@@ -107,7 +107,7 @@ where
|
||||
|
||||
println!("res.seed: {:?}", res.seed);
|
||||
|
||||
let (mut tmp_pt, scratch_1) = scratch.take_glwe_plaintext(self, &res.glwe_layout());
|
||||
let (mut tmp_pt, scratch_1) = scratch.take_glwe_plaintext(res);
|
||||
|
||||
let mut source = Source::new(seed_xa);
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ where
|
||||
|
||||
let (mut sk_out_prepared, scratch_1) = scratch.take_glwe_secret_prepared(self, sk.rank());
|
||||
{
|
||||
let (mut sk_out, _) = scratch_1.take_glwe_secret(self, sk.rank());
|
||||
for i in 0..res.rank_out().into() {
|
||||
let (mut sk_out, _) = scratch_1.take_glwe_secret(self.n().into(), sk.rank());
|
||||
for i in 0..sk.rank().into() {
|
||||
self.vec_znx_automorphism(
|
||||
self.galois_element_inv(p),
|
||||
&mut sk_out.data.as_vec_znx_mut(),
|
||||
|
||||
@@ -102,7 +102,7 @@ where
|
||||
self.gglwe_compressed_encrypt_sk_tmp_bytes(res)
|
||||
);
|
||||
|
||||
let (mut sk_in_tmp, scratch_1) = scratch.take_scalar_znx(self, sk_in.rank().into());
|
||||
let (mut sk_in_tmp, scratch_1) = scratch.take_scalar_znx(self.n(), sk_in.rank().into());
|
||||
for i in 0..sk_in.rank().into() {
|
||||
self.vec_znx_switch_ring(
|
||||
&mut sk_in_tmp.as_vec_znx_mut(),
|
||||
@@ -114,7 +114,7 @@ where
|
||||
|
||||
let (mut sk_out_tmp, scratch_2) = scratch_1.take_glwe_secret_prepared(self, sk_out.rank());
|
||||
{
|
||||
let (mut tmp, _) = scratch_2.take_scalar_znx(self, 1);
|
||||
let (mut tmp, _) = scratch_2.take_scalar_znx(self.n(), 1);
|
||||
for i in 0..sk_out.rank().into() {
|
||||
self.vec_znx_switch_ring(&mut tmp.as_vec_znx_mut(), 0, &sk_out.data.as_vec_znx(), i);
|
||||
self.svp_prepare(&mut sk_out_tmp.data, i, &tmp, 0);
|
||||
|
||||
@@ -99,7 +99,7 @@ where
|
||||
R: GGLWEInfos + TensorKeyCompressedAtMut<D>,
|
||||
S: GLWESecretToRef + GetDistribution,
|
||||
{
|
||||
let (mut sk_dft_prep, scratch_1) = scratch.take_glwe_secret_prepared(self, res.rank_out());
|
||||
let (mut sk_dft_prep, scratch_1) = scratch.take_glwe_secret_prepared(self, res.rank());
|
||||
sk_dft_prep.prepare(self, sk);
|
||||
|
||||
let sk: &GLWESecret<&[u8]> = &sk.to_ref();
|
||||
@@ -120,7 +120,7 @@ where
|
||||
}
|
||||
|
||||
let (mut sk_ij_big, scratch_3) = scratch_2.take_vec_znx_big(self, 1, 1);
|
||||
let (mut sk_ij, scratch_4) = scratch_3.take_glwe_secret(self, Rank(1));
|
||||
let (mut sk_ij, scratch_4) = scratch_3.take_glwe_secret(self.n().into(), Rank(1));
|
||||
let (mut sk_ij_dft, scratch_5) = scratch_4.take_vec_znx_dft(self, 1, 1);
|
||||
|
||||
let mut source_xa: Source = Source::new(seed_xa);
|
||||
|
||||
Reference in New Issue
Block a user