@Override public void recycle() { a.recycle(); b.recycle(); c.recycle(); field.recycle(this); }
@Override public Fq6Element<P> mod() { return field.getElement(a.mod(), b.mod(), c.mod()); }
@Override public Fq6DoubleElement<P> sub(Fq6DoubleElement<P> element) { return field.getDoubleElement(a.sub(element.a), b.sub(element.b), c.sub(element.c)); }
@Override public Fq6DoubleElement<P> add(Fq6DoubleElement<P> element) { return field.getDoubleElement(a.add(element.a), b.add(element.b), c.add(element.c)); }
@Override public Fq6DoubleElement<P> clone() { return field.getDoubleElement(a.clone(), b.clone(), c.clone()); }
/** * Algorithm 12 of "High-Speed Software Implementation of the Optimal Ate Pairing over * Barreto–Naehrig Curves" (Beuchat et al.), but adapted such that it computes x * gamma + y. * (Hence the shifted coefficients in algorithm 11). * * <p>Stack: F(q^12) = F(q^6)[w]/(w^2-gamma), F(q^6) = F(q^2)[gamma]/(gamma^3-xi) and F(q^2) = * F(q)[u](u^2-beta) * * @param y The element to add * @return A new double-precision element representing x * gamma + y */ public Fq6DoubleElement<P> mulGammaAdd(Fq6DoubleElement<P> y) { Fq2DoubleElement<P> outa = c.mulXi().addMutable(y.a); Fq2DoubleElement<P> outb = a.add(y.b); Fq2DoubleElement<P> outc = b.add(y.c); return field.getDoubleElement(outa, outb, outc); }