pub trait FieldExtension<BaseField> {
type Coeffs: Sized;
const D: usize;
// Required methods
fn from_coeffs(coeffs: Self::Coeffs) -> Self;
fn from_bytes(bytes: &[u8]) -> Self;
fn to_coeffs(self) -> Self::Coeffs;
fn to_bytes(&self) -> Vec<u8>;
fn embed(base_elem: BaseField) -> Self;
fn frobenius_map(&self, power: usize) -> Self;
fn mul_base(&self, rhs: &BaseField) -> Self;
}
Expand description
Field extension trait. BaseField is the base field of the extension field.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn from_coeffs(coeffs: Self::Coeffs) -> Self
fn from_coeffs(coeffs: Self::Coeffs) -> Self
Create an extension field element from its base field coefficients.
Sourcefn from_bytes(bytes: &[u8]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
Create an extension field element from little-endian bytes.
Sourcefn to_coeffs(self) -> Self::Coeffs
fn to_coeffs(self) -> Self::Coeffs
Convert an extension field element to its base field coefficients.
Sourcefn embed(base_elem: BaseField) -> Self
fn embed(base_elem: BaseField) -> Self
Embed a base field element into an extension field element.
Sourcefn frobenius_map(&self, power: usize) -> Self
fn frobenius_map(&self, power: usize) -> Self
Frobenius map: take self
to the p^power
th power, where p
is the prime characteristic of the field.
Sourcefn mul_base(&self, rhs: &BaseField) -> Self
fn mul_base(&self, rhs: &BaseField) -> Self
Multiply an extension field element by an element in the base field
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.
Implementations on Foreign Types§
Source§impl FieldExtension<Fp2> for Fq12
impl FieldExtension<Fp2> for Fq12
Note that halo2curves does not implement Field
for Fq6, so we need to implement the intermediate points manually.
FieldExtension for Fq12 with Fq2 as base field since halo2curves does not implement Field
for Fq6.
Source§fn frobenius_map(&self, power: usize) -> Self
fn frobenius_map(&self, power: usize) -> Self
Raises this element to p^power, where p is prime characteristic of Self
.
const D: usize = 6usize
type Coeffs = [Fp2; 6]
fn from_coeffs(coeffs: [Fq2; 6]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
fn to_coeffs(self) -> Self::Coeffs
fn to_bytes(&self) -> Vec<u8>
fn embed(base_elem: Fq2) -> Self
fn mul_base(&self, rhs: &Fq2) -> Self
Source§impl FieldExtension<Fp> for Fq2
impl FieldExtension<Fp> for Fq2
FieldExtension for Fq2 with Fq as base field
const D: usize = 2usize
type Coeffs = [Fp; 2]
fn from_coeffs(coeffs: [Fq; 2]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
fn to_coeffs(self) -> Self::Coeffs
fn to_bytes(&self) -> Vec<u8>
fn embed(c0: Fq) -> Self
fn frobenius_map(&self, power: usize) -> Self
fn mul_base(&self, rhs: &Fq) -> Self
Source§impl FieldExtension<Fq2> for Fq12
impl FieldExtension<Fq2> for Fq12
FieldExtension for Fq12 with Fq6 as base field since halo2curves does not implement Field
for Fq6.
const D: usize = 6usize
type Coeffs = [Fq2; 6]
fn from_coeffs(coeffs: Self::Coeffs) -> Self
fn from_bytes(bytes: &[u8]) -> Self
fn to_coeffs(self) -> Self::Coeffs
fn to_bytes(&self) -> Vec<u8>
fn embed(c0: Fq2) -> Self
fn frobenius_map(&self, power: usize) -> Self
fn mul_base(&self, rhs: &Fq2) -> Self
Source§impl FieldExtension<Fq> for Fq2
impl FieldExtension<Fq> for Fq2
FieldExtension for Fq2 with Fq as base field