INNER CODE UNIT · Rust
default
pluto/ronkathon · src/algebra/field/extension/mod.rs:156
fn default() -> Self { Self { coeffs: [PrimeField::<P>::ZERO; N] } }
}
impl<const N: usize, const P: usize> GaloisField<N, P> {
/// Create a new extension field element from the given coefficients of the field in polynomial
/// form. The coefficients are expected to be from [`FiniteField`] you are extending over in the
/// order of increasing degree. For example, for a quadratic (`N=2`) extension field, the
/// coefficients are `[a, b]` where `a + b * t`.
pub const fn new(coeffs: [PrimeField<P>; N]) -> Self { Self { coeffs } }
}
/// Convert from a [`FiniteField`] element into the [`GaloisField`] field element in the natural
/// way.
impl<const N: usize, const P: usize> From<PrimeField<P>> for GaloisField<N, P> {
fn from(value: PrimeField<P>) -> Self {
let mut coeffs = [PrimeField::<P>::ZERO; N];
coeffs[0] = value;
Self { coeffs }