This commit is contained in:
Pro7ech
2025-10-15 18:26:32 +02:00
parent 10817a8529
commit 2ea59310fb
57 changed files with 363 additions and 314 deletions

View File

@@ -6,7 +6,7 @@ use poulpy_hal::{
use crate::{
dist::Distribution,
layouts::{
Base2K, Degree, GLWEInfos, GLWESecret, GLWESecretToRef, GetDegree, GetDist, LWEInfos, Rank, TorusPrecision,
Base2K, GLWEInfos, GLWESecret, GLWESecretToRef, GetDist, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision,
prepared::SetDist,
},
};
@@ -31,8 +31,8 @@ impl<D: Data, B: Backend> LWEInfos for GLWESecretPrepared<D, B> {
TorusPrecision(0)
}
fn n(&self) -> Degree {
Degree(self.data.n() as u32)
fn n(&self) -> RingDegree {
RingDegree(self.data.n() as u32)
}
fn size(&self) -> usize {
@@ -47,7 +47,7 @@ impl<D: Data, B: Backend> GLWEInfos for GLWESecretPrepared<D, B> {
pub trait GLWESecretPreparedAlloc<B: Backend>
where
Self: GetDegree + SvpPPolBytesOf + SvpPPolAlloc<B>,
Self: GetRingDegree + SvpPPolBytesOf + SvpPPolAlloc<B>,
{
fn alloc_glwe_secret_prepared(&self, rank: Rank) -> GLWESecretPrepared<Vec<u8>, B> {
GLWESecretPrepared {
@@ -59,7 +59,7 @@ where
where
A: GLWEInfos,
{
assert_eq!(self.n(), infos.n());
assert_eq!(self.ring_degree(), infos.n());
self.alloc_glwe_secret_prepared(infos.rank())
}
@@ -70,12 +70,12 @@ where
where
A: GLWEInfos,
{
assert_eq!(self.n(), infos.n());
assert_eq!(self.ring_degree(), infos.n());
self.bytes_of_glwe_secret(infos.rank())
}
}
impl<B: Backend> GLWESecretPreparedAlloc<B> for Module<B> where Self: GetDegree + SvpPPolBytesOf + SvpPPolAlloc<B> {}
impl<B: Backend> GLWESecretPreparedAlloc<B> for Module<B> where Self: GetRingDegree + SvpPPolBytesOf + SvpPPolAlloc<B> {}
impl<B: Backend> GLWESecretPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
@@ -110,8 +110,8 @@ impl<B: Backend> GLWESecretPrepared<Vec<u8>, B> {
}
impl<D: Data, B: Backend> GLWESecretPrepared<D, B> {
pub fn n(&self) -> Degree {
Degree(self.data.n() as u32)
pub fn n(&self) -> RingDegree {
RingDegree(self.data.n() as u32)
}
pub fn rank(&self) -> Rank {