public T Subtract(BigInteger other) { return(New(Coefficients.Select(x => (x - other).Mod(Bn128Curve.P)))); }
public T Negate() { // Negate all coefficients. return(New(Coefficients.Select(x => (-x).Mod(Bn128Curve.P)))); }
public T Divide(BigInteger other) { return(New(Coefficients.Select(x => (x * other.ModInverse(Bn128Curve.P)).Mod(Bn128Curve.P)))); }
public T Multiply(BigInteger other) { return(New(Coefficients.Select(x => (x * other).Mod(Bn128Curve.P)))); }
public Polynomial Negate() { return(new Polynomial(Coefficients.Select(c => - 1 * c).ToList())); }
public override string ToString() { return(string.Join(" + ", Coefficients.Select((coefficient, i) => i > 0 ? $"{coefficient} {Indeterminate}^{i}" : $"{coefficient}"))); }