pub trait ExtensionField<F: Field>:
Field
+ From<F>
+ TryInto<F>
+ Add<F, Output = Self>
+ Sub<F, Output = Self>
+ Mul<F, Output = Self>
+ AddAssign<F>
+ SubAssign<F>
+ MulAssign<F> {
type Iterator: Iterator<Item = F>;
const LOG_DEGREE: usize;
const DEGREE: usize = _;
// Required methods
fn basis(i: usize) -> Result<Self, Error>;
fn from_bases_sparse(
base_elems: &[F],
log_stride: usize,
) -> Result<Self, Error>;
fn iter_bases(&self) -> Self::Iterator;
// Provided method
fn from_bases(base_elems: &[F]) -> Result<Self, Error> { ... }
}
Required Associated Constants§
Sourceconst LOG_DEGREE: usize
const LOG_DEGREE: usize
Base-2 logarithm of the extension degree.
Provided Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn basis(i: usize) -> Result<Self, Error>
fn basis(i: usize) -> Result<Self, Error>
For 0 <= i < DEGREE
, returns i
-th basis field element.
Sourcefn from_bases_sparse(base_elems: &[F], log_stride: usize) -> Result<Self, Error>
fn from_bases_sparse(base_elems: &[F], log_stride: usize) -> Result<Self, Error>
A specialized version of from_bases
which assumes that only base field
elements with indices dividing 2^log_stride
can be nonzero.
base_elems
should have length at most ceil(DEGREE / 2^LOG_STRIDE)
. Note that
ExtensionField::from_bases
is a special case of from_bases_sparse
with log_stride = 0
.
Sourcefn iter_bases(&self) -> Self::Iterator
fn iter_bases(&self) -> Self::Iterator
Iterator over base field elements.
Provided Methods§
Sourcefn from_bases(base_elems: &[F]) -> Result<Self, Error>
fn from_bases(base_elems: &[F]) -> Result<Self, Error>
Create an extension field element from a slice of base field elements in order
consistent with basis(i)
return values.
Potentially faster than taking an inner product with a vector of basis elements.
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.