update trait name

This commit is contained in:
Pro7ech
2025-10-21 10:22:50 +02:00
parent db3b20b8f6
commit 681ec7e349
38 changed files with 210 additions and 210 deletions

View File

@@ -57,7 +57,7 @@ impl<D: Data, B: Backend> GGLWEInfos for GGLWEPrepared<D, B> {
}
}
pub trait GGLWEPreparedAlloc<BE: Backend>
pub trait GGLWEPreparedFactory<BE: Backend>
where
Self: GetDegree + VmpPMatAlloc<BE> + VmpPMatBytesOf + VmpPrepare<BE> + VmpPrepareTmpBytes,
{
@@ -178,7 +178,7 @@ where
}
}
impl<BE: Backend> GGLWEPreparedAlloc<BE> for Module<BE> where
impl<BE: Backend> GGLWEPreparedFactory<BE> for Module<BE> where
Module<BE>: GetDegree + VmpPMatAlloc<BE> + VmpPMatBytesOf + VmpPrepare<BE> + VmpPrepareTmpBytes
{
}
@@ -187,7 +187,7 @@ impl<B: Backend> GGLWEPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGLWEInfos,
M: GGLWEPreparedAlloc<B>,
M: GGLWEPreparedFactory<B>,
{
module.alloc_gglwe_prepared_from_infos(infos)
}
@@ -202,7 +202,7 @@ impl<B: Backend> GGLWEPrepared<Vec<u8>, B> {
dsize: Dsize,
) -> Self
where
M: GGLWEPreparedAlloc<B>,
M: GGLWEPreparedFactory<B>,
{
module.alloc_gglwe_prepared(base2k, k, rank_in, rank_out, dnum, dsize)
}
@@ -210,7 +210,7 @@ impl<B: Backend> GGLWEPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: GGLWEPreparedAlloc<B>,
M: GGLWEPreparedFactory<B>,
{
module.bytes_of_gglwe_prepared_from_infos(infos)
}
@@ -225,7 +225,7 @@ impl<B: Backend> GGLWEPrepared<Vec<u8>, B> {
dsize: Dsize,
) -> usize
where
M: GGLWEPreparedAlloc<B>,
M: GGLWEPreparedFactory<B>,
{
module.bytes_of_gglwe_prepared(base2k, k, rank_in, rank_out, dnum, dsize)
}
@@ -235,7 +235,7 @@ impl<D: DataMut, B: Backend> GGLWEPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: GGLWEToRef,
M: GGLWEPreparedAlloc<B>,
M: GGLWEPreparedFactory<B>,
{
module.prepare_gglwe(self, other, scratch);
}
@@ -244,7 +244,7 @@ impl<D: DataMut, B: Backend> GGLWEPrepared<D, B> {
impl<B: Backend> GGLWEPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<M>(&self, module: &M) -> usize
where
M: GGLWEPreparedAlloc<B>,
M: GGLWEPreparedFactory<B>,
{
module.prepare_gglwe_tmp_bytes(self)
}

View File

@@ -49,7 +49,7 @@ impl<D: Data, B: Backend> GGSWInfos for GGSWPrepared<D, B> {
}
}
pub trait GGSWPreparedAlloc<B: Backend>
pub trait GGSWPreparedFactory<B: Backend>
where
Self: GetDegree + VmpPMatAlloc<B> + VmpPMatBytesOf + VmpPrepareTmpBytes + VmpPrepare<B>,
{
@@ -162,7 +162,7 @@ where
}
}
impl<B: Backend> GGSWPreparedAlloc<B> for Module<B> where
impl<B: Backend> GGSWPreparedFactory<B> for Module<B> where
Self: GetDegree + VmpPMatAlloc<B> + VmpPMatBytesOf + VmpPrepareTmpBytes + VmpPrepare<B>
{
}
@@ -171,14 +171,14 @@ impl<B: Backend> GGSWPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGSWInfos,
M: GGSWPreparedAlloc<B>,
M: GGSWPreparedFactory<B>,
{
module.alloc_ggsw_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, dnum: Dnum, dsize: Dsize, rank: Rank) -> Self
where
M: GGSWPreparedAlloc<B>,
M: GGSWPreparedFactory<B>,
{
module.alloc_ggsw_prepared(base2k, k, dnum, dsize, rank)
}
@@ -186,14 +186,14 @@ impl<B: Backend> GGSWPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGSWInfos,
M: GGSWPreparedAlloc<B>,
M: GGSWPreparedFactory<B>,
{
module.bytes_of_ggsw_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, dnum: Dnum, dsize: Dsize, rank: Rank) -> usize
where
M: GGSWPreparedAlloc<B>,
M: GGSWPreparedFactory<B>,
{
module.bytes_of_ggsw_prepared(base2k, k, dnum, dsize, rank)
}
@@ -209,7 +209,7 @@ impl<B: Backend> GGSWPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A) -> usize
where
A: GGSWInfos,
M: GGSWPreparedAlloc<B>,
M: GGSWPreparedFactory<B>,
{
module.ggsw_prepare_tmp_bytes(infos)
}
@@ -219,7 +219,7 @@ impl<D: DataMut, B: Backend> GGSWPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: GGSWToRef,
M: GGSWPreparedAlloc<B>,
M: GGSWPreparedFactory<B>,
{
module.ggsw_prepare(self, other, scratch);
}

View File

@@ -36,7 +36,7 @@ impl<D: Data, B: Backend> GLWEInfos for GLWEPrepared<D, B> {
}
}
pub trait GLWEPreparedAlloc<B: Backend>
pub trait GLWEPreparedFactory<B: Backend>
where
Self: GetDegree + VecZnxDftAlloc<B> + VecZnxDftBytesOf + VecZnxDftApply<B>,
{
@@ -88,20 +88,20 @@ where
}
}
impl<B: Backend> GLWEPreparedAlloc<B> for Module<B> where Self: VecZnxDftAlloc<B> + VecZnxDftBytesOf + VecZnxDftApply<B> {}
impl<B: Backend> GLWEPreparedFactory<B> for Module<B> where Self: VecZnxDftAlloc<B> + VecZnxDftBytesOf + VecZnxDftApply<B> {}
impl<B: Backend> GLWEPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GLWEInfos,
M: GLWEPreparedAlloc<B>,
M: GLWEPreparedFactory<B>,
{
module.alloc_glwe_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank: Rank) -> Self
where
M: GLWEPreparedAlloc<B>,
M: GLWEPreparedFactory<B>,
{
module.alloc_glwe_prepared(base2k, k, rank)
}
@@ -109,14 +109,14 @@ impl<B: Backend> GLWEPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GLWEInfos,
M: GLWEPreparedAlloc<B>,
M: GLWEPreparedFactory<B>,
{
module.bytes_of_glwe_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank: Rank) -> usize
where
M: GLWEPreparedAlloc<B>,
M: GLWEPreparedFactory<B>,
{
module.bytes_of_glwe_prepared(base2k, k, rank)
}
@@ -126,7 +126,7 @@ impl<D: DataMut, B: Backend> GLWEPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O)
where
O: GLWEToRef,
M: GLWEPreparedAlloc<B>,
M: GLWEPreparedFactory<B>,
{
module.prepare_glwe(self, other);
}

View File

@@ -1,7 +1,7 @@
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
use crate::layouts::{
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEPrepared, GGLWEPreparedAlloc, GGLWEPreparedToMut, GGLWEPreparedToRef,
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEPrepared, GGLWEPreparedFactory, GGLWEPreparedToMut, GGLWEPreparedToRef,
GGLWEToRef, GLWEInfos, GetGaloisElement, LWEInfos, Rank, SetGaloisElement, TorusPrecision,
};
@@ -65,9 +65,9 @@ impl<D: Data, B: Backend> GGLWEInfos for GLWEAutomorphismKeyPrepared<D, B> {
}
}
pub trait GLWEAutomorphismKeyPreparedApi<B: Backend>
pub trait GLWEAutomorphismKeyPreparedFactory<B: Backend>
where
Self: GGLWEPreparedAlloc<B>,
Self: GGLWEPreparedFactory<B>,
{
fn alloc_automorphism_key_prepared(
&self,
@@ -147,20 +147,20 @@ where
}
}
impl<B: Backend> GLWEAutomorphismKeyPreparedApi<B> for Module<B> where Module<B>: GGLWEPreparedAlloc<B> {}
impl<B: Backend> GLWEAutomorphismKeyPreparedFactory<B> for Module<B> where Module<B>: GGLWEPreparedFactory<B> {}
impl<B: Backend> GLWEAutomorphismKeyPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGLWEInfos,
M: GLWEAutomorphismKeyPreparedApi<B>,
M: GLWEAutomorphismKeyPreparedFactory<B>,
{
module.alloc_automorphism_key_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank: Rank, dnum: Dnum, dsize: Dsize) -> Self
where
M: GLWEAutomorphismKeyPreparedApi<B>,
M: GLWEAutomorphismKeyPreparedFactory<B>,
{
module.alloc_automorphism_key_prepared(base2k, k, rank, dnum, dsize)
}
@@ -168,14 +168,14 @@ impl<B: Backend> GLWEAutomorphismKeyPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: GLWEAutomorphismKeyPreparedApi<B>,
M: GLWEAutomorphismKeyPreparedFactory<B>,
{
module.bytes_of_automorphism_key_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank: Rank, dnum: Dnum, dsize: Dsize) -> usize
where
M: GLWEAutomorphismKeyPreparedApi<B>,
M: GLWEAutomorphismKeyPreparedFactory<B>,
{
module.bytes_of_automorphism_key_prepared(base2k, k, rank, dnum, dsize)
}
@@ -184,7 +184,7 @@ impl<B: Backend> GLWEAutomorphismKeyPrepared<Vec<u8>, B> {
impl<B: Backend> GLWEAutomorphismKeyPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<M>(&self, module: &M) -> usize
where
M: GLWEAutomorphismKeyPreparedApi<B>,
M: GLWEAutomorphismKeyPreparedFactory<B>,
{
module.prepare_automorphism_key_tmp_bytes(self)
}
@@ -194,7 +194,7 @@ impl<D: DataMut, B: Backend> GLWEAutomorphismKeyPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: GGLWEToRef + GetGaloisElement,
M: GLWEAutomorphismKeyPreparedApi<B>,
M: GLWEAutomorphismKeyPreparedFactory<B>,
{
module.prepare_automorphism_key(self, other, scratch);
}

View File

@@ -7,7 +7,7 @@ use crate::{
GetDistribution, GetDistributionMut,
dist::Distribution,
layouts::{
Base2K, Degree, GLWEInfos, GLWEPrepared, GLWEPreparedAlloc, GLWEPreparedToMut, GLWEPreparedToRef, GLWEToRef, GetDegree,
Base2K, Degree, GLWEInfos, GLWEPrepared, GLWEPreparedFactory, GLWEPreparedToMut, GLWEPreparedToRef, GLWEToRef, GetDegree,
LWEInfos, Rank, TorusPrecision,
},
};
@@ -54,9 +54,9 @@ impl<D: Data, B: Backend> GLWEInfos for GLWEPublicKeyPrepared<D, B> {
}
}
pub trait GLWEPublicKeyPreparedAlloc<B: Backend>
pub trait GLWEPublicKeyPreparedFactory<B: Backend>
where
Self: GetDegree + GLWEPreparedAlloc<B>,
Self: GetDegree + GLWEPreparedFactory<B>,
{
fn alloc_glwe_public_key_prepared(&self, base2k: Base2K, k: TorusPrecision, rank: Rank) -> GLWEPublicKeyPrepared<Vec<u8>, B> {
GLWEPublicKeyPrepared {
@@ -93,20 +93,20 @@ where
}
}
impl<B: Backend> GLWEPublicKeyPreparedAlloc<B> for Module<B> where Self: VecZnxDftAlloc<B> + VecZnxDftBytesOf + VecZnxDftApply<B> {}
impl<B: Backend> GLWEPublicKeyPreparedFactory<B> for Module<B> where Self: VecZnxDftAlloc<B> + VecZnxDftBytesOf + VecZnxDftApply<B> {}
impl<B: Backend> GLWEPublicKeyPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GLWEInfos,
M: GLWEPublicKeyPreparedAlloc<B>,
M: GLWEPublicKeyPreparedFactory<B>,
{
module.alloc_glwe_public_key_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank: Rank) -> Self
where
M: GLWEPublicKeyPreparedAlloc<B>,
M: GLWEPublicKeyPreparedFactory<B>,
{
module.alloc_glwe_public_key_prepared(base2k, k, rank)
}
@@ -114,14 +114,14 @@ impl<B: Backend> GLWEPublicKeyPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GLWEInfos,
M: GLWEPublicKeyPreparedAlloc<B>,
M: GLWEPublicKeyPreparedFactory<B>,
{
module.bytes_of_glwe_public_key_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank: Rank) -> usize
where
M: GLWEPublicKeyPreparedAlloc<B>,
M: GLWEPublicKeyPreparedFactory<B>,
{
module.bytes_of_glwe_public_key_prepared(base2k, k, rank)
}
@@ -131,7 +131,7 @@ impl<D: DataMut, B: Backend> GLWEPublicKeyPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O)
where
O: GLWEToRef + GetDistribution,
M: GLWEPublicKeyPreparedAlloc<B>,
M: GLWEPublicKeyPreparedFactory<B>,
{
module.prepare_glwe_public_key(self, other);
}

View File

@@ -49,7 +49,7 @@ impl<D: Data, B: Backend> GLWEInfos for GLWESecretPrepared<D, B> {
}
}
pub trait GLWESecretPreparedApi<B: Backend>
pub trait GLWESecretPreparedFactory<B: Backend>
where
Self: GetDegree + SvpPPolBytesOf + SvpPPolAlloc<B> + SvpPrepare<B>,
{
@@ -96,20 +96,20 @@ where
}
}
impl<B: Backend> GLWESecretPreparedApi<B> for Module<B> where Self: GetDegree + SvpPPolBytesOf + SvpPPolAlloc<B> + SvpPrepare<B> {}
impl<B: Backend> GLWESecretPreparedFactory<B> for Module<B> where Self: GetDegree + SvpPPolBytesOf + SvpPPolAlloc<B> + SvpPrepare<B> {}
impl<B: Backend> GLWESecretPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GLWEInfos,
M: GLWESecretPreparedApi<B>,
M: GLWESecretPreparedFactory<B>,
{
module.alloc_glwe_secret_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, rank: Rank) -> Self
where
M: GLWESecretPreparedApi<B>,
M: GLWESecretPreparedFactory<B>,
{
module.alloc_glwe_secret_prepared(rank)
}
@@ -117,14 +117,14 @@ impl<B: Backend> GLWESecretPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GLWEInfos,
M: GLWESecretPreparedApi<B>,
M: GLWESecretPreparedFactory<B>,
{
module.bytes_of_glwe_secret_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, rank: Rank) -> usize
where
M: GLWESecretPreparedApi<B>,
M: GLWESecretPreparedFactory<B>,
{
module.bytes_of_glwe_secret_prepared(rank)
}
@@ -143,7 +143,7 @@ impl<D: Data, B: Backend> GLWESecretPrepared<D, B> {
impl<D: DataMut, B: Backend> GLWESecretPrepared<D, B> {
pub fn prepare<M, O>(&mut self, module: &M, other: &O)
where
M: GLWESecretPreparedApi<B>,
M: GLWESecretPreparedFactory<B>,
O: GLWESecretToRef + GetDistribution,
{
module.prepare_glwe_secret(self, other);

View File

@@ -3,7 +3,7 @@ use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
use crate::layouts::{
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEToRef, GLWEInfos, GLWESwitchingKeyDegrees, GLWESwitchingKeyDegreesMut,
LWEInfos, Rank, TorusPrecision,
prepared::{GGLWEPrepared, GGLWEPreparedAlloc, GGLWEPreparedToMut, GGLWEPreparedToRef},
prepared::{GGLWEPrepared, GGLWEPreparedFactory, GGLWEPreparedToMut, GGLWEPreparedToRef},
};
#[derive(PartialEq, Eq)]
@@ -75,9 +75,9 @@ impl<D: Data, B: Backend> GGLWEInfos for GLWESwitchingKeyPrepared<D, B> {
}
}
pub trait GLWESwitchingKeyPreparedAlloc<B: Backend>
pub trait GLWESwitchingKeyPreparedFactory<B: Backend>
where
Self: GGLWEPreparedAlloc<B>,
Self: GGLWEPreparedFactory<B>,
{
fn alloc_glwe_switching_key_prepared(
&self,
@@ -153,13 +153,13 @@ where
}
}
impl<B: Backend> GLWESwitchingKeyPreparedAlloc<B> for Module<B> where Self: GGLWEPreparedAlloc<B> {}
impl<B: Backend> GLWESwitchingKeyPreparedFactory<B> for Module<B> where Self: GGLWEPreparedFactory<B> {}
impl<B: Backend> GLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGLWEInfos,
M: GLWESwitchingKeyPreparedAlloc<B>,
M: GLWESwitchingKeyPreparedFactory<B>,
{
module.alloc_glwe_switching_key_prepared_from_infos(infos)
}
@@ -174,7 +174,7 @@ impl<B: Backend> GLWESwitchingKeyPrepared<Vec<u8>, B> {
dsize: Dsize,
) -> Self
where
M: GLWESwitchingKeyPreparedAlloc<B>,
M: GLWESwitchingKeyPreparedFactory<B>,
{
module.alloc_glwe_switching_key_prepared(base2k, k, rank_in, rank_out, dnum, dsize)
}
@@ -182,7 +182,7 @@ impl<B: Backend> GLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: GLWESwitchingKeyPreparedAlloc<B>,
M: GLWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_glwe_switching_key_prepared_from_infos(infos)
}
@@ -197,7 +197,7 @@ impl<B: Backend> GLWESwitchingKeyPrepared<Vec<u8>, B> {
dsize: Dsize,
) -> usize
where
M: GLWESwitchingKeyPreparedAlloc<B>,
M: GLWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_glwe_switching_key_prepared(base2k, k, rank_in, rank_out, dnum, dsize)
}
@@ -207,7 +207,7 @@ impl<D: DataMut, B: Backend> GLWESwitchingKeyPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: GGLWEToRef + GLWESwitchingKeyDegrees,
M: GLWESwitchingKeyPreparedAlloc<B>,
M: GLWESwitchingKeyPreparedFactory<B>,
{
module.prepare_glwe_switching(self, other, scratch);
}
@@ -216,7 +216,7 @@ impl<D: DataMut, B: Backend> GLWESwitchingKeyPrepared<D, B> {
impl<B: Backend> GLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<M>(&self, module: &M) -> usize
where
M: GLWESwitchingKeyPreparedAlloc<B>,
M: GLWESwitchingKeyPreparedFactory<B>,
{
module.prepare_glwe_switching_key_tmp_bytes(self)
}

View File

@@ -1,7 +1,7 @@
use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
use crate::layouts::{
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEPrepared, GGLWEPreparedAlloc, GGLWEPreparedToMut, GGLWEPreparedToRef,
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEPrepared, GGLWEPreparedFactory, GGLWEPreparedToMut, GGLWEPreparedToRef,
GLWEInfos, LWEInfos, Rank, TensorKey, TensorKeyToRef, TorusPrecision,
};
@@ -52,9 +52,9 @@ impl<D: Data, B: Backend> GGLWEInfos for TensorKeyPrepared<D, B> {
}
}
pub trait TensorKeyPreparedAlloc<B: Backend>
pub trait TensorKeyPreparedFactory<B: Backend>
where
Self: GGLWEPreparedAlloc<B>,
Self: GGLWEPreparedFactory<B>,
{
fn alloc_tensor_key_prepared(
&self,
@@ -131,20 +131,20 @@ where
}
}
impl<B: Backend> TensorKeyPreparedAlloc<B> for Module<B> where Module<B>: GGLWEPreparedAlloc<B> {}
impl<B: Backend> TensorKeyPreparedFactory<B> for Module<B> where Module<B>: GGLWEPreparedFactory<B> {}
impl<B: Backend> TensorKeyPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGLWEInfos,
M: TensorKeyPreparedAlloc<B>,
M: TensorKeyPreparedFactory<B>,
{
module.alloc_tensor_key_prepared_from_infos(infos)
}
pub fn alloc_with<M>(module: &M, base2k: Base2K, k: TorusPrecision, dnum: Dnum, dsize: Dsize, rank: Rank) -> Self
where
M: TensorKeyPreparedAlloc<B>,
M: TensorKeyPreparedFactory<B>,
{
module.alloc_tensor_key_prepared(base2k, k, dnum, dsize, rank)
}
@@ -152,14 +152,14 @@ impl<B: Backend> TensorKeyPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: TensorKeyPreparedAlloc<B>,
M: TensorKeyPreparedFactory<B>,
{
module.bytes_of_tensor_key_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank: Rank, dnum: Dnum, dsize: Dsize) -> usize
where
M: TensorKeyPreparedAlloc<B>,
M: TensorKeyPreparedFactory<B>,
{
module.bytes_of_tensor_key_prepared(base2k, k, rank, dnum, dsize)
}
@@ -191,7 +191,7 @@ impl<B: Backend> TensorKeyPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: TensorKeyPreparedAlloc<B>,
M: TensorKeyPreparedFactory<B>,
{
module.prepare_tensor_key_tmp_bytes(infos)
}
@@ -201,7 +201,7 @@ impl<D: DataMut, B: Backend> TensorKeyPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: TensorKeyToRef,
M: TensorKeyPreparedAlloc<B>,
M: TensorKeyPreparedFactory<B>,
{
module.prepare_tensor_key(self, other, scratch);
}

View File

@@ -3,7 +3,7 @@ use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
use crate::layouts::{
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEPrepared, GGLWEPreparedToMut, GGLWEPreparedToRef, GGLWEToRef, GLWEInfos,
GLWESwitchingKeyDegrees, GLWESwitchingKeyDegreesMut, LWEInfos, Rank, TorusPrecision,
prepared::{GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc},
prepared::{GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedFactory},
};
#[derive(PartialEq, Eq)]
@@ -51,9 +51,9 @@ impl<D: Data, B: Backend> GGLWEInfos for GLWEToLWESwitchingKeyPrepared<D, B> {
}
}
pub trait GLWEToLWESwitchingKeyPreparedAlloc<B: Backend>
pub trait GLWEToLWESwitchingKeyPreparedFactory<B: Backend>
where
Self: GLWESwitchingKeyPreparedAlloc<B>,
Self: GLWESwitchingKeyPreparedFactory<B>,
{
fn alloc_glwe_to_lwe_switching_key_prepared(
&self,
@@ -118,20 +118,20 @@ where
}
}
impl<B: Backend> GLWEToLWESwitchingKeyPreparedAlloc<B> for Module<B> where Self: GLWESwitchingKeyPreparedAlloc<B> {}
impl<B: Backend> GLWEToLWESwitchingKeyPreparedFactory<B> for Module<B> where Self: GLWESwitchingKeyPreparedFactory<B> {}
impl<B: Backend> GLWEToLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGLWEInfos,
M: GLWEToLWESwitchingKeyPreparedAlloc<B>,
M: GLWEToLWESwitchingKeyPreparedFactory<B>,
{
module.alloc_glwe_to_lwe_switching_key_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank_in: Rank, dnum: Dnum) -> Self
where
M: GLWEToLWESwitchingKeyPreparedAlloc<B>,
M: GLWEToLWESwitchingKeyPreparedFactory<B>,
{
module.alloc_glwe_to_lwe_switching_key_prepared(base2k, k, rank_in, dnum)
}
@@ -139,14 +139,14 @@ impl<B: Backend> GLWEToLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: GLWEToLWESwitchingKeyPreparedAlloc<B>,
M: GLWEToLWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_glwe_to_lwe_switching_key_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank_in: Rank, dnum: Dnum) -> usize
where
M: GLWEToLWESwitchingKeyPreparedAlloc<B>,
M: GLWEToLWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_glwe_to_lwe_switching_key_prepared(base2k, k, rank_in, dnum)
}
@@ -156,7 +156,7 @@ impl<B: Backend> GLWEToLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A)
where
A: GGLWEInfos,
M: GLWEToLWESwitchingKeyPreparedAlloc<B>,
M: GLWEToLWESwitchingKeyPreparedFactory<B>,
{
module.prepare_glwe_to_lwe_switching_key_tmp_bytes(infos);
}
@@ -166,7 +166,7 @@ impl<D: DataMut, B: Backend> GLWEToLWESwitchingKeyPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: GGLWEToRef + GLWESwitchingKeyDegrees,
M: GLWEToLWESwitchingKeyPreparedAlloc<B>,
M: GLWEToLWESwitchingKeyPreparedFactory<B>,
{
module.prepare_glwe_to_lwe_switching_key(self, other, scratch);
}

View File

@@ -3,7 +3,7 @@ use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
use crate::layouts::{
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEPrepared, GGLWEPreparedToMut, GGLWEPreparedToRef, GGLWEToRef, GLWEInfos,
GLWESwitchingKeyDegrees, GLWESwitchingKeyDegreesMut, LWEInfos, Rank, TorusPrecision,
prepared::{GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc},
prepared::{GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedFactory},
};
#[derive(PartialEq, Eq)]
@@ -50,9 +50,9 @@ impl<D: Data, B: Backend> GGLWEInfos for LWESwitchingKeyPrepared<D, B> {
}
}
pub trait LWESwitchingKeyPreparedAlloc<B: Backend>
pub trait LWESwitchingKeyPreparedFactory<B: Backend>
where
Self: GLWESwitchingKeyPreparedAlloc<B>,
Self: GLWESwitchingKeyPreparedFactory<B>,
{
fn alloc_lwe_switching_key_prepared(
&self,
@@ -126,20 +126,20 @@ where
}
}
impl<B: Backend> LWESwitchingKeyPreparedAlloc<B> for Module<B> where Self: GLWESwitchingKeyPreparedAlloc<B> {}
impl<B: Backend> LWESwitchingKeyPreparedFactory<B> for Module<B> where Self: GLWESwitchingKeyPreparedFactory<B> {}
impl<B: Backend> LWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGLWEInfos,
M: LWESwitchingKeyPreparedAlloc<B>,
M: LWESwitchingKeyPreparedFactory<B>,
{
module.alloc_lwe_switching_key_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, dnum: Dnum) -> Self
where
M: LWESwitchingKeyPreparedAlloc<B>,
M: LWESwitchingKeyPreparedFactory<B>,
{
module.alloc_lwe_switching_key_prepared(base2k, k, dnum)
}
@@ -147,14 +147,14 @@ impl<B: Backend> LWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: LWESwitchingKeyPreparedAlloc<B>,
M: LWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_lwe_switching_key_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, dnum: Dnum) -> usize
where
M: LWESwitchingKeyPreparedAlloc<B>,
M: LWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_lwe_switching_key_prepared(base2k, k, dnum)
}
@@ -164,7 +164,7 @@ impl<B: Backend> LWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A)
where
A: GGLWEInfos,
M: LWESwitchingKeyPreparedAlloc<B>,
M: LWESwitchingKeyPreparedFactory<B>,
{
module.prepare_lwe_switching_key_tmp_bytes(infos);
}
@@ -174,7 +174,7 @@ impl<D: DataMut, B: Backend> LWESwitchingKeyPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: GGLWEToRef + GLWESwitchingKeyDegrees,
M: LWESwitchingKeyPreparedAlloc<B>,
M: LWESwitchingKeyPreparedFactory<B>,
{
module.prepare_lwe_switching_key(self, other, scratch);
}

View File

@@ -3,7 +3,7 @@ use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch};
use crate::layouts::{
Base2K, Degree, Dnum, Dsize, GGLWEInfos, GGLWEPrepared, GGLWEPreparedToMut, GGLWEPreparedToRef, GGLWEToRef, GLWEInfos,
GLWESwitchingKeyDegrees, GLWESwitchingKeyDegreesMut, LWEInfos, Rank, TorusPrecision,
prepared::{GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedAlloc},
prepared::{GLWESwitchingKeyPrepared, GLWESwitchingKeyPreparedFactory},
};
/// A special [GLWESwitchingKey] required to for the conversion from [LWE] to [GLWE].
@@ -52,9 +52,9 @@ impl<D: Data, B: Backend> GGLWEInfos for LWEToGLWESwitchingKeyPrepared<D, B> {
}
}
pub trait LWEToGLWESwitchingKeyPreparedAlloc<B: Backend>
pub trait LWEToGLWESwitchingKeyPreparedFactory<B: Backend>
where
Self: GLWESwitchingKeyPreparedAlloc<B>,
Self: GLWESwitchingKeyPreparedFactory<B>,
{
fn alloc_lwe_to_glwe_switching_key_prepared(
&self,
@@ -125,20 +125,20 @@ where
}
}
impl<B: Backend> LWEToGLWESwitchingKeyPreparedAlloc<B> for Module<B> where Self: GLWESwitchingKeyPreparedAlloc<B> {}
impl<B: Backend> LWEToGLWESwitchingKeyPreparedFactory<B> for Module<B> where Self: GLWESwitchingKeyPreparedFactory<B> {}
impl<B: Backend> LWEToGLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn alloc_from_infos<A, M>(module: &M, infos: &A) -> Self
where
A: GGLWEInfos,
M: LWEToGLWESwitchingKeyPreparedAlloc<B>,
M: LWEToGLWESwitchingKeyPreparedFactory<B>,
{
module.alloc_lwe_to_glwe_switching_key_prepared_from_infos(infos)
}
pub fn alloc<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank_out: Rank, dnum: Dnum) -> Self
where
M: LWEToGLWESwitchingKeyPreparedAlloc<B>,
M: LWEToGLWESwitchingKeyPreparedFactory<B>,
{
module.alloc_lwe_to_glwe_switching_key_prepared(base2k, k, rank_out, dnum)
}
@@ -146,14 +146,14 @@ impl<B: Backend> LWEToGLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn bytes_of_from_infos<A, M>(module: &M, infos: &A) -> usize
where
A: GGLWEInfos,
M: LWEToGLWESwitchingKeyPreparedAlloc<B>,
M: LWEToGLWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_lwe_to_glwe_switching_key_prepared_from_infos(infos)
}
pub fn bytes_of<M>(module: &M, base2k: Base2K, k: TorusPrecision, rank_out: Rank, dnum: Dnum) -> usize
where
M: LWEToGLWESwitchingKeyPreparedAlloc<B>,
M: LWEToGLWESwitchingKeyPreparedFactory<B>,
{
module.bytes_of_lwe_to_glwe_switching_key_prepared(base2k, k, rank_out, dnum)
}
@@ -163,7 +163,7 @@ impl<B: Backend> LWEToGLWESwitchingKeyPrepared<Vec<u8>, B> {
pub fn prepare_tmp_bytes<A, M>(&self, module: &M, infos: &A)
where
A: GGLWEInfos,
M: LWEToGLWESwitchingKeyPreparedAlloc<B>,
M: LWEToGLWESwitchingKeyPreparedFactory<B>,
{
module.prepare_lwe_to_glwe_switching_key_tmp_bytes(infos);
}
@@ -173,7 +173,7 @@ impl<D: DataMut, B: Backend> LWEToGLWESwitchingKeyPrepared<D, B> {
pub fn prepare<O, M>(&mut self, module: &M, other: &O, scratch: &mut Scratch<B>)
where
O: GGLWEToRef + GLWESwitchingKeyDegrees,
M: LWEToGLWESwitchingKeyPreparedAlloc<B>,
M: LWEToGLWESwitchingKeyPreparedFactory<B>,
{
module.prepare_lwe_to_glwe_switching_key(self, other, scratch);
}