public static GT Pow(GT x, Fr y) { var g = new GT(); g.SetPowOf(x, y); return(g); }
public void SetMultiplicationOf(G2 x, Fr y) { unsafe { fixed(G2 *ptr = &this) { MclBls12381.Imports.MclBnG2Mul.Value(ptr, &x, &y); } } }
private void SetPowOf(GT x, Fr y) { unsafe { fixed(GT *ptr = &this) { MclBls12381.Imports.MclBnGtPow.Value(ptr, &x, &y); } } }
public static Fr[] Powers(Fr x, int n) { var result = new Fr[n]; result[0] = Fr.One; for (var i = 1; i < n; ++i) { result[i] = result[i - 1] * x; } return(result); }
public static G2 EvaluatePolynomial(G2[] poly, Fr at) { unsafe { var res = new G2(); fixed(G2 *cVec = poly) Imports.MclBnG2EvaluatePolynomial.Value(&res, cVec, (ulong)poly.Length, &at); return(res); } }
public static Fr EvaluatePolynomial(Fr[] poly, Fr at) { unsafe { var res = new Fr(); fixed(Fr *cVec = poly) Imports.MclBnFrEvaluatePolynomial.Value(&res, cVec, (ulong)poly.Length, &at); return(res); } }
public static Fr LagrangeInterpolate(Fr[] xs, Fr[] ys) { if (xs.Length != ys.Length) { throw new ArgumentException("arrays are unequal length"); } unsafe { var res = new Fr(); fixed(Fr *xVec = xs) fixed(Fr * yVec = ys) Imports.MclBnFrLagrangeInterpolation.Value(&res, xVec, yVec, (ulong)xs.Length); return(res); } }