Trait risc0_zkp::field::ExtElem

source ·
pub trait ExtElem: Elem<Output = Self, Output = Self, Output = Self, Output = Self, Output = Self> + Add + AddAssign + Neg + Mul + Mul<Self::SubElem> + MulAssign + MulAssign<Self::SubElem> + Sub + SubAssign + PartialEq + Eq {
    type SubElem: Elem;

    const EXT_SIZE: usize;

    // Required methods
    fn from_subfield(elem: &Self::SubElem) -> Self;
    fn from_subelems(elems: impl IntoIterator<Item = Self::SubElem>) -> Self;
    fn subelems(&self) -> &[Self::SubElem];
}
Expand description

A field extension which can be constructed from a subfield element Elem

Represents an element of an extension field. This extension field is associated with a base field (sometimes called “subfield”) whose element type is given by the generic type parameter.

Required Associated Types§

source

type SubElem: Elem

An element of the base field

This type represents an element of the base field (sometimes called “subfield”) of this extension field.

Required Associated Constants§

source

const EXT_SIZE: usize

The degree of the field extension

This the degree of the extension field when interpreted as a vector space over the base field. Thus, an ExtElem can be represented as EXT_SIZE SubElems.

Required Methods§

source

fn from_subfield(elem: &Self::SubElem) -> Self

Interpret a base field element as an extension field element

Every SubElem is (mathematically) an ExtElem. This constructs the ExtElem equal to the given SubElem.

source

fn from_subelems(elems: impl IntoIterator<Item = Self::SubElem>) -> Self

Construct an extension field element

Construct an extension field element from a (mathematical) vector of SubElems. This vector is length EXT_SIZE.

source

fn subelems(&self) -> &[Self::SubElem]

Express an extension field element in terms of base field elements

Returns the (mathematical) vector of SubElems equal to the ExtElem. This vector is length EXT_SIZE.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl ExtElem for risc0_zkp::field::baby_bear::ExtElem

source§

const EXT_SIZE: usize = 4usize

§

type SubElem = Elem

source§

impl ExtElem for risc0_zkp::field::goldilocks::ExtElem

source§

const EXT_SIZE: usize = 2usize

§

type SubElem = Elem