コード例 #1
0
        static void Main(string[] args)
        {
            {
                var permutation = new GapPerm(0, 4, 9, 2, 5, 1, 7, 6, 8, 3);

                permutation.DisplayAsFunction();

                permutation.ToDisjointCycles().Display();

                WriteLine();
            }

            {
                var permutation = new GapPerm(0, 7, 4, 9, 2, 3, 8, 1, 6, 5);

                permutation.DisplayAsFunction();

                permutation.ToDisjointCycles().Display();

                WriteLine();
            }

            {
                var permutation = new GapPerm(0, 7, 9, 5, 3, 1, 2, 4, 8, 6);

                permutation.DisplayAsFunction();

                permutation.ToDisjointCycles().Display();

                WriteLine();
            }

            {
                var permutation = new GapPerm(0, 9, 8, 7, 4, 3, 6, 5, 1, 2);

                permutation.DisplayAsFunction();

                permutation.ToDisjointCycles().Display();

                WriteLine();
            }
        }
コード例 #2
0
 static string even_or_odd(GapPerm obj) => obj.ToDisjointCycles().to_transpositions().ls.Count % 2 == 0 ? "even" : "odd";