Skip to content

Commit

Permalink
xxx: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Oct 29, 2024
1 parent 9af7306 commit 6880305
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 122 deletions.
36 changes: 18 additions & 18 deletions std/algebra/emulated/fields_bw6761/e6.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,22 +434,22 @@ func (e Ext6) mulMontgomery6(x, y *E6) *E6 {
func (e Ext6) mulDirect(x, y *E6) *E6 {
nonResidue := e.fp.NewElement(-4)
// c0 = a0b0 + β(a1b5 + a2b4 + a3b3 + a4b2 + a5b1)
c0 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &y.A0}, {nonResidue, &x.A1, &y.A5}, {nonResidue, &x.A2, &y.A4}, {nonResidue, &x.A3, &y.A3}, {nonResidue, &x.A4, &y.A2}, {nonResidue, &x.A5, &y.A1}},
c0 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &y.A0}, {nonResidue, &x.A1, &y.A5}, {nonResidue, &x.A2, &y.A4}, {nonResidue, &x.A3, &y.A3}, {nonResidue, &x.A4, &y.A2}, {nonResidue, &x.A5, &y.A1}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c1 = a0b1 + a1b0 + β(a2b5 + a3b4 + a4b3 + a5b2)
c1 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &y.A1}, {&x.A1, &y.A0}, {nonResidue, &x.A2, &y.A5}, {nonResidue, &x.A3, &y.A4}, {nonResidue, &x.A4, &y.A3}, {nonResidue, &x.A5, &y.A2}},
c1 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &y.A1}, {&x.A1, &y.A0}, {nonResidue, &x.A2, &y.A5}, {nonResidue, &x.A3, &y.A4}, {nonResidue, &x.A4, &y.A3}, {nonResidue, &x.A5, &y.A2}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c2 = a0b2 + a1b1 + a2b0 + β(a3b5 + a4b4 + a5b3)
c2 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &y.A2}, {&x.A1, &y.A1}, {&x.A2, &y.A0}, {nonResidue, &x.A3, &y.A5}, {nonResidue, &x.A4, &y.A4}, {nonResidue, &x.A5, &y.A3}},
c2 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &y.A2}, {&x.A1, &y.A1}, {&x.A2, &y.A0}, {nonResidue, &x.A3, &y.A5}, {nonResidue, &x.A4, &y.A4}, {nonResidue, &x.A5, &y.A3}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c3 = a0b3 + a1b2 + a2b1 + a3b0 + β(a4b5 + a5b4)
c3 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &y.A3}, {&x.A1, &y.A2}, {&x.A2, &y.A1}, {&x.A3, &y.A0}, {nonResidue, &x.A4, &y.A5}, {nonResidue, &x.A5, &y.A4}},
c3 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &y.A3}, {&x.A1, &y.A2}, {&x.A2, &y.A1}, {&x.A3, &y.A0}, {nonResidue, &x.A4, &y.A5}, {nonResidue, &x.A5, &y.A4}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c4 = a0b4 + a1b3 + a2b2 + a3b1 + a4b0 + βa5b5
c4 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &y.A4}, {&x.A1, &y.A3}, {&x.A2, &y.A2}, {&x.A3, &y.A1}, {&x.A4, &y.A0}, {nonResidue, &x.A5, &y.A5}},
c4 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &y.A4}, {&x.A1, &y.A3}, {&x.A2, &y.A2}, {&x.A3, &y.A1}, {&x.A4, &y.A0}, {nonResidue, &x.A5, &y.A5}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c5 = a0b5 + a1b4 + a2b3 + a3b2 + a4b1 + a5b0,
c5 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &y.A5}, {&x.A1, &y.A4}, {&x.A2, &y.A3}, {&x.A3, &y.A2}, {&x.A4, &y.A1}, {&x.A5, &y.A0}},
c5 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &y.A5}, {&x.A1, &y.A4}, {&x.A2, &y.A3}, {&x.A3, &y.A2}, {&x.A4, &y.A1}, {&x.A5, &y.A0}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})

return &E6{
Expand Down Expand Up @@ -742,22 +742,22 @@ func (e Ext6) mulToomCook6(x, y *E6) *E6 {
func (e Ext6) squareDirect(x *E6) *E6 {
nonResidue := e.fp.NewElement(-4)
// c0 = a0b0 + β(a1b5 + a2b4 + a3b3 + a4b2 + a5b1)
c0 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &x.A0}, {nonResidue, &x.A1, &x.A5}, {nonResidue, &x.A2, &x.A4}, {nonResidue, &x.A3, &x.A3}, {nonResidue, &x.A4, &x.A2}, {nonResidue, &x.A5, &x.A1}},
c0 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &x.A0}, {nonResidue, &x.A1, &x.A5}, {nonResidue, &x.A2, &x.A4}, {nonResidue, &x.A3, &x.A3}, {nonResidue, &x.A4, &x.A2}, {nonResidue, &x.A5, &x.A1}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c1 = a0b1 + a1b0 + β(a2b5 + a3b4 + a4b3 + a5b2)
c1 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &x.A1}, {&x.A1, &x.A0}, {nonResidue, &x.A2, &x.A5}, {nonResidue, &x.A3, &x.A4}, {nonResidue, &x.A4, &x.A3}, {nonResidue, &x.A5, &x.A2}},
c1 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &x.A1}, {&x.A1, &x.A0}, {nonResidue, &x.A2, &x.A5}, {nonResidue, &x.A3, &x.A4}, {nonResidue, &x.A4, &x.A3}, {nonResidue, &x.A5, &x.A2}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c2 = a0b2 + a1b1 + a2b0 + β(a3b5 + a4b4 + a5b3)
c2 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &x.A2}, {&x.A1, &x.A1}, {&x.A2, &x.A0}, {nonResidue, &x.A3, &x.A5}, {nonResidue, &x.A4, &x.A4}, {nonResidue, &x.A5, &x.A3}},
c2 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &x.A2}, {&x.A1, &x.A1}, {&x.A2, &x.A0}, {nonResidue, &x.A3, &x.A5}, {nonResidue, &x.A4, &x.A4}, {nonResidue, &x.A5, &x.A3}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c3 = a0b3 + a1b2 + a2b1 + a3b0 + β(a4b5 + a5b4)
c3 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &x.A3}, {&x.A1, &x.A2}, {&x.A2, &x.A1}, {&x.A3, &x.A0}, {nonResidue, &x.A4, &x.A5}, {nonResidue, &x.A5, &x.A4}},
c3 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &x.A3}, {&x.A1, &x.A2}, {&x.A2, &x.A1}, {&x.A3, &x.A0}, {nonResidue, &x.A4, &x.A5}, {nonResidue, &x.A5, &x.A4}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c4 = a0b4 + a1b3 + a2b2 + a3b1 + a4b0 + βa5b5
c4 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &x.A4}, {&x.A1, &x.A3}, {&x.A2, &x.A2}, {&x.A3, &x.A1}, {&x.A4, &x.A0}, {nonResidue, &x.A5, &x.A5}},
c4 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &x.A4}, {&x.A1, &x.A3}, {&x.A2, &x.A2}, {&x.A3, &x.A1}, {&x.A4, &x.A0}, {nonResidue, &x.A5, &x.A5}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c5 = a0b5 + a1b4 + a2b3 + a3b2 + a4b1 + a5b0,
c5 := e.fp.EvalMultivariate2([][]*baseEl{{&x.A0, &x.A5}, {&x.A1, &x.A4}, {&x.A2, &x.A3}, {&x.A3, &x.A2}, {&x.A4, &x.A1}, {&x.A5, &x.A0}},
c5 := e.fp.EvalMultivariate([][]*baseEl{{&x.A0, &x.A5}, {&x.A1, &x.A4}, {&x.A2, &x.A3}, {&x.A3, &x.A2}, {&x.A4, &x.A1}, {&x.A5, &x.A0}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})

return &E6{
Expand Down Expand Up @@ -866,15 +866,15 @@ func (e Ext6) CyclotomicSquareKarabina12345Direct(x *E6) *E6 {
g4 := x.A3
g5 := x.A5
// h1 = 3*c*g2^2 + 3*g3^2 - 2*g1
h1 := e.fp.EvalMultivariate2([][]*baseEl{{c, &g2, &g2}, {&g3, &g3}, {mone, &g1}}, []*big.Int{big.NewInt(3), big.NewInt(3), big.NewInt(2)})
h1 := e.fp.EvalMultivariate([][]*baseEl{{c, &g2, &g2}, {&g3, &g3}, {mone, &g1}}, []*big.Int{big.NewInt(3), big.NewInt(3), big.NewInt(2)})
// h2 = 3*c*g5^2 + 3*g1^2 - 2*g2
h2 := e.fp.EvalMultivariate2([][]*baseEl{{c, &g5, &g5}, {&g1, &g1}, {mone, &g2}}, []*big.Int{big.NewInt(3), big.NewInt(3), big.NewInt(2)})
h2 := e.fp.EvalMultivariate([][]*baseEl{{c, &g5, &g5}, {&g1, &g1}, {mone, &g2}}, []*big.Int{big.NewInt(3), big.NewInt(3), big.NewInt(2)})
// h3 = 6*c*g1*g5 + 2*g3
h3 := e.fp.EvalMultivariate2([][]*baseEl{{c, &g1, &g5}, {&g3}}, []*big.Int{big.NewInt(6), big.NewInt(2)})
h3 := e.fp.EvalMultivariate([][]*baseEl{{c, &g1, &g5}, {&g3}}, []*big.Int{big.NewInt(6), big.NewInt(2)})
// h4 = 3*c*g2*g5 + 3*g1*g3 - g4
h4 := e.fp.EvalMultivariate2([][]*baseEl{{c, &g2, &g5}, {&g1, &g3}, {mone, &g4}}, []*big.Int{big.NewInt(3), big.NewInt(3), big.NewInt(1)})
h4 := e.fp.EvalMultivariate([][]*baseEl{{c, &g2, &g5}, {&g1, &g3}, {mone, &g4}}, []*big.Int{big.NewInt(3), big.NewInt(3), big.NewInt(1)})
// h5 = 6*g2*g3 + 2*g5
h5 := e.fp.EvalMultivariate2([][]*baseEl{{&g2, &g3}, {&g5}}, []*big.Int{big.NewInt(6), big.NewInt(2)})
h5 := e.fp.EvalMultivariate([][]*baseEl{{&g2, &g3}, {&g5}}, []*big.Int{big.NewInt(6), big.NewInt(2)})

return &E6{
A0: x.A0,
Expand Down Expand Up @@ -958,7 +958,7 @@ func (e Ext6) DecompressKarabina12345Direct(x *E6) *E6 {
g4 := x.A3
g5 := x.A5
// h0 = -3*c*g1*g2 + 2*c*g4^2 + c*g3*g5 + 1
h0 := e.fp.EvalMultivariate2([][]*baseEl{{mone, c, &g1, &g2}, {c, &g4, &g4}, {c, &g3, &g5}, {e.fp.One()}}, []*big.Int{big.NewInt(3), big.NewInt(2), big.NewInt(1), big.NewInt(1)})
h0 := e.fp.EvalMultivariate([][]*baseEl{{mone, c, &g1, &g2}, {c, &g4, &g4}, {c, &g3, &g5}, {e.fp.One()}}, []*big.Int{big.NewInt(3), big.NewInt(2), big.NewInt(1), big.NewInt(1)})
return &E6{
A0: *h0,
A1: g3,
Expand Down
6 changes: 3 additions & 3 deletions std/algebra/emulated/fields_bw6761/e6_mul_sz.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ type e6mulCheck struct {
func (mc *e6mulCheck) check(sapi *emulated.Field[emulated.BW6761Fp], rpowers []*baseEl, modEval *baseEl) {
mone := sapi.NewElement(-1)
// a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5
ax := sapi.EvalMultivariate2([][]*baseEl{{&mc.A.A0}, {&mc.A.A1, rpowers[0]}, {&mc.A.A2, rpowers[1]}, {&mc.A.A3, rpowers[2]}, {&mc.A.A4, rpowers[3]}, {&mc.A.A5, rpowers[4]}},
ax := sapi.EvalMultivariate([][]*baseEl{{&mc.A.A0}, {&mc.A.A1, rpowers[0]}, {&mc.A.A2, rpowers[1]}, {&mc.A.A3, rpowers[2]}, {&mc.A.A4, rpowers[3]}, {&mc.A.A5, rpowers[4]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
var bx *emulated.Element[emulated.BW6761Fp]
if mc.A != mc.B {
bx = sapi.EvalMultivariate2([][]*baseEl{{&mc.B.A0}, {&mc.B.A1, rpowers[0]}, {&mc.B.A2, rpowers[1]}, {&mc.B.A3, rpowers[2]}, {&mc.B.A4, rpowers[3]}, {&mc.B.A5, rpowers[4]}},
bx = sapi.EvalMultivariate([][]*baseEl{{&mc.B.A0}, {&mc.B.A1, rpowers[0]}, {&mc.B.A2, rpowers[1]}, {&mc.B.A3, rpowers[2]}, {&mc.B.A4, rpowers[3]}, {&mc.B.A5, rpowers[4]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
} else {
bx = ax
}
// r0 + r1 x + r2 x^2 + r3 x^3 + r4 x^4 + r5 x^5 + q0 np + q1 x np + q2 x^2 np + q3 x^3 np + q4 x^4 np - ax0 bx0 - ax1 bx1 - ax2 bx2 - ax3 bx3 - ax4 bx4 - ax5 bx5
rqnx := sapi.EvalMultivariate2([][]*baseEl{
rqnx := sapi.EvalMultivariate([][]*baseEl{
{&mc.R.A0}, {&mc.R.A1, rpowers[0]}, {&mc.R.A2, rpowers[1]}, {&mc.R.A3, rpowers[2]}, {&mc.R.A4, rpowers[3]}, {&mc.R.A5, rpowers[4]},
{&mc.Q.A0, modEval}, {&mc.Q.A1, rpowers[0], modEval}, {&mc.Q.A2, rpowers[1], modEval}, {&mc.Q.A3, rpowers[2], modEval}, {&mc.Q.A4, rpowers[3], modEval},
{ax, bx, mone},
Expand Down
28 changes: 14 additions & 14 deletions std/algebra/emulated/fields_bw6761/e6_pairing.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ func (e Ext6) mulBy023Direct(z *E6, c0, c1 *baseEl) *E6 {
// E6{A0: c0, A1: 0, A2: c1, A3: 1, A4: 0, A5: 0}

// z0 = a0c0 + β(a3 + a4c1)
z0 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0, c0}, {nonResidue, &z.A3}, {nonResidue, &z.A4, c1}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
z0 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0, c0}, {nonResidue, &z.A3}, {nonResidue, &z.A4, c1}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// z1 = a1c0 + β(a4 + a5c1)
z1 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A1, c0}, {nonResidue, &z.A4}, {nonResidue, &z.A5, c1}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
z1 := e.fp.EvalMultivariate([][]*baseEl{{&z.A1, c0}, {nonResidue, &z.A4}, {nonResidue, &z.A5, c1}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// z2 = a0c1 + a2c0 + β(a5)
z2 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0, c1}, {&z.A2, c0}, {nonResidue, &z.A5}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
z2 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0, c1}, {&z.A2, c0}, {nonResidue, &z.A5}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c3 = a0 + a1c1 + a3c0
z3 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0}, {&z.A1, c1}, {&z.A3, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
z3 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0}, {&z.A1, c1}, {&z.A3, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c4 = a1 + a2c1 + a4c0
z4 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A1}, {&z.A2, c1}, {&z.A4, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
z4 := e.fp.EvalMultivariate([][]*baseEl{{&z.A1}, {&z.A2, c1}, {&z.A4, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c5 = a2 + a3c1 + a5c0,
z5 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A2}, {&z.A3, c1}, {&z.A5, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})
z5 := e.fp.EvalMultivariate([][]*baseEl{{&z.A2}, {&z.A3, c1}, {&z.A5, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1)})

return &E6{
A0: *z0,
Expand Down Expand Up @@ -232,9 +232,9 @@ func (e *Ext6) MulBy023(z *E6, c0, c1 *baseEl) *E6 {
func (e Ext6) mul023by023Direct(d0, d1, c0, c1 *baseEl) [5]*baseEl {
nonResidue := e.fp.NewElement(-4)
// c0 = d0c0 + β
z0 := e.fp.EvalMultivariate2([][]*baseEl{{d0, c0}, {nonResidue}}, []*big.Int{big.NewInt(1), big.NewInt(1)})
z0 := e.fp.EvalMultivariate([][]*baseEl{{d0, c0}, {nonResidue}}, []*big.Int{big.NewInt(1), big.NewInt(1)})
// c2 = d0c1 + d1c0
z2 := e.fp.EvalMultivariate2([][]*baseEl{{d0, c1}, {d1, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1)})
z2 := e.fp.EvalMultivariate([][]*baseEl{{d0, c1}, {d1, c0}}, []*big.Int{big.NewInt(1), big.NewInt(1)})
// c3 = d0 + c0
z3 := e.fp.Add(d0, c0)
// c4 = d1c1
Expand Down Expand Up @@ -278,22 +278,22 @@ func (e Ext6) mulBy02345Direct(z *E6, x [5]*baseEl) *E6 {
nonResidue := e.fp.NewElement(-4)

// c0 = a0y0 + β(a1y4 + a2y3 + a3y2 + a4y1)
c0 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0, x[0]}, {nonResidue, &z.A1, x[4]}, {nonResidue, &z.A2, x[3]}, {nonResidue, &z.A3, x[2]}, {nonResidue, &z.A4, x[1]}},
c0 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0, x[0]}, {nonResidue, &z.A1, x[4]}, {nonResidue, &z.A2, x[3]}, {nonResidue, &z.A3, x[2]}, {nonResidue, &z.A4, x[1]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c1 = a1y0 + β(a2y4 + a3y3 + a4y2 + a5y1)
c1 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A1, x[0]}, {nonResidue, &z.A2, x[4]}, {nonResidue, &z.A3, x[3]}, {nonResidue, &z.A4, x[2]}, {nonResidue, &z.A5, x[1]}},
c1 := e.fp.EvalMultivariate([][]*baseEl{{&z.A1, x[0]}, {nonResidue, &z.A2, x[4]}, {nonResidue, &z.A3, x[3]}, {nonResidue, &z.A4, x[2]}, {nonResidue, &z.A5, x[1]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c2 = a0y1 + a2y0 + β(a3y4 + a4y3 + a5y2)
c2 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0, x[1]}, {&z.A2, x[0]}, {nonResidue, &z.A3, x[4]}, {nonResidue, &z.A4, x[3]}, {nonResidue, &z.A5, x[2]}},
c2 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0, x[1]}, {&z.A2, x[0]}, {nonResidue, &z.A3, x[4]}, {nonResidue, &z.A4, x[3]}, {nonResidue, &z.A5, x[2]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c3 = a0y2 + a1y1 + a3y0 + β(a4y4 + a5y3)
c3 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0, x[2]}, {&z.A1, x[1]}, {&z.A3, x[0]}, {nonResidue, &z.A4, x[4]}, {nonResidue, &z.A5, x[3]}},
c3 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0, x[2]}, {&z.A1, x[1]}, {&z.A3, x[0]}, {nonResidue, &z.A4, x[4]}, {nonResidue, &z.A5, x[3]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c4 = a0y3 + a1y2 + a2y1 + a4y0 + βa5y4
c4 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0, x[3]}, {&z.A1, x[2]}, {&z.A2, x[1]}, {&z.A4, x[0]}, {nonResidue, &z.A5, x[4]}},
c4 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0, x[3]}, {&z.A1, x[2]}, {&z.A2, x[1]}, {&z.A4, x[0]}, {nonResidue, &z.A5, x[4]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})
// c5 = a0y4 + a1y3 + a2y2 + a3y1 + a5y0,
c5 := e.fp.EvalMultivariate2([][]*baseEl{{&z.A0, x[4]}, {&z.A1, x[3]}, {&z.A2, x[2]}, {&z.A3, x[1]}, {&z.A5, x[0]}},
c5 := e.fp.EvalMultivariate([][]*baseEl{{&z.A0, x[4]}, {&z.A1, x[3]}, {&z.A2, x[2]}, {&z.A3, x[1]}, {&z.A5, x[0]}},
[]*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1), big.NewInt(1)})

return &E6{
Expand Down
Loading

0 comments on commit 6880305

Please sign in to comment.