Computes the bilinear pairing e(p,q). @p must be a G1Element and @q must
    be a G2Element.
    @returns a GtElement
351186
def pair(p,q):
    
    # Check types
    assertType(p, G1Element)
    assertType(q, G2Element)

    result = GtElement()
    librelic.pc_map_abi(byref(result), byref(p), byref(q))
    return result
895174
def ellipticity2phi_q(e1, e2):
    
    phi = np.arctan2(e2, e1)/2
    c = np.sqrt(e1**2+e2**2)
    if c > 0.999:
        c = 0.999
    q = (1-c)/(1+c)
    return phi, q
735860
public Pair<Double, INDArray> hBeta(INDArray d, double beta) {
        INDArray P = exp(d.neg().muli(beta));
        double sumP = P.sumNumber().doubleValue();
        double logSumP = FastMath.log(sumP);
        Double H = logSumP + ((beta * (d.mul(P).sumNumber().doubleValue())) / sumP);
        P.divi(sumP);
        return new Pair<>(H, P);
    }
713293
def verifyG1(x, tTilde, y, pi, errorOnFail=True):
    
    # Unpack the proof
    p,c,u = pi

    # Verify types
    assertType(x, G1Element)
    assertType(tTilde, G2Element)
    assertType(y, GtElement)
    assertType(p, G1Element)

    # TODO: beta can be pre-computed while waiting for a server response.
    Q = generatorG1()
    beta = pair(x,tTilde)

    # Recompute c'
    t1 = Q*u + p*c 
    t2 = beta**u * y**c

    t1.normalize()

    cPrime = hashZ(Q,p,beta,y,t1,t2)

    # Check computed @c' against server's value @c
    if cPrime == c:
        return True

    if errorOnFail:
        raise Exception("zero-knowledge proof failed verification.")
    else:
        return False
675863
function GCD_(x,y) {
    var i,xp,yp,A,B,C,D,q,sing,qp;
    if (T.length!=x.length)
      T=dup(x);

    sing=1;
    while (sing) { //while y has nonzero elements other than y[0]
      sing=0;
      for (i=1;i<y.length;i++) //check if y has nonzero elements other than 0
        if (y[i]) {
          sing=1;
          break;
        }
      if (!sing) break; //quit when y all zero elements except possibly y[0]

      for (i=x.length;!x[i] && i>=0;i--);  //find most significant element of x
      xp=x[i];
      yp=y[i];
      A=1; B=0; C=0; D=1;
      while ((yp+C) && (yp+D)) {
        q =Math.floor((xp+A)/(yp+C));
        qp=Math.floor((xp+B)/(yp+D));
        if (q!=qp)
          break;
        t= A-q*C;   A=C;   C=t;    //  do (A,B,xp, C,D,yp) = (C,D,yp, A,B,xp) - q*(0,0,0, C,D,yp)      
        t= B-q*D;   B=D;   D=t;
        t=xp-q*yp; xp=yp; yp=t;
      }
      if (B) {
        copy_(T,x);
        linComb_(x,y,A,B); //x=A*x+B*y
        linComb_(y,T,D,C); //y=D*y+C*T
      } else {
        mod_(x,y);
        copy_(T,x);
        copy_(x,y);
        copy_(y,T);
      } 
    }
    if (y[0]==0)
      return;
    t=modInt(x,y[0]);
    copyInt_(x,y[0]);
    y[0]=t;
    while (y[0]) {
      x[0]%=y[0];
      t=x[0]; x[0]=y[0]; y[0]=t;
    }
  }
590178
public static org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement precomp(
      final Curve curve,
      final FieldElement ypx,
      final FieldElement ymx,
      final FieldElement xy2d) {
    return new org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement(curve,
        Representation.PRECOMP, ypx, ymx, xy2d, null);
  }
1327994
public static org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement p2(
      final Curve curve,
      final FieldElement X,
      final FieldElement Y,
      final FieldElement Z) {
    return new org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement(curve,
        Representation.P2, X, Y, Z, null);
  }
1371040
public static void fe_add(int[] h,int[] f,int[] g)
{
  int f0 = f[0];
  int f1 = f[1];
  int f2 = f[2];
  int f3 = f[3];
  int f4 = f[4];
  int f5 = f[5];
  int f6 = f[6];
  int f7 = f[7];
  int f8 = f[8];
  int f9 = f[9];
  int g0 = g[0];
  int g1 = g[1];
  int g2 = g[2];
  int g3 = g[3];
  int g4 = g[4];
  int g5 = g[5];
  int g6 = g[6];
  int g7 = g[7];
  int g8 = g[8];
  int g9 = g[9];
  int h0 = f0 + g0;
  int h1 = f1 + g1;
  int h2 = f2 + g2;
  int h3 = f3 + g3;
  int h4 = f4 + g4;
  int h5 = f5 + g5;
  int h6 = f6 + g6;
  int h7 = f7 + g7;
  int h8 = f8 + g8;
  int h9 = f9 + g9;
  h[0] = (int)h0;
  h[1] = (int)h1;
  h[2] = (int)h2;
  h[3] = (int)h3;
  h[4] = (int)h4;
  h[5] = (int)h5;
  h[6] = (int)h6;
  h[7] = (int)h7;
  h[8] = (int)h8;
  h[9] = (int)h9;
}
237723
public DoubleBinaryOperator determinant()
    {
        int sign = 1;
        SumBuilder sum = DoubleBinaryOperators.sumBuilder();
        PermutationMatrix pm = PermutationMatrix.getInstance(rows);
        int perms = pm.rows;
        for (int p=0;p<perms;p++)
        {
            MultiplyBuilder mul = DoubleBinaryOperators.multiplyBuilder();
            for (int i=0;i<rows;i++)
            {
                mul.add(get(i, pm.get(p, i)));
            }
            sum.add(DoubleBinaryOperators.sign(sign, mul.build()));
            sign = -sign;
        }
        return sum.build();
    }
1000875
public List<Double> x() {
        List<Double> result = new ArrayList<Double>(xy.size());
        for (Discrete.Pair pair : xy) {
            result.add(pair.x);
        }
        return result;
    }
1046952
public double fMeasure(double beta) {
    final double beta2 = beta * beta;
    double fmeasure = ((1 + beta2) * pairconfuse[0]) / ((1 + beta2) * pairconfuse[0] + beta2 * pairconfuse[1] + pairconfuse[2]);
    return fmeasure;
  }
1060923
public IRenderingElement generateRingElements(IBond bond, IRing ring, RendererModel model) {
        if (isSingle(bond) && isStereoBond(bond)) {
            return generateStereoElement(bond, model);
        } else if (isDouble(bond)) {
            ElementGroup pair = new ElementGroup();
            pair.add(generateBondElement(bond, IBond.Order.SINGLE, model));
            pair.add(generateInnerElement(bond, ring, model));
            return pair;
        } else {
            return generateBondElement(bond, model);
        }
    }
624073
public static void ge_p2_0(ge_p2 h) {
        fe_0.fe_0(h.X);
        fe_1.fe_1(h.Y);
        fe_1.fe_1(h.Z);
    }
1107291
public static int getElIndexInSameTags(Element e) {
        Elements chs = e.parent().children();
        int index = 1;
        for (Element cur : chs) {
            if (e.tagName().equals(cur.tagName())) {
                if (e.equals(cur)) {
                    return index;
                } else {
                    index++;
                }
            }
        }
        return index;
    }
801083
static public double schwefel_102(double[] x) {

    double prev_sum, curr_sum, outer_sum;

    curr_sum = x[0];
    outer_sum = (curr_sum * curr_sum);

    for (int i = 1; i < x.length; i++) {
      prev_sum = curr_sum;
      curr_sum = prev_sum + x[i];
      outer_sum += (curr_sum * curr_sum);
    }

    return (outer_sum);
  }
842966
@GwtIncompatible("TODO")
  public static BigInteger divide(BigInteger p, BigInteger q, RoundingMode mode) {
    BigDecimal pDec = new BigDecimal(p);
    BigDecimal qDec = new BigDecimal(q);
    return pDec.divide(qDec, 0, mode).toBigIntegerExact();
  }
300226
Envelope2D getEnvelope2D() {
		Envelope2D env = new Envelope2D();
		env.setEmpty();
		VertexIterator vert_iter = queryVertexIterator();
		Point2D pt = new Point2D();
		boolean b_first = true;
		for (int ivertex = vert_iter.next(); ivertex != -1; ivertex = vert_iter
				.next()) {
			getXY(ivertex, pt);
			if (b_first)
				env.merge(pt.x, pt.y);
			else
				env.mergeNE(pt.x, pt.y);

			b_first = false;
		}

		return env;
	}