This commit is contained in:
Jean-Philippe Bossuat
2025-10-16 11:25:55 +02:00
parent 919bbfd41d
commit bbc664fa38
6 changed files with 40 additions and 27 deletions

View File

@@ -8,3 +8,9 @@ pub trait ModuleNew<B: Backend> {
pub trait ModuleN {
fn n(&self) -> usize;
}
pub trait ModuleLogN where Self: ModuleN{
fn log_n(&self) -> usize{
(u64::BITS - (self.n() as u64-1).leading_zeros()) as usize
}
}

View File

@@ -2,7 +2,7 @@ use std::{fmt::Display, marker::PhantomData, ptr::NonNull};
use rand_distr::num_traits::Zero;
use crate::{GALOISGENERATOR, api::ModuleN};
use crate::{api::{ModuleLogN, ModuleN}, GALOISGENERATOR};
#[allow(clippy::missing_safety_doc)]
pub trait Backend: Sized {
@@ -86,6 +86,8 @@ where
}
}
impl<BE: Backend> ModuleLogN for Module<BE> where Self: ModuleN{}
impl<BE: Backend> CyclotomicOrder for Module<BE> where Self: ModuleN {}
pub trait GaloisElement