add discretized torus & 𝕋_<N,q>[X]; organize a bit arith crate

This commit is contained in:
2025-07-22 06:22:06 +00:00
parent 188bc7fa7f
commit d60eb1dff1
12 changed files with 909 additions and 519 deletions

View File

@@ -1,6 +1,6 @@
use anyhow::Result;
use arith::{Matrix, Rq, C, R};
use arith::{Matrix, Ring, Rq, C, R};
#[derive(Clone, Debug)]
pub struct SecretKey<const Q: u64, const N: usize>(Rq<Q, N>);

View File

@@ -157,7 +157,7 @@ mod tests {
fn test_encode_encrypt_decrypt_decode() -> Result<()> {
const Q: u64 = 2u64.pow(16) + 1;
const N: usize = 16;
const T: u64 = 16;
const T: u64 = 8;
let scale_factor = C::<f64>::new(512.0, 0.0); // delta
let mut rng = rand::thread_rng();
@@ -202,7 +202,7 @@ mod tests {
fn test_add() -> Result<()> {
const Q: u64 = 2u64.pow(16) + 1;
const N: usize = 16;
const T: u64 = 10;
const T: u64 = 8;
let scale_factor = C::<f64>::new(1024.0, 0.0); // delta
let mut rng = rand::thread_rng();
@@ -245,7 +245,7 @@ mod tests {
fn test_sub() -> Result<()> {
const Q: u64 = 2u64.pow(16) + 1;
const N: usize = 16;
const T: u64 = 10;
const T: u64 = 8;
let scale_factor = C::<f64>::new(1024.0, 0.0); // delta
let mut rng = rand::thread_rng();