mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Various improvement to memory management and API
[module]: added enum for backend [VecZnx, VecZnxDft, VecZnxBig, VmpPMat]: added ptr to data [VecZnxBorrow]: removed [VecZnxAPI]: removed
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use base2k::{Encoding, FFT64, SvpPPolOps, VecZnx, VecZnxApi};
|
||||
use base2k::{Encoding, SvpPPolOps, VecZnx, alloc_aligned};
|
||||
use rlwe::{
|
||||
ciphertext::Ciphertext,
|
||||
elem::ElemCommon,
|
||||
@@ -10,6 +10,7 @@ use sampling::source::Source;
|
||||
|
||||
fn main() {
|
||||
let params_lit: ParametersLiteral = ParametersLiteral {
|
||||
backend: base2k::MODULETYPE::FFT64,
|
||||
log_n: 10,
|
||||
log_q: 54,
|
||||
log_p: 0,
|
||||
@@ -19,13 +20,12 @@ fn main() {
|
||||
xs: 128,
|
||||
};
|
||||
|
||||
let params: Parameters = Parameters::new::<FFT64>(¶ms_lit);
|
||||
let params: Parameters = Parameters::new(¶ms_lit);
|
||||
|
||||
let mut tmp_bytes: Vec<u8> = vec![
|
||||
0u8;
|
||||
let mut tmp_bytes: Vec<u8> = alloc_aligned(
|
||||
params.decrypt_rlwe_tmp_byte(params.log_q())
|
||||
| params.encrypt_rlwe_sk_tmp_bytes(params.log_q())
|
||||
];
|
||||
| params.encrypt_rlwe_sk_tmp_bytes(params.log_q()),
|
||||
);
|
||||
|
||||
let mut source: Source = Source::new([0; 32]);
|
||||
let mut sk: SecretKey = SecretKey::new(params.module());
|
||||
@@ -35,7 +35,7 @@ fn main() {
|
||||
|
||||
want.iter_mut().enumerate().for_each(|(i, x)| *x = i as i64);
|
||||
|
||||
let mut pt: Plaintext<VecZnx> = params.new_plaintext(params.log_q());
|
||||
let mut pt: Plaintext = params.new_plaintext(params.log_q());
|
||||
|
||||
let log_base2k = pt.log_base2k();
|
||||
|
||||
@@ -56,7 +56,7 @@ fn main() {
|
||||
let mut sk_svp_ppol: base2k::SvpPPol = params.module().new_svp_ppol();
|
||||
params.module().svp_prepare(&mut sk_svp_ppol, &sk.0);
|
||||
|
||||
params.encrypt_rlwe_sk_thread_safe(
|
||||
params.encrypt_rlwe_sk(
|
||||
&mut ct,
|
||||
Some(&pt),
|
||||
&sk_svp_ppol,
|
||||
@@ -66,7 +66,6 @@ fn main() {
|
||||
);
|
||||
|
||||
params.decrypt_rlwe(&mut pt, &ct, &sk_svp_ppol, &mut tmp_bytes);
|
||||
|
||||
pt.0.value[0].print(pt.cols(), 16);
|
||||
|
||||
let mut have = vec![i64::default(); params.n()];
|
||||
|
||||
Reference in New Issue
Block a user