mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
updated repo for publishing (#74)
This commit is contained in:
committed by
GitHub
parent
0be569eca0
commit
62eb87cc07
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
|||||||
[submodule "backend/src/implementation/cpu_spqlios/spqlios-arithmetic"]
|
[submodule "poulpy-backend/src/implementation/cpu_spqlios/spqlios-arithmetic"]
|
||||||
path = backend/src/implementation/cpu_spqlios/spqlios-arithmetic
|
path = poulpy-backend/src/implementation/cpu_spqlios/spqlios-arithmetic
|
||||||
url = https://github.com/phantomzone-org/spqlios-arithmetic
|
url = https://github.com/phantomzone-org/spqlios-arithmetic
|
||||||
|
|||||||
119
Cargo.lock
generated
119
Cargo.lock
generated
@@ -35,21 +35,6 @@ version = "1.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
|
checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "backend"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"cmake",
|
|
||||||
"criterion",
|
|
||||||
"itertools 0.14.0",
|
|
||||||
"rand",
|
|
||||||
"rand_core",
|
|
||||||
"rand_distr",
|
|
||||||
"rug",
|
|
||||||
"sampling",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.9.0"
|
version = "2.9.0"
|
||||||
@@ -150,20 +135,6 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"backend",
|
|
||||||
"byteorder",
|
|
||||||
"criterion",
|
|
||||||
"itertools 0.14.0",
|
|
||||||
"rand_core",
|
|
||||||
"rand_distr",
|
|
||||||
"rug",
|
|
||||||
"sampling",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "criterion"
|
name = "criterion"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@@ -375,13 +346,73 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "poulpy"
|
name = "poulpy-backend"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backend",
|
"byteorder",
|
||||||
"core",
|
"cmake",
|
||||||
"sampling",
|
"criterion",
|
||||||
"schemes",
|
"itertools 0.14.0",
|
||||||
|
"rand",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
"rand_distr",
|
||||||
|
"rug",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "poulpy-backend"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d47fbc27d0c03c2bfffd972795c62a243e4a3a3068acdb95ef55fb335a58d00f"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"cmake",
|
||||||
|
"criterion",
|
||||||
|
"itertools 0.14.0",
|
||||||
|
"rand",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
"rand_distr",
|
||||||
|
"rug",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "poulpy-core"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"criterion",
|
||||||
|
"itertools 0.14.0",
|
||||||
|
"poulpy-backend 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core",
|
||||||
|
"rand_distr",
|
||||||
|
"rug",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "poulpy-core"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ff4e1acd3f4a84e861b07184fd28fe3143a57360bd51e923aeadbc94b8b38d0"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"criterion",
|
||||||
|
"itertools 0.14.0",
|
||||||
|
"poulpy-backend 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core",
|
||||||
|
"rand_distr",
|
||||||
|
"rug",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "poulpy-schemes"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"itertools 0.14.0",
|
||||||
|
"poulpy-backend 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"poulpy-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -532,26 +563,6 @@ dependencies = [
|
|||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sampling"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"rand_chacha",
|
|
||||||
"rand_core",
|
|
||||||
"rand_distr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "schemes"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"backend",
|
|
||||||
"byteorder",
|
|
||||||
"core",
|
|
||||||
"itertools 0.14.0",
|
|
||||||
"sampling",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.219"
|
version = "1.0.219"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = ["backend", "core", "sampling", "schemes", "poulpy"]
|
members = ["poulpy-backend", "poulpy-core", "poulpy-schemes"]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ Please see [SECURITY](./SECURITY.md).
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Poulpy is licensed under the Apache 2.0 License. See [NOTICE](./NOTICE) & [LICENSE](./LICENSE).
|
Poulpy is licensed under the Apache-2.0 License. See [NOTICE](./NOTICE) & [LICENSE](./LICENSE).
|
||||||
|
|
||||||
## Acknowledgement
|
## Acknowledgement
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "backend"
|
name = "poulpy-backend"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
readme = "README.md"
|
||||||
|
description = "A crate implementing bivariate polynomial arithmetic"
|
||||||
|
repository = "https://github.com/phantomzone-org/poulpy"
|
||||||
|
homepage = "https://github.com/phantomzone-org/poulpy"
|
||||||
|
documentation = "https://docs.rs/poulpy"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rug = {workspace = true}
|
rug = {workspace = true}
|
||||||
@@ -11,8 +16,8 @@ itertools = {workspace = true}
|
|||||||
rand = {workspace = true}
|
rand = {workspace = true}
|
||||||
rand_distr = {workspace = true}
|
rand_distr = {workspace = true}
|
||||||
rand_core = {workspace = true}
|
rand_core = {workspace = true}
|
||||||
sampling = { path = "../sampling" }
|
|
||||||
byteorder = {workspace = true}
|
byteorder = {workspace = true}
|
||||||
|
rand_chacha = "0.9.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cmake = "0.1.54"
|
cmake = "0.1.54"
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
use backend::{
|
use itertools::izip;
|
||||||
|
use poulpy_backend::{
|
||||||
hal::{
|
hal::{
|
||||||
api::{
|
api::{
|
||||||
ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow, SvpApplyInplace, SvpPPolAlloc, SvpPrepare, VecZnxAddNormal,
|
ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow, SvpApplyInplace, SvpPPolAlloc, SvpPrepare, VecZnxAddNormal,
|
||||||
@@ -6,11 +7,10 @@ use backend::{
|
|||||||
VecZnxDftAlloc, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigTmpA, VecZnxFillUniform, VecZnxNormalizeInplace, ZnxInfos,
|
VecZnxDftAlloc, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigTmpA, VecZnxFillUniform, VecZnxNormalizeInplace, ZnxInfos,
|
||||||
},
|
},
|
||||||
layouts::{Module, ScalarZnx, ScratchOwned, SvpPPol, VecZnx, VecZnxBig, VecZnxDft},
|
layouts::{Module, ScalarZnx, ScratchOwned, SvpPPol, VecZnx, VecZnxBig, VecZnxDft},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
implementation::cpu_spqlios::FFT64,
|
implementation::cpu_spqlios::FFT64,
|
||||||
};
|
};
|
||||||
use itertools::izip;
|
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let n: usize = 16;
|
let n: usize = 16;
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
use rand_distr::Distribution;
|
use rand_distr::Distribution;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::layouts::{Backend, ScalarZnxToRef, Scratch, VecZnxToMut, VecZnxToRef};
|
use crate::hal::{
|
||||||
|
layouts::{Backend, ScalarZnxToRef, Scratch, VecZnxToMut, VecZnxToRef},
|
||||||
|
source::Source,
|
||||||
|
};
|
||||||
|
|
||||||
pub trait VecZnxNormalizeTmpBytes {
|
pub trait VecZnxNormalizeTmpBytes {
|
||||||
/// Returns the minimum number of bytes necessary for normalization.
|
/// Returns the minimum number of bytes necessary for normalization.
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
use rand_distr::Distribution;
|
use rand_distr::Distribution;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::layouts::{Backend, Scratch, VecZnxBigOwned, VecZnxBigToMut, VecZnxBigToRef, VecZnxToMut, VecZnxToRef};
|
use crate::hal::{
|
||||||
|
layouts::{Backend, Scratch, VecZnxBigOwned, VecZnxBigToMut, VecZnxBigToRef, VecZnxToMut, VecZnxToRef},
|
||||||
|
source::Source,
|
||||||
|
};
|
||||||
|
|
||||||
/// Allocates as [crate::hal::layouts::VecZnxBig].
|
/// Allocates as [crate::hal::layouts::VecZnxBig].
|
||||||
pub trait VecZnxBigAlloc<B: Backend> {
|
pub trait VecZnxBigAlloc<B: Backend> {
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
use crate::hal::layouts::{Data, DataMut, DataRef};
|
use crate::hal::{
|
||||||
|
layouts::{Data, DataMut, DataRef},
|
||||||
|
source::Source,
|
||||||
|
};
|
||||||
use rand_distr::num_traits::Zero;
|
use rand_distr::num_traits::Zero;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
pub trait ZnxInfos {
|
pub trait ZnxInfos {
|
||||||
/// Returns the ring degree of the polynomials.
|
/// Returns the ring degree of the polynomials.
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::{
|
use crate::hal::{
|
||||||
api::{
|
api::{
|
||||||
VecZnxAdd, VecZnxAddDistF64, VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace, VecZnxAutomorphism,
|
VecZnxAdd, VecZnxAddDistF64, VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace, VecZnxAutomorphism,
|
||||||
@@ -17,6 +15,7 @@ use crate::hal::{
|
|||||||
VecZnxRotateImpl, VecZnxRotateInplaceImpl, VecZnxRshInplaceImpl, VecZnxSplitImpl, VecZnxSubABInplaceImpl,
|
VecZnxRotateImpl, VecZnxRotateInplaceImpl, VecZnxRshInplaceImpl, VecZnxSplitImpl, VecZnxSubABInplaceImpl,
|
||||||
VecZnxSubBAInplaceImpl, VecZnxSubImpl, VecZnxSubScalarInplaceImpl, VecZnxSwithcDegreeImpl,
|
VecZnxSubBAInplaceImpl, VecZnxSubImpl, VecZnxSubScalarInplaceImpl, VecZnxSwithcDegreeImpl,
|
||||||
},
|
},
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<B> VecZnxNormalizeTmpBytes for Module<B>
|
impl<B> VecZnxNormalizeTmpBytes for Module<B>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
use rand_distr::Distribution;
|
use rand_distr::Distribution;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::{
|
use crate::hal::{
|
||||||
api::{
|
api::{
|
||||||
@@ -18,6 +17,7 @@ use crate::hal::{
|
|||||||
VecZnxBigSubBAInplaceImpl, VecZnxBigSubImpl, VecZnxBigSubSmallAImpl, VecZnxBigSubSmallAInplaceImpl,
|
VecZnxBigSubBAInplaceImpl, VecZnxBigSubImpl, VecZnxBigSubSmallAImpl, VecZnxBigSubSmallAInplaceImpl,
|
||||||
VecZnxBigSubSmallBImpl, VecZnxBigSubSmallBInplaceImpl,
|
VecZnxBigSubSmallBImpl, VecZnxBigSubSmallBInplaceImpl,
|
||||||
},
|
},
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<B> VecZnxBigAlloc<B> for Module<B>
|
impl<B> VecZnxBigAlloc<B> for Module<B>
|
||||||
@@ -3,13 +3,13 @@ use crate::{
|
|||||||
hal::{
|
hal::{
|
||||||
api::{DataView, DataViewMut, FillUniform, Reset, ZnxInfos, ZnxSliceSize, ZnxView, ZnxViewMut, ZnxZero},
|
api::{DataView, DataViewMut, FillUniform, Reset, ZnxInfos, ZnxSliceSize, ZnxView, ZnxViewMut, ZnxZero},
|
||||||
layouts::{Data, DataMut, DataRef, ReaderFrom, ToOwnedDeep, VecZnx, WriterTo},
|
layouts::{Data, DataMut, DataRef, ReaderFrom, ToOwnedDeep, VecZnx, WriterTo},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone)]
|
#[derive(PartialEq, Eq, Clone)]
|
||||||
pub struct MatZnx<D: Data> {
|
pub struct MatZnx<D: Data> {
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
use rand_core::RngCore;
|
use rand_core::RngCore;
|
||||||
use rand_distr::{Distribution, weighted::WeightedIndex};
|
use rand_distr::{Distribution, weighted::WeightedIndex};
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
alloc_aligned,
|
alloc_aligned,
|
||||||
hal::{
|
hal::{
|
||||||
api::{DataView, DataViewMut, FillUniform, Reset, ZnxInfos, ZnxSliceSize, ZnxView, ZnxViewMut, ZnxZero},
|
api::{DataView, DataViewMut, FillUniform, Reset, ZnxInfos, ZnxSliceSize, ZnxView, ZnxViewMut, ZnxZero},
|
||||||
layouts::{Data, DataMut, DataRef, ReaderFrom, ToOwnedDeep, VecZnx, WriterTo},
|
layouts::{Data, DataMut, DataRef, ReaderFrom, ToOwnedDeep, VecZnx, WriterTo},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5,9 +5,13 @@ use crate::{
|
|||||||
hal::{
|
hal::{
|
||||||
api::{DataView, DataViewMut, FillUniform, Reset, ZnxInfos, ZnxSliceSize, ZnxView, ZnxViewMut, ZnxZero},
|
api::{DataView, DataViewMut, FillUniform, Reset, ZnxInfos, ZnxSliceSize, ZnxView, ZnxViewMut, ZnxZero},
|
||||||
layouts::{Data, DataMut, DataRef, ReaderFrom, ToOwnedDeep, WriterTo},
|
layouts::{Data, DataMut, DataRef, ReaderFrom, ToOwnedDeep, WriterTo},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||||
|
use rand::RngCore;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||||
pub struct VecZnx<D: Data> {
|
pub struct VecZnx<D: Data> {
|
||||||
pub(crate) data: D,
|
pub(crate) data: D,
|
||||||
@@ -220,10 +224,6 @@ impl<D: DataMut> VecZnxToMut for VecZnx<D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
|
||||||
use rand::RngCore;
|
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
impl<D: DataMut> ReaderFrom for VecZnx<D> {
|
impl<D: DataMut> ReaderFrom for VecZnx<D> {
|
||||||
fn read_from<R: std::io::Read>(&mut self, reader: &mut R) -> std::io::Result<()> {
|
fn read_from<R: std::io::Read>(&mut self, reader: &mut R) -> std::io::Result<()> {
|
||||||
self.n = reader.read_u64::<LittleEndian>()? as usize;
|
self.n = reader.read_u64::<LittleEndian>()? as usize;
|
||||||
@@ -2,4 +2,5 @@ pub mod api;
|
|||||||
pub mod delegates;
|
pub mod delegates;
|
||||||
pub mod layouts;
|
pub mod layouts;
|
||||||
pub mod oep;
|
pub mod oep;
|
||||||
|
pub mod source;
|
||||||
pub mod tests;
|
pub mod tests;
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
use rand_distr::Distribution;
|
use rand_distr::Distribution;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::layouts::{Backend, Module, ScalarZnxToRef, Scratch, VecZnxToMut, VecZnxToRef};
|
use crate::hal::{
|
||||||
|
layouts::{Backend, Module, ScalarZnxToRef, Scratch, VecZnxToMut, VecZnxToRef},
|
||||||
|
source::Source,
|
||||||
|
};
|
||||||
|
|
||||||
/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
|
/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
|
||||||
/// * See [vec_znx_normalize_base2k_tmp_bytes_ref](https://github.com/phantomzone-org/spqlios-arithmetic/blob/32a3f5fcce9863b58e949f2dfd5abc1bfbaa09b4/spqlios/arithmetic/vec_znx.c#L245C17-L245C55) for reference code.
|
/// * See [vec_znx_normalize_base2k_tmp_bytes_ref](https://github.com/phantomzone-org/spqlios-arithmetic/blob/32a3f5fcce9863b58e949f2dfd5abc1bfbaa09b4/spqlios/arithmetic/vec_znx.c#L245C17-L245C55) for reference code.
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
use rand_distr::Distribution;
|
use rand_distr::Distribution;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::layouts::{Backend, Module, Scratch, VecZnxBigOwned, VecZnxBigToMut, VecZnxBigToRef, VecZnxToMut, VecZnxToRef};
|
use crate::hal::{
|
||||||
|
layouts::{Backend, Module, Scratch, VecZnxBigOwned, VecZnxBigToMut, VecZnxBigToRef, VecZnxToMut, VecZnxToRef},
|
||||||
|
source::Source,
|
||||||
|
};
|
||||||
|
|
||||||
/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
|
/// # THIS TRAIT IS AN OPEN EXTENSION POINT (unsafe)
|
||||||
/// * See TODO for reference code.
|
/// * See TODO for reference code.
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::{
|
use crate::hal::{
|
||||||
api::{FillUniform, Reset},
|
api::{FillUniform, Reset},
|
||||||
layouts::{ReaderFrom, WriterTo},
|
layouts::{ReaderFrom, WriterTo},
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Generic test for serialization and deserialization.
|
/// Generic test for serialization and deserialization.
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::{
|
use crate::hal::{
|
||||||
api::{ZnxInfos, ZnxViewMut},
|
api::{ZnxInfos, ZnxViewMut},
|
||||||
layouts::VecZnx,
|
layouts::VecZnx,
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn test_vec_znx_encode_vec_i64_lo_norm() {
|
pub fn test_vec_znx_encode_vec_i64_lo_norm() {
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::hal::{
|
use crate::hal::{
|
||||||
api::{VecZnxAddNormal, VecZnxFillUniform, ZnxView},
|
api::{VecZnxAddNormal, VecZnxFillUniform, ZnxView},
|
||||||
layouts::{Backend, Module, VecZnx},
|
layouts::{Backend, Module, VecZnx},
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn test_vec_znx_fill_uniform<B: Backend>(module: &Module<B>)
|
pub fn test_vec_znx_fill_uniform<B: Backend>(module: &Module<B>)
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
use itertools::izip;
|
use itertools::izip;
|
||||||
use rand_distr::Normal;
|
use rand_distr::Normal;
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
hal::{
|
hal::{
|
||||||
@@ -18,6 +17,7 @@ use crate::{
|
|||||||
VecZnxRshInplaceImpl, VecZnxSplitImpl, VecZnxSubABInplaceImpl, VecZnxSubBAInplaceImpl, VecZnxSubImpl,
|
VecZnxRshInplaceImpl, VecZnxSplitImpl, VecZnxSubABInplaceImpl, VecZnxSubBAInplaceImpl, VecZnxSubImpl,
|
||||||
VecZnxSubScalarInplaceImpl, VecZnxSwithcDegreeImpl,
|
VecZnxSubScalarInplaceImpl, VecZnxSwithcDegreeImpl,
|
||||||
},
|
},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
implementation::cpu_spqlios::{
|
implementation::cpu_spqlios::{
|
||||||
CPUAVX,
|
CPUAVX,
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use rand_distr::{Distribution, Normal};
|
use rand_distr::{Distribution, Normal};
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
hal::{
|
hal::{
|
||||||
@@ -21,6 +20,7 @@ use crate::{
|
|||||||
VecZnxBigSubBAInplaceImpl, VecZnxBigSubImpl, VecZnxBigSubSmallAImpl, VecZnxBigSubSmallAInplaceImpl,
|
VecZnxBigSubBAInplaceImpl, VecZnxBigSubImpl, VecZnxBigSubSmallAImpl, VecZnxBigSubSmallAInplaceImpl,
|
||||||
VecZnxBigSubSmallBImpl, VecZnxBigSubSmallBInplaceImpl,
|
VecZnxBigSubSmallBImpl, VecZnxBigSubSmallBInplaceImpl,
|
||||||
},
|
},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
implementation::cpu_spqlios::{ffi::vec_znx, module_fft64::FFT64},
|
implementation::cpu_spqlios::{ffi::vec_znx, module_fft64::FFT64},
|
||||||
};
|
};
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "core"
|
name = "poulpy-core"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
description = "A crate implementing RLWE-based encrypted arithmetic"
|
||||||
|
repository = "https://github.com/phantomzone-org/poulpy"
|
||||||
|
homepage = "https://github.com/phantomzone-org/poulpy"
|
||||||
|
documentation = "https://docs.rs/poulpy"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rug = {workspace = true}
|
rug = {workspace = true}
|
||||||
criterion = {workspace = true}
|
criterion = {workspace = true}
|
||||||
backend = {path="../backend"}
|
poulpy-backend = "0.1.0"
|
||||||
sampling = {path="../sampling"}
|
|
||||||
rand_distr = {workspace = true}
|
rand_distr = {workspace = true}
|
||||||
itertools = {workspace = true}
|
itertools = {workspace = true}
|
||||||
byteorder = {workspace = true}
|
byteorder = {workspace = true}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
use core::layouts::{
|
use poulpy_core::layouts::{
|
||||||
GGSWCiphertext, GLWECiphertext, GLWESecret, Infos,
|
GGSWCiphertext, GLWECiphertext, GLWESecret, Infos,
|
||||||
prepared::{GGSWCiphertextPrepared, GLWESecretPrepared, PrepareAlloc},
|
prepared::{GGSWCiphertextPrepared, GLWESecretPrepared, PrepareAlloc},
|
||||||
};
|
};
|
||||||
use std::hint::black_box;
|
use std::hint::black_box;
|
||||||
|
|
||||||
use backend::{
|
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
|
||||||
|
use poulpy_backend::{
|
||||||
hal::{
|
hal::{
|
||||||
api::{ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow},
|
api::{ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow},
|
||||||
layouts::{Module, ScalarZnx, ScratchOwned},
|
layouts::{Module, ScalarZnx, ScratchOwned},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
implementation::cpu_spqlios::FFT64,
|
implementation::cpu_spqlios::FFT64,
|
||||||
};
|
};
|
||||||
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
|
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
fn bench_external_product_glwe_fft64(c: &mut Criterion) {
|
fn bench_external_product_glwe_fft64(c: &mut Criterion) {
|
||||||
let mut group = c.benchmark_group("external_product_glwe_fft64");
|
let mut group = c.benchmark_group("external_product_glwe_fft64");
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
use core::layouts::{
|
use poulpy_core::layouts::{
|
||||||
GGLWEAutomorphismKey, GGLWESwitchingKey, GLWECiphertext, GLWESecret, Infos,
|
GGLWEAutomorphismKey, GGLWESwitchingKey, GLWECiphertext, GLWESecret, Infos,
|
||||||
prepared::{GGLWEAutomorphismKeyPrepared, GGLWESwitchingKeyPrepared, GLWESecretPrepared, PrepareAlloc},
|
prepared::{GGLWEAutomorphismKeyPrepared, GGLWESwitchingKeyPrepared, GLWESecretPrepared, PrepareAlloc},
|
||||||
};
|
};
|
||||||
use std::{hint::black_box, time::Duration};
|
use std::{hint::black_box, time::Duration};
|
||||||
|
|
||||||
use backend::{
|
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
|
||||||
|
use poulpy_backend::{
|
||||||
hal::{
|
hal::{
|
||||||
api::{ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow},
|
api::{ModuleNew, ScratchOwnedAlloc, ScratchOwnedBorrow},
|
||||||
layouts::{Module, ScratchOwned},
|
layouts::{Module, ScratchOwned},
|
||||||
|
source::Source,
|
||||||
},
|
},
|
||||||
implementation::cpu_spqlios::FFT64,
|
implementation::cpu_spqlios::FFT64,
|
||||||
};
|
};
|
||||||
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
|
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
fn bench_keyswitch_glwe_fft64(c: &mut Criterion) {
|
||||||
let mut group = c.benchmark_group("keyswitch_glwe_fft64");
|
let mut group = c.benchmark_group("keyswitch_glwe_fft64");
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, TakeVecZnxDft, VecZnxAutomorphism, VecZnxAutomorphismInplace, VecZnxBigAddSmallInplace,
|
ScratchAvailable, TakeVecZnxDft, VecZnxAutomorphism, VecZnxAutomorphismInplace, VecZnxBigAddSmallInplace,
|
||||||
VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes, VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume,
|
VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes, VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, TakeVecZnxBig, TakeVecZnxDft, VecZnxAutomorphismInplace, VecZnxBigAddSmallInplace, VecZnxBigAllocBytes,
|
ScratchAvailable, TakeVecZnxBig, TakeVecZnxDft, VecZnxAutomorphismInplace, VecZnxBigAddSmallInplace, VecZnxBigAllocBytes,
|
||||||
VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes, VecZnxDftAddInplace, VecZnxDftAllocBytes, VecZnxDftCopy,
|
VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes, VecZnxDftAddInplace, VecZnxDftAllocBytes, VecZnxDftCopy,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, TakeVecZnxDft, VecZnxAutomorphismInplace, VecZnxBigAddSmallInplace, VecZnxBigAutomorphismInplace,
|
ScratchAvailable, TakeVecZnxDft, VecZnxAutomorphismInplace, VecZnxBigAddSmallInplace, VecZnxBigAutomorphismInplace,
|
||||||
VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes, VecZnxBigSubSmallAInplace, VecZnxBigSubSmallBInplace,
|
VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes, VecZnxBigSubSmallAInplace, VecZnxBigSubSmallBInplace,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, TakeVecZnxDft, VecZnxBigAddSmallInplace, VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes,
|
ScratchAvailable, TakeVecZnxDft, VecZnxBigAddSmallInplace, VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes,
|
||||||
VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VmpApply, VmpApplyAdd, VmpApplyTmpBytes, ZnxView,
|
VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VmpApply, VmpApplyAdd, VmpApplyTmpBytes, ZnxView,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, TakeVecZnxDft, VecZnxBigAddSmallInplace, VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes,
|
ScratchAvailable, TakeVecZnxDft, VecZnxBigAddSmallInplace, VecZnxBigNormalize, VecZnxBigNormalizeTmpBytes,
|
||||||
VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VmpApply, VmpApplyAdd, VmpApplyTmpBytes, ZnxView,
|
VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VmpApply, VmpApplyAdd, VmpApplyTmpBytes, ZnxView,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
DataViewMut, SvpApplyInplace, TakeVecZnxBig, TakeVecZnxDft, VecZnxBigAddInplace, VecZnxBigAddSmallInplace,
|
DataViewMut, SvpApplyInplace, TakeVecZnxBig, TakeVecZnxDft, VecZnxBigAddInplace, VecZnxBigAddSmallInplace,
|
||||||
VecZnxBigNormalize, VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VecZnxNormalizeTmpBytes,
|
VecZnxBigNormalize, VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VecZnxNormalizeTmpBytes,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{ScratchOwnedAlloc, ScratchOwnedBorrow, VecZnxNormalizeInplace, ZnxView, ZnxViewMut},
|
api::{ScratchOwnedAlloc, ScratchOwnedBorrow, VecZnxNormalizeInplace, ZnxView, ZnxViewMut},
|
||||||
layouts::{Backend, DataMut, DataRef, Module, ScratchOwned},
|
layouts::{Backend, DataMut, DataRef, Module, ScratchOwned},
|
||||||
oep::{ScratchOwnedAllocImpl, ScratchOwnedBorrowImpl},
|
oep::{ScratchOwnedAllocImpl, ScratchOwnedBorrowImpl},
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, SvpApplyInplace, SvpPPolAllocBytes, SvpPrepare, TakeScalarZnx, TakeVecZnx, TakeVecZnxDft,
|
ScratchAvailable, SvpApplyInplace, SvpPPolAllocBytes, SvpPrepare, TakeScalarZnx, TakeVecZnx, TakeVecZnxDft,
|
||||||
VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace, VecZnxAutomorphism, VecZnxBigNormalize, VecZnxDftAllocBytes,
|
VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace, VecZnxAutomorphism, VecZnxBigNormalize, VecZnxDftAllocBytes,
|
||||||
@@ -6,8 +6,8 @@ use backend::hal::{
|
|||||||
VecZnxNormalizeTmpBytes, VecZnxSub, VecZnxSubABInplace, VecZnxSwithcDegree,
|
VecZnxNormalizeTmpBytes, VecZnxSub, VecZnxSubABInplace, VecZnxSwithcDegree,
|
||||||
},
|
},
|
||||||
layouts::{Backend, DataMut, DataRef, Module, Scratch},
|
layouts::{Backend, DataMut, DataRef, Module, Scratch},
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
TakeGLWESecret, TakeGLWESecretPrepared,
|
TakeGLWESecret, TakeGLWESecretPrepared,
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, SvpApplyInplace, TakeVecZnx, TakeVecZnxDft, VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace,
|
ScratchAvailable, SvpApplyInplace, TakeVecZnx, TakeVecZnxDft, VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace,
|
||||||
VecZnxBigNormalize, VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VecZnxFillUniform,
|
VecZnxBigNormalize, VecZnxDftAllocBytes, VecZnxDftFromVecZnx, VecZnxDftToVecZnxBigConsume, VecZnxFillUniform,
|
||||||
VecZnxNormalize, VecZnxNormalizeInplace, VecZnxNormalizeTmpBytes, VecZnxSub, VecZnxSubABInplace, ZnxZero,
|
VecZnxNormalize, VecZnxNormalizeInplace, VecZnxNormalizeTmpBytes, VecZnxSub, VecZnxSubABInplace, ZnxZero,
|
||||||
},
|
},
|
||||||
layouts::{Backend, DataMut, DataRef, Module, ScalarZnx, Scratch},
|
layouts::{Backend, DataMut, DataRef, Module, ScalarZnx, Scratch},
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
TakeGLWEPt,
|
TakeGLWEPt,
|
||||||
@@ -53,7 +53,7 @@ impl<D: DataMut> GGLWECiphertextCompressed<D> {
|
|||||||
{
|
{
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
use backend::hal::api::ZnxInfos;
|
use poulpy_backend::hal::api::ZnxInfos;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
self.rank_in(),
|
self.rank_in(),
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use backend::hal::{
|
use poulpy_backend::hal::{
|
||||||
api::{
|
api::{
|
||||||
ScratchAvailable, SvpApplyInplace, SvpPPolAllocBytes, SvpPrepare, TakeScalarZnx, TakeVecZnx, TakeVecZnxDft,
|
ScratchAvailable, SvpApplyInplace, SvpPPolAllocBytes, SvpPrepare, TakeScalarZnx, TakeVecZnx, TakeVecZnxDft,
|
||||||
VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace, VecZnxBigNormalize, VecZnxDftAllocBytes, VecZnxDftFromVecZnx,
|
VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalarInplace, VecZnxBigNormalize, VecZnxDftAllocBytes, VecZnxDftFromVecZnx,
|
||||||
@@ -6,8 +6,8 @@ use backend::hal::{
|
|||||||
VecZnxSub, VecZnxSubABInplace, VecZnxSwithcDegree,
|
VecZnxSub, VecZnxSubABInplace, VecZnxSwithcDegree,
|
||||||
},
|
},
|
||||||
layouts::{Backend, DataMut, DataRef, Module, ScalarZnx, Scratch},
|
layouts::{Backend, DataMut, DataRef, Module, ScalarZnx, Scratch},
|
||||||
|
source::Source,
|
||||||
};
|
};
|
||||||
use sampling::source::Source;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
TakeGLWESecretPrepared,
|
TakeGLWESecretPrepared,
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user