openvm_pairing_guest/pairing/
line.rs1#[repr(C)]
6#[derive(Clone, Copy, Debug)]
7pub struct UnevaluatedLine<Fp2> {
8 pub b: Fp2,
9 pub c: Fp2,
10}
11
12#[derive(Clone, Copy, Debug)]
15pub struct EvaluatedLine<Fp2> {
16 pub b: Fp2,
17 pub c: Fp2,
18}
19
20pub trait Evaluatable<Fp, Fp2> {
21 fn evaluate(&self, xy_frac: &(Fp, Fp)) -> EvaluatedLine<Fp2>;
23}
24
25impl<Fp2> IntoIterator for EvaluatedLine<Fp2> {
26 type Item = Fp2;
27 type IntoIter = core::array::IntoIter<Fp2, 2>;
28 fn into_iter(self) -> Self::IntoIter {
29 [self.b, self.c].into_iter()
30 }
31}
32
33pub trait FromLineMType<Fp2> {
35 fn from_evaluated_line_m_type(line: EvaluatedLine<Fp2>) -> Self;
36}
37
38pub trait LineMulMType<Fp2, Fp12> {
40 fn mul_023_by_023(l0: &EvaluatedLine<Fp2>, l1: &EvaluatedLine<Fp2>) -> [Fp2; 5];
42
43 fn mul_by_023(f: &Fp12, l: &EvaluatedLine<Fp2>) -> Fp12;
45
46 fn mul_by_02345(f: &Fp12, x: &[Fp2; 5]) -> Fp12;
48}
49
50pub trait FromLineDType<Fp2> {
52 fn from_evaluated_line_d_type(line: EvaluatedLine<Fp2>) -> Self;
53}
54
55pub trait LineMulDType<Fp2, Fp12> {
57 fn mul_013_by_013(l0: &EvaluatedLine<Fp2>, l1: &EvaluatedLine<Fp2>) -> [Fp2; 5];
59
60 fn mul_by_013(f: &Fp12, l: &EvaluatedLine<Fp2>) -> Fp12;
62
63 fn mul_by_01234(f: &Fp12, x: &[Fp2; 5]) -> Fp12;
65}