public FunctionPolynomialLagrange(IAlgebraInteger <SymbolType> algebra, IList <Tuple <SymbolType, SymbolType> > points) { this.algebra = algebra; this.domain = new SymbolType[points.Count]; this.range = new SymbolType[points.Count]; for (int point_index = 0; point_index < points.Count; point_index++) { domain[point_index] = points[point_index].Item1; range[point_index] = points[point_index].Item2; } }
public AlgebraFiniteFieldGenericPrime(IAlgebraInteger <IntegerType> algebra, IntegerType prime) { if (!ToolsMathBigIntegerPrime.IsPrime(algebra.ToBigInteger(prime))) { throw new Exception("Number " + prime.ToString() + " is not prime"); } Prime = prime; Algebra = algebra; ElementCount = Algebra.ToBigInteger(prime); AddIdentity = new FiniteFieldElement <IntegerType>(this, Algebra.AddIdentity); MultiplyIdentity = new FiniteFieldElement <IntegerType>(this, Algebra.MultiplyIdentity); }
public static Tuple <IntegerType, IntegerType, IntegerType> ExtendedEuclideanAlgorithm <IntegerType>(IAlgebraInteger <IntegerType> algebra, IntegerType a, IntegerType b) { if (algebra.Compare(algebra.Abs(a), algebra.Abs(b)) == -1) { Tuple <IntegerType, IntegerType, IntegerType> xyd = ExtendedEuclideanAlgorithm(algebra, b, a); return(new Tuple <IntegerType, IntegerType, IntegerType>(xyd.Item2, xyd.Item1, xyd.Item3)); } if (algebra.Abs(b).Equals(algebra.AddIdentity)) { return(new Tuple <IntegerType, IntegerType, IntegerType>(algebra.MultiplyIdentity, algebra.AddIdentity, a)); } IntegerType x1 = algebra.AddIdentity; IntegerType x2 = algebra.MultiplyIdentity; IntegerType y1 = algebra.MultiplyIdentity; IntegerType y2 = algebra.AddIdentity; while (algebra.Compare(algebra.AddIdentity, algebra.Abs(b)) == -1) { IntegerType q = algebra.Divide(a, b); IntegerType r = algebra.Modulo(a, b); IntegerType x = algebra.Subtract(x2, algebra.Multiply(q, x1)); IntegerType y = algebra.Subtract(y2, algebra.Multiply(q, y1)); a = b; b = r; x2 = x1; x1 = x; y2 = y1; y1 = y; } return(new Tuple <IntegerType, IntegerType, IntegerType>(x2, y2, a)); }
public Polynomial(IAlgebraInteger <DomainType> algebra, DomainType [] coeffecients) { this.algebra = algebra; this.coeffecients = ToolsCollection.Copy(coeffecients); }
public Polynomial(IAlgebraInteger <DomainType> algebra) { this.algebra = algebra; coeffecients = new DomainType[0]; }