pub trait Field:
Copy
+ Default
+ Debug
+ PartialEq {
type Int: PrimInt + Default + Debug + From<u8> + Into<u128> + Into<Self::Long> + Truncate<u128>;
type Long: PrimInt + From<Self::Int>;
type LongLong: PrimInt;
const Q: Self::Int;
const QL: Self::Long;
const QLL: Self::LongLong;
const BARRETT_SHIFT: usize;
const BARRETT_MULTIPLIER: Self::LongLong;
// Required methods
fn small_reduce(x: Self::Int) -> Self::Int;
fn barrett_reduce(x: Self::Long) -> Self::Int;
}Expand description
Finite field with efficient modular reduction for lattice-based cryptography.
Required Associated Constants§
Sourceconst QL: Self::Long
const QL: Self::Long
Field modulus as Self::Long.
Sourceconst QLL: Self::LongLong
const QLL: Self::LongLong
Field modulus as Self::LongLong.
Sourceconst BARRETT_SHIFT: usize
const BARRETT_SHIFT: usize
Bit shift used in Barrett reduction.
Sourceconst BARRETT_MULTIPLIER: Self::LongLong
const BARRETT_MULTIPLIER: Self::LongLong
Precomputed multiplier for Barrett reduction.
Required Associated Types§
Sourcetype Int: PrimInt + Default + Debug + From<u8> + Into<u128> + Into<Self::Long> + Truncate<u128>
type Int: PrimInt + Default + Debug + From<u8> + Into<u128> + Into<Self::Long> + Truncate<u128>
Base integer type used to represent field elements
Required Methods§
Sourcefn small_reduce(x: Self::Int) -> Self::Int
fn small_reduce(x: Self::Int) -> Self::Int
Reduce a value that’s already close to the modulus range.
Sourcefn barrett_reduce(x: Self::Long) -> Self::Int
fn barrett_reduce(x: Self::Long) -> Self::Int
Reduce a wider value to a field element using Barrett reduction.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.