pub trait Fp2Config:
Sized
+ 'static
+ Send
+ Sync {
type Fp: PrimeField;
const NONRESIDUE: Self::Fp;
const FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp];
// Provided methods
fn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp { ... }
fn mul_fp_by_nonresidue_and_add(y: &mut Self::Fp, x: &Self::Fp) { ... }
fn mul_fp_by_nonresidue_plus_one_and_add(y: &mut Self::Fp, x: &Self::Fp) { ... }
fn sub_and_mul_fp_by_nonresidue(y: &mut Self::Fp, x: &Self::Fp) { ... }
}
Expand description
Trait that specifies constants and methods for defining degree-two extension fields.
Required Associated Constants§
Sourceconst NONRESIDUE: Self::Fp
const NONRESIDUE: Self::Fp
Quadratic non-residue in Self::Fp
used to construct the extension
field. That is, NONRESIDUE
is such that the quadratic polynomial
f(X) = X^2 - Self::NONRESIDUE
in Fp[X] is irreducible in Self::Fp
.
Sourceconst FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp]
const FROBENIUS_COEFF_FP2_C1: &'static [Self::Fp]
Coefficients for the Frobenius automorphism.
Required Associated Types§
Sourcetype Fp: PrimeField
type Fp: PrimeField
Base prime field underlying this extension.
Provided Methods§
Sourcefn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp
fn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp
Return fe * Self::NONRESIDUE
.
Intended for specialization when Self::NONRESIDUE
has a special
structure that can speed up multiplication
Sourcefn mul_fp_by_nonresidue_and_add(y: &mut Self::Fp, x: &Self::Fp)
fn mul_fp_by_nonresidue_and_add(y: &mut Self::Fp, x: &Self::Fp)
A specializable method for setting y = x + NONRESIDUE * y
.
This allows for optimizations when the non-residue is
canonically negative in the field.
Sourcefn mul_fp_by_nonresidue_plus_one_and_add(y: &mut Self::Fp, x: &Self::Fp)
fn mul_fp_by_nonresidue_plus_one_and_add(y: &mut Self::Fp, x: &Self::Fp)
A specializable method for computing x + mul_fp_by_nonresidue(y) + y This allows for optimizations when the non-residue is not -1.
Sourcefn sub_and_mul_fp_by_nonresidue(y: &mut Self::Fp, x: &Self::Fp)
fn sub_and_mul_fp_by_nonresidue(y: &mut Self::Fp, x: &Self::Fp)
A specializable method for computing x - mul_fp_by_nonresidue(y) This allows for optimizations when the non-residue is canonically negative in the 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.