Beispiel #1
0
 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);
 }
Beispiel #2
0
 public T Subtract(T other)
 {
     return(New(Coefficients.Zip(other.Coefficients, (x, y) => (x - y).Mod(Bn128Curve.P))));
 }
Beispiel #3
0
 public T Add(T other)
 {
     return(New(Coefficients.Zip(other.Coefficients, (x, y) => (x + y).Mod(Bn128Curve.P))));
 }