CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
/****************************************************************************
2
**
3
*A degree.c ANUPQ source Eamonn O'Brien
4
**
5
*Y Copyright 1995-2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany
6
*Y Copyright 1995-2001, School of Mathematical Sciences, ANU, Australia
7
**
8
*/
9
10
#include "pq_defs.h"
11
#include "pga_vars.h"
12
#include "pq_functions.h"
13
#include "constants.h"
14
15
/* compute the number of allowable subgroups;
16
also, set up powers, offset, and inverses arrays */
17
18
void compute_degree(struct pga_vars *pga)
19
{
20
register int i;
21
register int maximum = 0;
22
23
pga->Degree = 0;
24
25
/* compute degree; store offset for each definition set */
26
for (i = 0; i < pga->nmr_def_sets; ++i) {
27
pga->offset[i] = pga->Degree;
28
29
/* this is a test to try to prevent integer overflow */
30
31
if (int_power(pga->p, pga->available[i]) > (INT_MAX - pga->Degree)) {
32
text(19, 0, 0, 0, 0);
33
if (!isatty(0))
34
exit(FAILURE);
35
else
36
return;
37
}
38
pga->Degree += int_power(pga->p, pga->available[i]);
39
if (maximum < pga->available[i])
40
maximum = pga->available[i];
41
}
42
43
/* store powers of prime */
44
pga->powers = allocate_vector(maximum + 1, 0, 0);
45
for (i = 0; i <= maximum; ++i)
46
pga->powers[i] = int_power(pga->p, i);
47
48
/* store inverses of 1 .. p - 1 */
49
pga->inverse_modp = allocate_vector(pga->p, 0, 0);
50
for (i = 1; i < pga->p; ++i)
51
pga->inverse_modp[i] = invert_modp(i, pga->p);
52
53
if (pga->print_degree)
54
printf("Degree of permutation group is %d\n", pga->Degree);
55
}
56
57