/// <summary> /// Assumes that this current basis is already minimal and converts it to reduced (from Definition 5 of section 2.7, CLO). /// CAUTION - if basis is not already minimal, a non- descriptive exception will be thrown from somewhere in the monomial code. /// Based on algorithm 2 from - https://www.kent.ac.uk/smsas/personal/gdb/MA574/week6.pdf /// </summary> public void MakeReduced() { var tempPolynomials = this.polynomialData.ToList(); Polynomial hi = polynomialData.ElementAt(0); Polynomial gi; tempPolynomials.RemoveAt(0); for (int i = 0; i < tempPolynomials.Count; i++) { gi = hi.GetRemainder(tempPolynomials); hi = tempPolynomials[i]; tempPolynomials[i] = gi; } gi = hi.GetRemainder(tempPolynomials); tempPolynomials.Add(gi); this.polynomialData = new HashSet <Polynomial>(tempPolynomials); }