mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
wip
This commit is contained in:
@@ -38,7 +38,7 @@ impl<D: DataRef, T: UnsignedInteger> LWEInfos for FheUintBlocks<D, T> {
|
||||
self.blocks[0].k()
|
||||
}
|
||||
|
||||
fn n(&self) -> poulpy_core::layouts::Degree {
|
||||
fn n(&self) -> poulpy_core::layouts::RingDegree {
|
||||
self.blocks[0].n()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ impl<D: DataRef, T: UnsignedInteger, B: Backend> LWEInfos for FheUintBlocksPrep<
|
||||
self.blocks[0].k()
|
||||
}
|
||||
|
||||
fn n(&self) -> poulpy_core::layouts::Degree {
|
||||
fn n(&self) -> poulpy_core::layouts::RingDegree {
|
||||
self.blocks[0].n()
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ impl<D: DataRef, T: UnsignedInteger> LWEInfos for FheUintBlocksPrepDebug<D, T> {
|
||||
self.blocks[0].k()
|
||||
}
|
||||
|
||||
fn n(&self) -> poulpy_core::layouts::Degree {
|
||||
fn n(&self) -> poulpy_core::layouts::RingDegree {
|
||||
self.blocks[0].n()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ impl<D: DataRef, T: UnsignedInteger> LWEInfos for FheUintWord<D, T> {
|
||||
self.0.k()
|
||||
}
|
||||
|
||||
fn n(&self) -> poulpy_core::layouts::Degree {
|
||||
fn n(&self) -> poulpy_core::layouts::RingDegree {
|
||||
self.0.n()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#[cfg(test)]
|
||||
use poulpy_core::layouts::{
|
||||
AutomorphismKeyLayout, Base2K, Degree, Dnum, Dsize, GGSWLayout, GLWELayout, GLWEToLWEKeyLayout, Rank,
|
||||
TensorKeyLayout, TorusPrecision,
|
||||
AutomorphismKeyLayout, Base2K, Dnum, Dsize, GGSWLayout, GLWELayout, GLWEToLWEKeyLayout, Rank, RingDegree, TensorKeyLayout,
|
||||
TorusPrecision,
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -26,7 +26,7 @@ pub(crate) const TEST_RANK: u32 = 2;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) static TEST_GLWE_INFOS: GLWELayout = GLWELayout {
|
||||
n: Degree(TEST_N_GLWE),
|
||||
n: RingDegree(TEST_N_GLWE),
|
||||
base2k: Base2K(TEST_BASE2K),
|
||||
k: TorusPrecision(TEST_K_GLWE),
|
||||
rank: Rank(TEST_RANK),
|
||||
@@ -34,7 +34,7 @@ pub(crate) static TEST_GLWE_INFOS: GLWELayout = GLWELayout {
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) static TEST_GGSW_INFOS: GGSWLayout = GGSWLayout {
|
||||
n: Degree(TEST_N_GLWE),
|
||||
n: RingDegree(TEST_N_GLWE),
|
||||
base2k: Base2K(TEST_BASE2K),
|
||||
k: TorusPrecision(TEST_K_GGSW),
|
||||
rank: Rank(TEST_RANK),
|
||||
@@ -46,15 +46,15 @@ pub(crate) static TEST_GGSW_INFOS: GGSWLayout = GGSWLayout {
|
||||
pub(crate) static TEST_BDD_KEY_LAYOUT: BDDKeyLayout = BDDKeyLayout {
|
||||
cbt: CircuitBootstrappingKeyLayout {
|
||||
layout_brk: BlindRotationKeyLayout {
|
||||
n_glwe: Degree(TEST_N_GLWE),
|
||||
n_lwe: Degree(TEST_N_LWE),
|
||||
n_glwe: RingDegree(TEST_N_GLWE),
|
||||
n_lwe: RingDegree(TEST_N_LWE),
|
||||
base2k: Base2K(TEST_BASE2K),
|
||||
k: TorusPrecision(52),
|
||||
dnum: Dnum(3),
|
||||
rank: Rank(TEST_RANK),
|
||||
},
|
||||
layout_atk: AutomorphismKeyLayout {
|
||||
n: Degree(TEST_N_GLWE),
|
||||
n: RingDegree(TEST_N_GLWE),
|
||||
base2k: Base2K(TEST_BASE2K),
|
||||
k: TorusPrecision(52),
|
||||
rank: Rank(TEST_RANK),
|
||||
@@ -62,7 +62,7 @@ pub(crate) static TEST_BDD_KEY_LAYOUT: BDDKeyLayout = BDDKeyLayout {
|
||||
dsize: Dsize(1),
|
||||
},
|
||||
layout_tsk: TensorKeyLayout {
|
||||
n: Degree(TEST_N_GLWE),
|
||||
n: RingDegree(TEST_N_GLWE),
|
||||
base2k: Base2K(TEST_BASE2K),
|
||||
k: TorusPrecision(52),
|
||||
rank: Rank(TEST_RANK),
|
||||
@@ -71,7 +71,7 @@ pub(crate) static TEST_BDD_KEY_LAYOUT: BDDKeyLayout = BDDKeyLayout {
|
||||
},
|
||||
},
|
||||
ks: GLWEToLWEKeyLayout {
|
||||
n: Degree(TEST_N_GLWE),
|
||||
n: RingDegree(TEST_N_GLWE),
|
||||
base2k: Base2K(TEST_BASE2K),
|
||||
k: TorusPrecision(39),
|
||||
rank_in: Rank(TEST_RANK),
|
||||
|
||||
@@ -13,7 +13,7 @@ use poulpy_hal::{
|
||||
|
||||
use poulpy_core::{
|
||||
Distribution, GLWEOperations, TakeGLWE,
|
||||
layouts::{GGSWInfos, GLWE, GLWEInfos, GLWEToMut, LWE, LWEToRef, LWEInfos},
|
||||
layouts::{GGSWInfos, GLWE, GLWEInfos, GLWEToMut, LWE, LWEInfos, LWEToRef},
|
||||
};
|
||||
|
||||
use crate::tfhe::blind_rotation::{
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::{fmt, marker::PhantomData};
|
||||
use poulpy_core::{
|
||||
Distribution,
|
||||
layouts::{
|
||||
Base2K, Degree, Dnum, Dsize, GGSW, GGSWInfos, GLWEInfos, LWEInfos, LWESecret, Rank, TorusPrecision,
|
||||
Base2K, Dnum, Dsize, GGSW, GGSWInfos, GLWEInfos, LWEInfos, LWESecret, Rank, RingDegree, TorusPrecision,
|
||||
prepared::GLWESecretPrepared,
|
||||
},
|
||||
};
|
||||
@@ -19,8 +19,8 @@ use crate::tfhe::blind_rotation::BlindRotationAlgo;
|
||||
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
pub struct BlindRotationKeyLayout {
|
||||
pub n_glwe: Degree,
|
||||
pub n_lwe: Degree,
|
||||
pub n_glwe: RingDegree,
|
||||
pub n_lwe: RingDegree,
|
||||
pub base2k: Base2K,
|
||||
pub k: TorusPrecision,
|
||||
pub dnum: Dnum,
|
||||
@@ -28,11 +28,11 @@ pub struct BlindRotationKeyLayout {
|
||||
}
|
||||
|
||||
impl BlindRotationKeyInfos for BlindRotationKeyLayout {
|
||||
fn n_glwe(&self) -> Degree {
|
||||
fn n_glwe(&self) -> RingDegree {
|
||||
self.n_glwe
|
||||
}
|
||||
|
||||
fn n_lwe(&self) -> Degree {
|
||||
fn n_lwe(&self) -> RingDegree {
|
||||
self.n_lwe
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ impl LWEInfos for BlindRotationKeyLayout {
|
||||
self.k
|
||||
}
|
||||
|
||||
fn n(&self) -> Degree {
|
||||
fn n(&self) -> RingDegree {
|
||||
self.n_glwe
|
||||
}
|
||||
}
|
||||
@@ -71,8 +71,8 @@ pub trait BlindRotationKeyInfos
|
||||
where
|
||||
Self: GGSWInfos,
|
||||
{
|
||||
fn n_glwe(&self) -> Degree;
|
||||
fn n_lwe(&self) -> Degree;
|
||||
fn n_glwe(&self) -> RingDegree;
|
||||
fn n_lwe(&self) -> RingDegree;
|
||||
}
|
||||
|
||||
pub trait BlindRotationKeyAlloc {
|
||||
@@ -178,12 +178,12 @@ impl<D: DataRef, BRT: BlindRotationAlgo> WriterTo for BlindRotationKey<D, BRT> {
|
||||
}
|
||||
|
||||
impl<D: DataRef, BRT: BlindRotationAlgo> BlindRotationKeyInfos for BlindRotationKey<D, BRT> {
|
||||
fn n_glwe(&self) -> Degree {
|
||||
fn n_glwe(&self) -> RingDegree {
|
||||
self.n()
|
||||
}
|
||||
|
||||
fn n_lwe(&self) -> Degree {
|
||||
Degree(self.keys.len() as u32)
|
||||
fn n_lwe(&self) -> RingDegree {
|
||||
RingDegree(self.keys.len() as u32)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ impl<D: DataRef, BRT: BlindRotationAlgo> LWEInfos for BlindRotationKey<D, BRT> {
|
||||
self.keys[0].k()
|
||||
}
|
||||
|
||||
fn n(&self) -> Degree {
|
||||
fn n(&self) -> RingDegree {
|
||||
self.keys[0].n()
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::{fmt, marker::PhantomData};
|
||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||
use poulpy_core::{
|
||||
Distribution,
|
||||
layouts::{Base2K, Degree, Dsize, GGSWInfos, GLWEInfos, LWEInfos, TorusPrecision, compressed::GGSWCompressed},
|
||||
layouts::{Base2K, Dsize, GGSWInfos, GLWEInfos, LWEInfos, RingDegree, TorusPrecision, compressed::GGSWCompressed},
|
||||
};
|
||||
|
||||
use crate::tfhe::blind_rotation::{BlindRotationAlgo, BlindRotationKeyInfos};
|
||||
@@ -94,17 +94,17 @@ impl<D: DataRef, BRT: BlindRotationAlgo> WriterTo for BlindRotationKeyCompressed
|
||||
}
|
||||
|
||||
impl<D: DataRef, BRA: BlindRotationAlgo> BlindRotationKeyInfos for BlindRotationKeyCompressed<D, BRA> {
|
||||
fn n_glwe(&self) -> Degree {
|
||||
fn n_glwe(&self) -> RingDegree {
|
||||
self.n()
|
||||
}
|
||||
|
||||
fn n_lwe(&self) -> Degree {
|
||||
Degree(self.keys.len() as u32)
|
||||
fn n_lwe(&self) -> RingDegree {
|
||||
RingDegree(self.keys.len() as u32)
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: DataRef, BRA: BlindRotationAlgo> LWEInfos for BlindRotationKeyCompressed<D, BRA> {
|
||||
fn n(&self) -> Degree {
|
||||
fn n(&self) -> RingDegree {
|
||||
self.keys[0].n()
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::marker::PhantomData;
|
||||
use poulpy_core::{
|
||||
Distribution,
|
||||
layouts::{
|
||||
Base2K, Degree, Dnum, Dsize, GGSWInfos, GLWEInfos, LWEInfos, Rank, TorusPrecision,
|
||||
Base2K, Dnum, Dsize, GGSWInfos, GLWEInfos, LWEInfos, Rank, RingDegree, TorusPrecision,
|
||||
prepared::{GGSWPrepared, Prepare, PrepareAlloc},
|
||||
},
|
||||
};
|
||||
@@ -30,12 +30,12 @@ pub struct BlindRotationKeyPrepared<D: Data, BRT: BlindRotationAlgo, B: Backend>
|
||||
}
|
||||
|
||||
impl<D: Data, BRT: BlindRotationAlgo, B: Backend> BlindRotationKeyInfos for BlindRotationKeyPrepared<D, BRT, B> {
|
||||
fn n_glwe(&self) -> Degree {
|
||||
fn n_glwe(&self) -> RingDegree {
|
||||
self.n()
|
||||
}
|
||||
|
||||
fn n_lwe(&self) -> Degree {
|
||||
Degree(self.data.len() as u32)
|
||||
fn n_lwe(&self) -> RingDegree {
|
||||
RingDegree(self.data.len() as u32)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ impl<D: Data, BRT: BlindRotationAlgo, B: Backend> LWEInfos for BlindRotationKeyP
|
||||
self.data[0].k()
|
||||
}
|
||||
|
||||
fn n(&self) -> Degree {
|
||||
fn n(&self) -> RingDegree {
|
||||
self.data[0].n()
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::tfhe::blind_rotation::{
|
||||
};
|
||||
|
||||
use poulpy_core::layouts::{
|
||||
GLWE, GLWELayout, GLWEPlaintext, GLWESecret, LWE, LWELayout, LWEToRef, LWEInfos, LWEPlaintext, LWESecret,
|
||||
GLWE, GLWELayout, GLWEPlaintext, GLWESecret, LWE, LWEInfos, LWELayout, LWEPlaintext, LWESecret, LWEToRef,
|
||||
prepared::{GLWESecretPrepared, PrepareAlloc},
|
||||
};
|
||||
|
||||
|
||||
@@ -31,9 +31,7 @@ use crate::tfhe::{
|
||||
},
|
||||
};
|
||||
|
||||
use poulpy_core::layouts::{
|
||||
AutomorphismKeyLayout, Dsize, GGSWLayout, LWELayout, TensorKeyLayout, prepared::PrepareAlloc,
|
||||
};
|
||||
use poulpy_core::layouts::{AutomorphismKeyLayout, Dsize, GGSWLayout, LWELayout, TensorKeyLayout, prepared::PrepareAlloc};
|
||||
|
||||
use poulpy_core::layouts::{
|
||||
GGSW, GLWE, GLWEPlaintext, GLWESecret, LWE, LWEPlaintext, LWESecret,
|
||||
|
||||
Reference in New Issue
Block a user