static public void WriteReverse(int[] permutation) { int[] reversePermutation = WithoutRepetition.ReversePermutation(permutation); int[][] cycleReversePermutation = WithoutRepetition.PermutationToCycle(reversePermutation); int[][] cyclePermutation = WithoutRepetition.PermutationToCycle(permutation); using (StreamWriter writer = new StreamWriter("log.txt", true)) { WriteDate(writer); WriteLine(writer, "Reverse permutation:"); WriteLine(writer); Write(writer, "One-line notation: "); WriteVector(writer, permutation); WriteLine(writer); Write(writer, "Canonical cycle notation: "); WriteCycle(writer, cyclePermutation); WriteLine(writer); WriteLine(writer); WriteLine(writer, "Result:"); WriteLine(writer); Write(writer, "One-line notation: "); WriteVector(writer, reversePermutation); WriteLine(writer); Write(writer, "Canonical cycle notation: "); WriteCycle(writer, cycleReversePermutation); WriteLine(writer); } }
internal static bool isAnyReverse(int[][] permutations) { for (int i = 0; i < permutations.Length; i++) { bool flag = false; for (int j = 0; j < permutations.Length; j++) { if (!flag) { int[] reverse = WithoutRepetition.ReversePermutation(permutations[j]); if (ArrayFunctions.compareIntArrays(permutations[i], reverse)) { flag = true; } } } if (!flag) { return(false); } } return(true); }