コード例 #1
0
        public PermutationList CyclicPermutations()
        {
            PermutationList perms = new PermutationList();

            foreach (Permutation p in this)
            {
                if (p.Matrix.Trace() == 0)
                {
                    perms.Add(p);
                }
            }
            return(perms);
        }
コード例 #2
0
        public static PermutationList Permute(int start)
        {
            PermutationList gList = new PermutationList();
            List <int>      set   = new List <int>();

            for (int i = 0; i < start; i++)
            {
                set.Add(i + 1);
            }

            List <int[]> ret = Permute(set);

            foreach (int[] perm in ret)
            {
                gList.Add(new Permutation(set.ToArray(), perm));
            }

            return(gList);
        }
コード例 #3
0
        public static int Test_Permutations()
        {
            SymetricGroup sg = new SymetricGroup(4);

            sg.DisplayMatrix = true;

            PermutationList ps2 = new PermutationList(4);

            ps2.DisplayMatrix = true;

            PermutationList ps = new PermutationList();

            ps.Order = 4;

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 1, 2, 3, 4 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 4, 1, 2, 3 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 3, 4, 1, 2 }
                    )
                );
            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 2, 3, 4, 1 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 1, 2, 3, 4 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 2, 1, 4, 3 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 4, 3, 1, 2 }
                    )
                );
            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 3, 4, 2, 1 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 1, 2, 3, 4 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 3, 1, 4, 2 }
                    )
                );

            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 2, 4, 1, 3 }
                    )
                );
            ps.Add(
                new Permutation(
                    new int[] { 1, 2, 3, 4 },
                    new int[] { 4, 3, 2, 1 }
                    )
                );


            ps.DisplayMatrix = true;

            ps = ps2.CyclicPermutations();
            ps.DisplayMatrix = true;
            ps.Order         = 4;

            ps               = new PermutationList();
            ps.Order         = 4;
            ps.DisplayMatrix = true;
            ps.AddRange(ps2.OrderBy(o => o.ElementNameValue).ToList());

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(ps.ToLatex(), "Test_Permutations.html"); //display Latex via mathjax

            return(0);
        }