additionStep static method
Performs an addition step in the Miller loop and returns the new point with line coefficients.
Implementation
static (G2NativeProjective, (Bls12NativeFp2, Bls12NativeFp2, Bls12NativeFp2))
additionStep(G2NativeProjective r, G2NativeAffinePoint q) {
Bls12NativeFp2 zsquared = r.z.square();
Bls12NativeFp2 ysquared = q.y.square();
Bls12NativeFp2 t0 = zsquared * q.x;
Bls12NativeFp2 t1 = ((q.y + r.z).square() - ysquared - zsquared) * zsquared;
Bls12NativeFp2 t2 = t0 - r.x;
Bls12NativeFp2 t3 = t2.square();
Bls12NativeFp2 t4 = t3 + t3;
t4 = t4 + t4;
Bls12NativeFp2 t5 = t4 * t2;
Bls12NativeFp2 t6 = t1 - r.y - r.y;
Bls12NativeFp2 t9 = t6 * q.x;
Bls12NativeFp2 t7 = t4 * r.x;
r = r.copyWith(x: t6.square() - t5 - t7 - t7);
r = r.copyWith(z: (r.z + t2).square() - zsquared - t3);
Bls12NativeFp2 t10 = q.y + r.z;
Bls12NativeFp2 t8 = (t7 - r.x) * t6;
t0 = r.y * t5;
t0 = t0 + t0;
r = r.copyWith(y: t8 - t0);
t10 = t10.square() - ysquared;
Bls12NativeFp2 ztsquared = r.z.square();
t10 = t10 - ztsquared;
t9 = t9 + t9 - t10;
t10 = r.z + r.z;
t6 = -t6;
t1 = t6 + t6;
return (r, (t10, t1, t9));
}