public bool IsSolution(IEnumerable <double> x) { if (x.Count() != Coefficients.Count) { throw new ArgumentException("x must have the same length as coefficients."); } return(Coefficients.Zip(x, (a, var) => (a, var)).Sum(c => c.a * c.var) == B); }
public T Subtract(T other) { return(New(Coefficients.Zip(other.Coefficients, (x, y) => (x - y).Mod(Bn128Curve.P)))); }
public T Add(T other) { return(New(Coefficients.Zip(other.Coefficients, (x, y) => (x + y).Mod(Bn128Curve.P)))); }