openvm_pairing_guest/pairing/
line.rs#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct UnevaluatedLine<Fp2> {
pub b: Fp2,
pub c: Fp2,
}
#[derive(Clone, Copy, Debug)]
pub struct EvaluatedLine<Fp2> {
pub b: Fp2,
pub c: Fp2,
}
pub trait Evaluatable<Fp, Fp2> {
fn evaluate(&self, xy_frac: &(Fp, Fp)) -> EvaluatedLine<Fp2>;
}
impl<Fp2> IntoIterator for EvaluatedLine<Fp2> {
type Item = Fp2;
type IntoIter = core::array::IntoIter<Fp2, 2>;
fn into_iter(self) -> Self::IntoIter {
[self.b, self.c].into_iter()
}
}
pub trait FromLineMType<Fp2> {
fn from_evaluated_line_m_type(line: EvaluatedLine<Fp2>) -> Self;
}
pub trait LineMulMType<Fp2, Fp12> {
fn mul_023_by_023(l0: &EvaluatedLine<Fp2>, l1: &EvaluatedLine<Fp2>) -> [Fp2; 5];
fn mul_by_023(f: &Fp12, l: &EvaluatedLine<Fp2>) -> Fp12;
fn mul_by_02345(f: &Fp12, x: &[Fp2; 5]) -> Fp12;
}
pub trait FromLineDType<Fp2> {
fn from_evaluated_line_d_type(line: EvaluatedLine<Fp2>) -> Self;
}
pub trait LineMulDType<Fp2, Fp12> {
fn mul_013_by_013(l0: &EvaluatedLine<Fp2>, l1: &EvaluatedLine<Fp2>) -> [Fp2; 5];
fn mul_by_013(f: &Fp12, l: &EvaluatedLine<Fp2>) -> Fp12;
fn mul_by_01234(f: &Fp12, x: &[Fp2; 5]) -> Fp12;
}