mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
wip
This commit is contained in:
@@ -5,7 +5,9 @@ use poulpy_hal::{
|
||||
|
||||
use crate::{
|
||||
dist::Distribution,
|
||||
layouts::{Base2K, Degree, GLWEInfos, GLWEPublicKey, GLWEPublicKeyToRef, GetDegree, GetDist, LWEInfos, Rank, TorusPrecision},
|
||||
layouts::{
|
||||
Base2K, GLWEInfos, GLWEPublicKey, GLWEPublicKeyToRef, GetDist, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
@@ -39,8 +41,8 @@ impl<D: Data, B: Backend> LWEInfos for GLWEPublicKeyPrepared<D, B> {
|
||||
self.data.size()
|
||||
}
|
||||
|
||||
fn n(&self) -> Degree {
|
||||
Degree(self.data.n() as u32)
|
||||
fn n(&self) -> RingDegree {
|
||||
RingDegree(self.data.n() as u32)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ impl<D: Data, B: Backend> GLWEInfos for GLWEPublicKeyPrepared<D, B> {
|
||||
|
||||
pub trait GLWEPublicKeyPreparedAlloc<B: Backend>
|
||||
where
|
||||
Self: GetDegree + VecZnxDftAlloc<B> + VecZnxDftBytesOf,
|
||||
Self: GetRingDegree + VecZnxDftAlloc<B> + VecZnxDftBytesOf,
|
||||
{
|
||||
fn alloc_glwe_public_key_prepared(&self, base2k: Base2K, k: TorusPrecision, rank: Rank) -> GLWEPublicKeyPrepared<Vec<u8>, B> {
|
||||
GLWEPublicKeyPrepared {
|
||||
@@ -118,7 +120,7 @@ impl<B: Backend> GLWEPublicKeyPrepared<Vec<u8>, B> {
|
||||
|
||||
pub trait GLWEPublicKeyPrepare<B: Backend>
|
||||
where
|
||||
Self: GetDegree + VecZnxDftApply<B>,
|
||||
Self: GetRingDegree + VecZnxDftApply<B>,
|
||||
{
|
||||
fn prepare_glwe_public_key<R, O>(&self, res: &mut R, other: &O)
|
||||
where
|
||||
@@ -129,8 +131,8 @@ where
|
||||
let mut res: GLWEPublicKeyPrepared<&mut [u8], B> = res.to_mut();
|
||||
let other: GLWEPublicKey<&[u8]> = other.to_ref();
|
||||
|
||||
assert_eq!(res.n(), self.n());
|
||||
assert_eq!(other.n(), self.n());
|
||||
assert_eq!(res.n(), self.ring_degree());
|
||||
assert_eq!(other.n(), self.ring_degree());
|
||||
assert_eq!(res.size(), other.size());
|
||||
assert_eq!(res.k(), other.k());
|
||||
assert_eq!(res.base2k(), other.base2k());
|
||||
@@ -144,7 +146,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: Backend> GLWEPublicKeyPrepare<B> for Module<B> where Self: GetDegree + VecZnxDftApply<B> {}
|
||||
impl<B: Backend> GLWEPublicKeyPrepare<B> for Module<B> where Self: GetRingDegree + VecZnxDftApply<B> {}
|
||||
|
||||
impl<D: DataMut, B: Backend> GLWEPublicKeyPrepared<D, B> {
|
||||
pub fn prepare<O, M>(&mut self, module: &M, other: &O)
|
||||
|
||||
Reference in New Issue
Block a user