mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 21:26:41 +01:00
fix remaining issues before fixing tests
This commit is contained in:
@@ -67,7 +67,7 @@ pub struct GLWESwitchingKey<D: Data> {
|
||||
pub(crate) sk_out_n: usize, // Degree of sk_out
|
||||
}
|
||||
|
||||
pub(crate) trait GLWESwitchingKeySetMetaData {
|
||||
pub trait GLWESwitchingKeySetMetaData {
|
||||
fn set_sk_in_n(&mut self, sk_in_n: usize);
|
||||
fn set_sk_out_n(&mut self, sk_out_n: usize);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ impl<D: DataMut> GLWESwitchingKeySetMetaData for GLWESwitchingKey<D> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait GLWESwtichingKeyGetMetaData {
|
||||
pub trait GLWESwtichingKeyGetMetaData {
|
||||
fn sk_in_n(&self) -> usize;
|
||||
fn sk_out_n(&self) -> usize;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ use poulpy_hal::{
|
||||
|
||||
use crate::{
|
||||
dist::Distribution,
|
||||
layouts::{Base2K, GLWEInfos, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision},
|
||||
layouts::{Base2K, GLWEInfos, GetDist, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision},
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
@@ -64,6 +64,12 @@ impl<D: Data> LWEInfos for GLWESecret<D> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: Data> GetDist for GLWESecret<D> {
|
||||
fn get_dist(&self) -> Distribution {
|
||||
self.dist
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: Data> GLWEInfos for GLWESecret<D> {
|
||||
fn rank(&self) -> Rank {
|
||||
Rank(self.data.cols() as u32)
|
||||
|
||||
@@ -17,6 +17,7 @@ mod lwe_to_glwe_ksk;
|
||||
pub mod compressed;
|
||||
pub mod prepared;
|
||||
|
||||
pub use compressed::*;
|
||||
pub use gglwe_atk::*;
|
||||
pub use gglwe_ct::*;
|
||||
pub use gglwe_ksk::*;
|
||||
@@ -32,6 +33,7 @@ pub use lwe_ksk::*;
|
||||
pub use lwe_pt::*;
|
||||
pub use lwe_sk::*;
|
||||
pub use lwe_to_glwe_ksk::*;
|
||||
pub use prepared::*;
|
||||
|
||||
use poulpy_hal::layouts::{Backend, Module};
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ where
|
||||
impl<B: Backend> TensorKeyPrepare<B> for Module<B> where Self: GLWESwitchingKeyPrepare<B> {}
|
||||
|
||||
impl<B: Backend> TensorKeyPrepared<Vec<u8>, B> {
|
||||
fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A) -> usize
|
||||
pub fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A) -> usize
|
||||
where
|
||||
A: GGLWEInfos,
|
||||
M: TensorKeyPrepare<B>,
|
||||
@@ -208,7 +208,7 @@ impl<B: Backend> TensorKeyPrepared<Vec<u8>, B> {
|
||||
}
|
||||
|
||||
impl<D: DataMut, B: Backend> TensorKeyPrepared<D, B> {
|
||||
fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
where
|
||||
O: TensorKeyToRef,
|
||||
M: TensorKeyPrepare<B>,
|
||||
|
||||
@@ -18,7 +18,7 @@ pub struct GLWEPublicKeyPrepared<D: Data, B: Backend> {
|
||||
pub(crate) dist: Distribution,
|
||||
}
|
||||
|
||||
pub(crate) trait SetDist {
|
||||
pub trait SetDist {
|
||||
fn set_dist(&mut self, dist: Distribution);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ where
|
||||
self.alloc_glwe_secret_prepared(infos.rank())
|
||||
}
|
||||
|
||||
fn bytes_of_glwe_secret(&self, rank: Rank) -> usize {
|
||||
fn bytes_of_glwe_secret_prepared(&self, rank: Rank) -> usize {
|
||||
self.bytes_of_svp_ppol(rank.into())
|
||||
}
|
||||
fn bytes_of_glwe_secret_prepared_from_infos<A>(&self, infos: &A) -> usize
|
||||
@@ -71,7 +71,7 @@ where
|
||||
A: GLWEInfos,
|
||||
{
|
||||
assert_eq!(self.ring_degree(), infos.n());
|
||||
self.bytes_of_glwe_secret(infos.rank())
|
||||
self.bytes_of_glwe_secret_prepared(infos.rank())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl<B: Backend> GLWESecretPrepared<Vec<u8>, B> {
|
||||
where
|
||||
M: GLWESecretPreparedAlloc<B>,
|
||||
{
|
||||
module.bytes_of_glwe_secret(rank)
|
||||
module.bytes_of_glwe_secret_prepared(rank)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ impl<B: Backend> GLWEToLWESwitchingKeyPrepared<Vec<u8>, B> {
|
||||
}
|
||||
|
||||
impl<D: DataMut, B: Backend> GLWEToLWESwitchingKeyPrepared<D, B> {
|
||||
fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
where
|
||||
O: GLWEToLWESwitchingKeyToRef,
|
||||
M: GLWEToLWESwitchingKeyPrepare<B>,
|
||||
|
||||
@@ -180,7 +180,7 @@ impl<B: Backend> LWESwitchingKeyPrepared<Vec<u8>, B> {
|
||||
}
|
||||
|
||||
impl<D: DataMut, B: Backend> LWESwitchingKeyPrepared<D, B> {
|
||||
fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
where
|
||||
O: LWESwitchingKeyToRef,
|
||||
M: LWESwitchingKeyPrepare<B>,
|
||||
|
||||
@@ -179,7 +179,7 @@ impl<B: Backend> LWEToGLWESwitchingKeyPrepared<Vec<u8>, B> {
|
||||
}
|
||||
|
||||
impl<D: DataMut, B: Backend> LWEToGLWESwitchingKeyPrepared<D, B> {
|
||||
fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
where
|
||||
O: LWEToGLWESwitchingKeyToRef,
|
||||
M: LWEToGLWESwitchingKeyPrepare<B>,
|
||||
|
||||
Reference in New Issue
Block a user