mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
glwe operations
This commit is contained in:
@@ -9,8 +9,11 @@ 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
|
||||
pub trait ModuleLogN
|
||||
where
|
||||
Self: ModuleN,
|
||||
{
|
||||
fn log_n(&self) -> usize {
|
||||
(u64::BITS - (self.n() as u64 - 1).leading_zeros()) as usize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ use std::{fmt::Display, marker::PhantomData, ptr::NonNull};
|
||||
|
||||
use rand_distr::num_traits::Zero;
|
||||
|
||||
use crate::{api::{ModuleLogN, ModuleN}, GALOISGENERATOR};
|
||||
use crate::{
|
||||
GALOISGENERATOR,
|
||||
api::{ModuleLogN, ModuleN},
|
||||
};
|
||||
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub trait Backend: Sized {
|
||||
@@ -86,7 +89,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<BE: Backend> ModuleLogN for Module<BE> where Self: ModuleN{}
|
||||
impl<BE: Backend> ModuleLogN for Module<BE> where Self: ModuleN {}
|
||||
|
||||
impl<BE: Backend> CyclotomicOrder for Module<BE> where Self: ModuleN {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user