public PermutationGenerator(int permutationLength, Pairs pairs1, Pairs pairs2) { if (!pairs1.IsFull || !pairs2.IsFull) { throw new Exception("Введенные многочлены не являются неприводимыми."); } this.pairs1 = pairs1; this.pairs2 = pairs2; indexArray = new int[pairs1.Length]; inversions = 0; this.permutationLength = permutationLength; unchecked { PossiblePermutationQuantity = (2 << (permutationLength / 2 - 1)) * factorial((permutationLength / 2)); } }
public int[,] Content(FieldTableType type) { NeutralPairs = new Pairs(Size / 2 - 1); int[,] contentArray = new int[Size, Size]; //Upper triangular filling of the table for (uint i = 1; i < contentArray.GetUpperBound(0) + 1; i++) { for (uint j = i; j < contentArray.GetUpperBound(1) + 1; j++) { Polynomial horizontalValue = new Polynomial(i); Polynomial verticalValue = new Polynomial(j); if (type == FieldTableType.Multiplication) { contentArray[i, j] = (int)(horizontalValue * verticalValue % Divisor).IntegerRepresentation; } else { contentArray[i, j] = (int)(horizontalValue + verticalValue % Divisor).IntegerRepresentation; } } } //Symmetric filling of the rest of the table for (uint i = 1; i < contentArray.GetUpperBound(0) + 1; i++) { for (uint j = i + 1; j < contentArray.GetUpperBound(1) + 1; j++) { if (contentArray[i, j] == 1) { NeutralPairs.AddPair(i, j); } contentArray[j, i] = contentArray[i, j]; } } return(contentArray); }