mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 21:26:41 +01:00
fixed missing implementations
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
|
||||
|
||||
use crate::layouts::{
|
||||
AutomorphismKeyToRef, Base2K, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
AutomorphismKeyToRef, Base2K, Degree, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, Rank, TorusPrecision,
|
||||
prepared::{
|
||||
GLWESwitchingKeyPrepare, GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc, GLWESwitchingKeyPreparedToMut,
|
||||
GLWESwitchingKeyPreparedToRef,
|
||||
@@ -15,7 +15,7 @@ pub struct AutomorphismKeyPrepared<D: Data, B: Backend> {
|
||||
}
|
||||
|
||||
impl<D: Data, B: Backend> LWEInfos for AutomorphismKeyPrepared<D, B> {
|
||||
fn n(&self) -> RingDegree {
|
||||
fn n(&self) -> Degree {
|
||||
self.key.n()
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::layouts::{
|
||||
Base2K, Dnum, Dsize, GGLWE, GGLWEInfos, GGLWEToRef, GLWEInfos, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGLWE, GGLWEInfos, GGLWEToRef, GLWEInfos, GetDegree, LWEInfos, Rank, TorusPrecision,
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
@@ -16,8 +16,8 @@ pub struct GGLWEPrepared<D: Data, B: Backend> {
|
||||
}
|
||||
|
||||
impl<D: Data, B: Backend> LWEInfos for GGLWEPrepared<D, B> {
|
||||
fn n(&self) -> RingDegree {
|
||||
RingDegree(self.data.n() as u32)
|
||||
fn n(&self) -> Degree {
|
||||
Degree(self.data.n() as u32)
|
||||
}
|
||||
|
||||
fn base2k(&self) -> Base2K {
|
||||
@@ -59,7 +59,7 @@ impl<D: Data, B: Backend> GGLWEInfos for GGLWEPrepared<D, B> {
|
||||
|
||||
pub trait GGLWEPreparedAlloc<B: Backend>
|
||||
where
|
||||
Self: GetRingDegree + VmpPMatAlloc<B> + VmpPMatBytesOf,
|
||||
Self: GetDegree + VmpPMatAlloc<B> + VmpPMatBytesOf,
|
||||
{
|
||||
fn alloc_gglwe_prepared(
|
||||
&self,
|
||||
@@ -149,7 +149,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: Backend> GGLWEPreparedAlloc<B> for Module<B> where Module<B>: GetRingDegree + VmpPMatAlloc<B> + VmpPMatBytesOf {}
|
||||
impl<B: Backend> GGLWEPreparedAlloc<B> for Module<B> where Module<B>: GetDegree + VmpPMatAlloc<B> + VmpPMatBytesOf {}
|
||||
|
||||
impl<B: Backend> GGLWEPrepared<Vec<u8>, B> {
|
||||
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
|
||||
@@ -201,7 +201,7 @@ impl<B: Backend> GGLWEPrepared<Vec<u8>, B> {
|
||||
|
||||
pub trait GGLWEPrepare<B: Backend>
|
||||
where
|
||||
Self: GetRingDegree + VmpPrepareTmpBytes + VmpPrepare<B>,
|
||||
Self: GetDegree + VmpPrepareTmpBytes + VmpPrepare<B>,
|
||||
{
|
||||
fn prepare_gglwe_tmp_bytes<A>(&self, infos: &A) -> usize
|
||||
where
|
||||
@@ -233,7 +233,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: Backend> GGLWEPrepare<B> for Module<B> where Self: GetRingDegree + VmpPrepareTmpBytes + VmpPrepare<B> {}
|
||||
impl<B: Backend> GGLWEPrepare<B> for Module<B> where Self: GetDegree + VmpPrepareTmpBytes + VmpPrepare<B> {}
|
||||
|
||||
impl<D: DataMut, B: Backend> GGLWEPrepared<D, B> {
|
||||
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
|
||||
|
||||
use crate::layouts::{
|
||||
Base2K, Dnum, Dsize, GGLWEInfos, GLWEInfos, GLWESwitchingKeySetMetaData, GLWESwitchingKeyToRef, GLWESwtichingKeyGetMetaData,
|
||||
LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GLWEInfos, GLWESwitchingKeySetMetaData, GLWESwitchingKeyToRef,
|
||||
GLWESwtichingKeyGetMetaData, LWEInfos, Rank, TorusPrecision,
|
||||
prepared::{GGLWEPrepare, GGLWEPrepared, GGLWEPreparedAlloc, GGLWEPreparedToMut, GGLWEPreparedToRef},
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ impl<D: DataRef, B: Backend> GLWESwtichingKeyGetMetaData for GLWESwitchingKeyPre
|
||||
}
|
||||
|
||||
impl<D: Data, B: Backend> LWEInfos for GLWESwitchingKeyPrepared<D, B> {
|
||||
fn n(&self) -> RingDegree {
|
||||
fn n(&self) -> Degree {
|
||||
self.key.n()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
|
||||
|
||||
use crate::layouts::{
|
||||
Base2K, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, Rank, RingDegree, TensorKey, TensorKeyToRef, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, Rank, TensorKey, TensorKeyToRef, TorusPrecision,
|
||||
prepared::{
|
||||
GLWESwitchingKeyPrepare, GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc, GLWESwitchingKeyPreparedToMut,
|
||||
GLWESwitchingKeyPreparedToRef,
|
||||
@@ -14,7 +14,7 @@ pub struct TensorKeyPrepared<D: Data, B: Backend> {
|
||||
}
|
||||
|
||||
impl<D: Data, B: Backend> LWEInfos for TensorKeyPrepared<D, B> {
|
||||
fn n(&self) -> RingDegree {
|
||||
fn n(&self) -> Degree {
|
||||
self.keys[0].n()
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use poulpy_hal::{
|
||||
};
|
||||
|
||||
use crate::layouts::{
|
||||
Base2K, Dnum, Dsize, GGSW, GGSWInfos, GGSWToRef, GLWEInfos, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGSW, GGSWInfos, GGSWToRef, GLWEInfos, GetDegree, LWEInfos, Rank, TorusPrecision,
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
@@ -16,8 +16,8 @@ pub struct GGSWPrepared<D: Data, B: Backend> {
|
||||
}
|
||||
|
||||
impl<D: Data, B: Backend> LWEInfos for GGSWPrepared<D, B> {
|
||||
fn n(&self) -> RingDegree {
|
||||
RingDegree(self.data.n() as u32)
|
||||
fn n(&self) -> Degree {
|
||||
Degree(self.data.n() as u32)
|
||||
}
|
||||
|
||||
fn base2k(&self) -> Base2K {
|
||||
@@ -51,7 +51,7 @@ impl<D: Data, B: Backend> GGSWInfos for GGSWPrepared<D, B> {
|
||||
|
||||
pub trait GGSWPreparedAlloc<B: Backend>
|
||||
where
|
||||
Self: GetRingDegree + VmpPMatAlloc<B> + VmpPMatBytesOf,
|
||||
Self: GetDegree + VmpPMatAlloc<B> + VmpPMatBytesOf,
|
||||
{
|
||||
fn alloc_ggsw_prepared(
|
||||
&self,
|
||||
@@ -135,7 +135,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: Backend> GGSWPreparedAlloc<B> for Module<B> where Self: GetRingDegree + VmpPMatAlloc<B> + VmpPMatBytesOf {}
|
||||
impl<B: Backend> GGSWPreparedAlloc<B> for Module<B> where Self: GetDegree + VmpPMatAlloc<B> + VmpPMatBytesOf {}
|
||||
|
||||
impl<B: Backend> GGSWPrepared<Vec<u8>, B> {
|
||||
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
|
||||
@@ -177,7 +177,7 @@ impl<D: DataRef, B: Backend> GGSWPrepared<D, B> {
|
||||
|
||||
pub trait GGSWPrepare<B: Backend>
|
||||
where
|
||||
Self: GetRingDegree + VmpPrepareTmpBytes + VmpPrepare<B>,
|
||||
Self: GetDegree + VmpPrepareTmpBytes + VmpPrepare<B>,
|
||||
{
|
||||
fn ggsw_prepare_tmp_bytes<A>(&self, infos: &A) -> usize
|
||||
where
|
||||
@@ -207,7 +207,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: Backend> GGSWPrepare<B> for Module<B> where Self: GetRingDegree + VmpPrepareTmpBytes + VmpPrepare<B> {}
|
||||
impl<B: Backend> GGSWPrepare<B> for Module<B> where Self: GetDegree + VmpPrepareTmpBytes + VmpPrepare<B> {}
|
||||
|
||||
impl<B: Backend> GGSWPrepared<Vec<u8>, B> {
|
||||
pub fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A) -> usize
|
||||
|
||||
@@ -5,9 +5,7 @@ use poulpy_hal::{
|
||||
|
||||
use crate::{
|
||||
dist::Distribution,
|
||||
layouts::{
|
||||
Base2K, GLWEInfos, GLWEPublicKey, GLWEPublicKeyToRef, GetDist, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
},
|
||||
layouts::{Base2K, Degree, GLWEInfos, GLWEPublicKey, GLWEPublicKeyToRef, GetDegree, GetDist, LWEInfos, Rank, TorusPrecision},
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
@@ -41,8 +39,8 @@ impl<D: Data, B: Backend> LWEInfos for GLWEPublicKeyPrepared<D, B> {
|
||||
self.data.size()
|
||||
}
|
||||
|
||||
fn n(&self) -> RingDegree {
|
||||
RingDegree(self.data.n() as u32)
|
||||
fn n(&self) -> Degree {
|
||||
Degree(self.data.n() as u32)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +52,7 @@ impl<D: Data, B: Backend> GLWEInfos for GLWEPublicKeyPrepared<D, B> {
|
||||
|
||||
pub trait GLWEPublicKeyPreparedAlloc<B: Backend>
|
||||
where
|
||||
Self: GetRingDegree + VecZnxDftAlloc<B> + VecZnxDftBytesOf,
|
||||
Self: GetDegree + VecZnxDftAlloc<B> + VecZnxDftBytesOf,
|
||||
{
|
||||
fn alloc_glwe_public_key_prepared(&self, base2k: Base2K, k: TorusPrecision, rank: Rank) -> GLWEPublicKeyPrepared<Vec<u8>, B> {
|
||||
GLWEPublicKeyPrepared {
|
||||
@@ -120,7 +118,7 @@ impl<B: Backend> GLWEPublicKeyPrepared<Vec<u8>, B> {
|
||||
|
||||
pub trait GLWEPublicKeyPrepare<B: Backend>
|
||||
where
|
||||
Self: GetRingDegree + VecZnxDftApply<B>,
|
||||
Self: GetDegree + VecZnxDftApply<B>,
|
||||
{
|
||||
fn prepare_glwe_public_key<R, O>(&self, res: &mut R, other: &O)
|
||||
where
|
||||
@@ -146,7 +144,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: Backend> GLWEPublicKeyPrepare<B> for Module<B> where Self: GetRingDegree + VecZnxDftApply<B> {}
|
||||
impl<B: Backend> GLWEPublicKeyPrepare<B> for Module<B> where Self: GetDegree + VecZnxDftApply<B> {}
|
||||
|
||||
impl<D: DataMut, B: Backend> GLWEPublicKeyPrepared<D, B> {
|
||||
pub fn prepare<O, M>(&mut self, module: &M, other: &O)
|
||||
|
||||
@@ -6,7 +6,7 @@ use poulpy_hal::{
|
||||
use crate::{
|
||||
dist::Distribution,
|
||||
layouts::{
|
||||
Base2K, GLWEInfos, GLWESecret, GLWESecretToRef, GetDist, GetRingDegree, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
Base2K, Degree, GLWEInfos, GLWESecret, GLWESecretToRef, GetDegree, GetDist, LWEInfos, Rank, TorusPrecision,
|
||||
prepared::SetDist,
|
||||
},
|
||||
};
|
||||
@@ -31,8 +31,8 @@ impl<D: Data, B: Backend> LWEInfos for GLWESecretPrepared<D, B> {
|
||||
TorusPrecision(0)
|
||||
}
|
||||
|
||||
fn n(&self) -> RingDegree {
|
||||
RingDegree(self.data.n() as u32)
|
||||
fn n(&self) -> Degree {
|
||||
Degree(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: GetRingDegree + SvpPPolBytesOf + SvpPPolAlloc<B>,
|
||||
Self: GetDegree + SvpPPolBytesOf + SvpPPolAlloc<B>,
|
||||
{
|
||||
fn alloc_glwe_secret_prepared(&self, rank: Rank) -> GLWESecretPrepared<Vec<u8>, B> {
|
||||
GLWESecretPrepared {
|
||||
@@ -75,7 +75,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: Backend> GLWESecretPreparedAlloc<B> for Module<B> where Self: GetRingDegree + SvpPPolBytesOf + SvpPPolAlloc<B> {}
|
||||
impl<B: Backend> GLWESecretPreparedAlloc<B> for Module<B> where Self: GetDegree + 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) -> RingDegree {
|
||||
RingDegree(self.data.n() as u32)
|
||||
pub fn n(&self) -> Degree {
|
||||
Degree(self.data.n() as u32)
|
||||
}
|
||||
|
||||
pub fn rank(&self) -> Rank {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
|
||||
|
||||
use crate::layouts::{
|
||||
Base2K, Dnum, Dsize, GGLWEInfos, GLWEInfos, GLWEToLWESwitchingKeyToRef, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GLWEInfos, GLWEToLWESwitchingKeyToRef, LWEInfos, Rank, TorusPrecision,
|
||||
prepared::{
|
||||
GLWESwitchingKeyPrepare, GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc, GLWESwitchingKeyPreparedToMut,
|
||||
GLWESwitchingKeyPreparedToRef,
|
||||
@@ -20,7 +20,7 @@ impl<D: Data, B: Backend> LWEInfos for GLWEToLWESwitchingKeyPrepared<D, B> {
|
||||
self.0.k()
|
||||
}
|
||||
|
||||
fn n(&self) -> RingDegree {
|
||||
fn n(&self) -> Degree {
|
||||
self.0.n()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
|
||||
|
||||
use crate::layouts::{
|
||||
Base2K, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, LWESwitchingKeyToRef, Rank, RingDegree, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, LWESwitchingKeyToRef, Rank, TorusPrecision,
|
||||
prepared::{
|
||||
GLWESwitchingKeyPrepare, GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc, GLWESwitchingKeyPreparedToMut,
|
||||
GLWESwitchingKeyPreparedToRef,
|
||||
@@ -20,7 +20,7 @@ impl<D: Data, B: Backend> LWEInfos for LWESwitchingKeyPrepared<D, B> {
|
||||
self.0.k()
|
||||
}
|
||||
|
||||
fn n(&self) -> RingDegree {
|
||||
fn n(&self) -> Degree {
|
||||
self.0.n()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
|
||||
|
||||
use crate::layouts::{
|
||||
Base2K, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, LWEToGLWESwitchingKeyToRef, Rank, RingDegree, TorusPrecision,
|
||||
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GLWEInfos, LWEInfos, LWEToGLWESwitchingKeyToRef, Rank, TorusPrecision,
|
||||
prepared::{
|
||||
GLWESwitchingKeyPrepare, GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc, GLWESwitchingKeyPreparedToMut,
|
||||
GLWESwitchingKeyPreparedToRef,
|
||||
@@ -21,7 +21,7 @@ impl<D: Data, B: Backend> LWEInfos for LWEToGLWESwitchingKeyPrepared<D, B> {
|
||||
self.0.k()
|
||||
}
|
||||
|
||||
fn n(&self) -> RingDegree {
|
||||
fn n(&self) -> Degree {
|
||||
self.0.n()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user