Type Alias ark_ff::fields::models::fp2::Fp2

source ·
pub type Fp2<P> = QuadExtField<Fp2ConfigWrapper<P>>;
Expand description

Alias for instances of quadratic extension fields. Helpful for omitting verbose instantiations involving Fp2ConfigWrapper.

Aliased Type§

struct Fp2<P> {
    pub c0: <Fp2ConfigWrapper<P> as QuadExtConfig>::BaseField,
    pub c1: <Fp2ConfigWrapper<P> as QuadExtConfig>::BaseField,
}

Fields§

§c0: <Fp2ConfigWrapper<P> as QuadExtConfig>::BaseField

Coefficient c0 in the representation of the field element c = c0 + c1 * X

§c1: <Fp2ConfigWrapper<P> as QuadExtConfig>::BaseField

Coefficient c1 in the representation of the field element c = c0 + c1 * X

Implementations§

source§

impl<P: Fp2Config> Fp2<P>

source

pub fn mul_assign_by_fp(&mut self, other: &P::Fp)

In-place multiply both coefficients c0 and c1 of self by an element from Fp.

§Examples
let c0: Fp = Fp::rand(&mut test_rng());
let c1: Fp = Fp::rand(&mut test_rng());
let mut ext_element: Fp2 = Fp2::new(c0, c1);

let base_field_element: Fp = Fp::rand(&mut test_rng());
ext_element.mul_assign_by_fp(&base_field_element);

assert_eq!(ext_element.c0, c0 * base_field_element);
assert_eq!(ext_element.c1, c1 * base_field_element);

Trait Implementations§

source§

impl<P: Fp2Config> CyclotomicMultSubgroup for Fp2<P>

source§

const INVERSE_IS_FAST: bool = true

Is the inverse fast to compute? For example, in quadratic extensions, the inverse can be computed at the cost of negating one coordinate, which is much faster than standard inversion. By default this is false, but should be set to true for quadratic extensions.
source§

fn cyclotomic_inverse_in_place(&mut self) -> Option<&mut Self>

Compute the inverse of self. See Self::INVERSE_IS_FAST for details. Returns None if self.is_zero(), and Some otherwise. Read more
source§

fn cyclotomic_square(&self) -> Self

Compute a square in the cyclotomic subgroup. By default this is computed using Field::square, but for degree 12 extensions, this can be computed faster than normal squaring. Read more
source§

fn cyclotomic_square_in_place(&mut self) -> &mut Self

Square self in place. By default this is computed using Field::square_in_place, but for degree 12 extensions, this can be computed faster than normal squaring. Read more
source§

fn cyclotomic_inverse(&self) -> Option<Self>

Compute the inverse of self. See Self::INVERSE_IS_FAST for details. Returns None if self.is_zero(), and Some otherwise. Read more
source§

fn cyclotomic_exp(&self, e: impl AsRef<[u64]>) -> Self

Compute a cyclotomic exponentiation of self with respect to e. Read more
source§

fn cyclotomic_exp_in_place(&mut self, e: impl AsRef<[u64]>)

Set self to be the result of exponentiating self by e, using efficient cyclotomic algorithms. Read more