mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
refactoring
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "math"
|
||||
name = "rns"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
@@ -10,11 +10,10 @@ num-bigint = "0.4.6"
|
||||
num-traits = "0.2.19"
|
||||
num-integer ="0.1.46"
|
||||
prime_factorization = "1.0.5"
|
||||
itertools = "0.14.0"
|
||||
criterion = "0.5.1"
|
||||
rand_distr = "0.4.3"
|
||||
sprs = "0.11.2"
|
||||
|
||||
criterion = {workspace = true}
|
||||
itertools = {workspace = true}
|
||||
rand_distr = {workspace = true}
|
||||
sampling = { path = "../sampling" }
|
||||
utils = { path = "../utils" }
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
||||
use math::modulus::WordOps;
|
||||
use math::poly::Poly;
|
||||
use math::ring::Ring;
|
||||
use rns::modulus::WordOps;
|
||||
use rns::poly::Poly;
|
||||
use rns::ring::Ring;
|
||||
|
||||
fn ntt(c: &mut Criterion) {
|
||||
fn runner<'a, const INPLACE: bool, const LAZY: bool>(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
||||
use math::modulus::montgomery::Montgomery;
|
||||
use math::modulus::{WordOps, ONCE};
|
||||
use math::poly::Poly;
|
||||
use math::ring::Ring;
|
||||
use rns::modulus::montgomery::Montgomery;
|
||||
use rns::modulus::{WordOps, ONCE};
|
||||
use rns::poly::Poly;
|
||||
use rns::ring::Ring;
|
||||
|
||||
fn a_add_b_into_b(c: &mut Criterion) {
|
||||
fn runner(ring: Ring<u64>) -> Box<dyn FnMut()> {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use math::poly::PolyRNS;
|
||||
use math::ring::RingRNS;
|
||||
use rns::poly::PolyRNS;
|
||||
use rns::ring::RingRNS;
|
||||
|
||||
fn div_floor_by_last_modulus_ntt_true(c: &mut Criterion) {
|
||||
fn runner(r: RingRNS<u64>) -> Box<dyn FnMut()> {
|
||||
let a: PolyRNS<u64> = r.new_polyrns();
|
||||
let mut b: [math::poly::Poly<u64>; 2] = [r.new_poly(), r.new_poly()];
|
||||
let mut b: [rns::poly::Poly<u64>; 2] = [r.new_poly(), r.new_poly()];
|
||||
let mut c: PolyRNS<u64> = r.new_polyrns();
|
||||
|
||||
Box::new(move || r.div_by_last_modulus::<false, true>(&a, &mut b, &mut c))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use math::poly::PolyRNS;
|
||||
use math::ring::RingRNS;
|
||||
use rns::poly::PolyRNS;
|
||||
use rns::ring::RingRNS;
|
||||
use sampling::source::Source;
|
||||
|
||||
fn fill_uniform(c: &mut Criterion) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use math::dft::ntt::Table;
|
||||
use math::modulus::prime::Prime;
|
||||
use math::ring::Ring;
|
||||
use rns::dft::ntt::Table;
|
||||
use rns::modulus::prime::Prime;
|
||||
use rns::ring::Ring;
|
||||
|
||||
fn main() {
|
||||
// Example usage of `Prime<u64>`
|
||||
@@ -37,8 +37,8 @@ fn main() {
|
||||
|
||||
let r: Ring<u64> = Ring::<u64>::new(n as usize, q_base, q_power);
|
||||
|
||||
let mut p0: math::poly::Poly<u64> = r.new_poly();
|
||||
let mut p1: math::poly::Poly<u64> = r.new_poly();
|
||||
let mut p0: rns::poly::Poly<u64> = r.new_poly();
|
||||
let mut p1: rns::poly::Poly<u64> = r.new_poly();
|
||||
|
||||
for i in 0..p0.n() {
|
||||
p0.0[i] = i as u64
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use itertools::izip;
|
||||
use math::automorphism::AutoPerm;
|
||||
use math::poly::Poly;
|
||||
use math::ring::Ring;
|
||||
use rns::automorphism::AutoPerm;
|
||||
use rns::poly::Poly;
|
||||
use rns::ring::Ring;
|
||||
|
||||
#[test]
|
||||
fn automorphism_u64() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use itertools::izip;
|
||||
use math::modulus::{WordOps, ONCE};
|
||||
use math::poly::Poly;
|
||||
use math::ring::Ring;
|
||||
use rns::modulus::{WordOps, ONCE};
|
||||
use rns::poly::Poly;
|
||||
use rns::ring::Ring;
|
||||
use sampling::source::Source;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use itertools::izip;
|
||||
use math::num_bigint::Div;
|
||||
use math::poly::{Poly, PolyRNS};
|
||||
use math::ring::RingRNS;
|
||||
use num_bigint::BigInt;
|
||||
use rns::num_bigint::Div;
|
||||
use rns::poly::{Poly, PolyRNS};
|
||||
use rns::ring::RingRNS;
|
||||
use sampling::source::Source;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use math::poly::Poly;
|
||||
use math::ring::Ring;
|
||||
use rns::poly::Poly;
|
||||
use rns::ring::Ring;
|
||||
|
||||
#[test]
|
||||
fn ring_switch_u64() {
|
||||
|
||||
Reference in New Issue
Block a user