示例#1
0
        // Write the Cayley table
        private void writeOperationTables()
        {
            Factors  = DiscreteMath.PrimeFactors(graph.Order);
            divisors = DiscreteMath.Divisors(graph.Order);

            Stack <int> element = new Stack <int>();

            op  = new int[graph.Order, graph.Order];
            inv = new int[graph.Order];
            for (int i = 0; i < graph.Order; i++)
            {
                element = new Stack <int>();
                int j = i, k;
                while (tree.Item1[j] != -1)
                {
                    k = tree.Item1[j];
                    j = graph.InEdges[j, k];
                    element.Push(k);
                }

                for (j = 0; j < graph.Order; j++)
                {
                    k = j;
                    foreach (int g in element)
                    {
                        k = graph.OutEdges[k, g];
                    }
                    op[j, i] = k;
                    if (k == 0)
                    {
                        inv[j] = i;
                    }
                }
            }
        }
示例#2
0
        private Dictionary <int, int[]> AbelianStructure()
        {
            Dictionary <int, int[]> structure = new Dictionary <int, int[]>();

            int[] primes = DiscreteMath.PrimeFactors(group.Order).Distinct().ToArray();
            foreach (int p in primes)
            {
                int k = group.POrderStats[p].Length;
                if (k == 2)
                {
                    // Elementary abelian
                    structure[p] = new int[] {
                        MathUtils.Multiplicity(group.POrderStats[p][1] + 1, p)
                    };
                }
                else if (group.POrderStats[p][k - 1] > 0)
                {
                    // Cyclic
                    structure[p]        = new int[k - 1];
                    structure[p][k - 2] = 1;
                }
                else
                {
                    structure[p] = new int[k - 1];
                    int[] sums  = new int[k];
                    int[] mults = new int[k + 1];
                    sums[0]  = 1;
                    mults[0] = 0;
                    for (int i = 1; i < k; i++)
                    {
                        sums[i]  = sums[i - 1] + group.POrderStats[p][i];
                        mults[i] = MathUtils.Multiplicity(sums[i], p);
                    }
                    mults[k] = mults[k - 1];
                    for (int i = 1; i < k - 1; i++)
                    {
                        structure[p][i - 1] = 2 * mults[i] - mults[i - 1] - mults[i + 1];
                    }
                }
            }
            return(structure);
        }