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 construct.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 "pcp_vars.h"
12
#include "pga_vars.h"
13
#include "exp_vars.h"
14
#include "constants.h"
15
#include "pq_functions.h"
16
17
18
#define ITERATION 6
19
#define SINGLE_STAGE 5
20
21
static Logical select_group(int *min_step,
22
int *max_step,
23
int order_bound,
24
struct pga_vars *pga,
25
struct pcp_vars *pcp);
26
27
28
/* prepare to construct, partially or completely, some or all of the
29
immediate descendants of group group_nmr stored on start_file */
30
31
int construct(int call_depth,
32
struct pga_vars *flag,
33
int option,
34
FILE *output_file,
35
FILE *start_file,
36
int k,
37
int order_bound,
38
int group_nmr,
39
struct pga_vars *pga,
40
struct pcp_vars *pcp)
41
{
42
int ***auts;
43
char *name;
44
register int step;
45
int min_step, max_step;
46
int nmr_of_descendants = 0;
47
int nmr_of_capables = 0;
48
int nmr_of_covers;
49
int x_dim, y_dim;
50
FILE *tmp_file;
51
Logical change;
52
53
if (option == ITERATION) {
54
restore_pcp(start_file, pcp);
55
auts = restore_pga(start_file, pga, pcp);
56
/* enforce any law on the p-covering group of starting group */
57
if (call_depth == 1)
58
enforce_laws(flag, pga, pcp);
59
start_group(&tmp_file, auts, pga, pcp);
60
} else {
61
auts = restore_group(TRUE, start_file, group_nmr, pga, pcp);
62
RESET(start_file);
63
}
64
65
66
/* save dimension of autormorphism array for later call to free */
67
x_dim = pga->m;
68
y_dim = pcp->lastg;
69
70
pga->nmr_of_descendants = 0;
71
pga->nmr_of_capables = 0;
72
73
switch (option) {
74
75
case SINGLE_STAGE:
76
defaults_pga(option, &k, flag, pga, pcp);
77
copy_flags(flag, pga);
78
name = GetString("Input output file name: ");
79
output_file = OpenFileOutput(name);
80
enforce_laws(flag, pga, pcp);
81
print_group_details(pga, pcp);
82
nmr_of_covers =
83
reduced_covers(output_file, output_file, k, auts, pga, pcp);
84
if (pcp->overflow)
85
exit(FAILURE);
86
nmr_of_descendants = pga->nmr_of_descendants;
87
nmr_of_capables = pga->nmr_of_capables;
88
report(nmr_of_capables, nmr_of_descendants, nmr_of_covers, pga, pcp);
89
auts = restore_group(TRUE, start_file, group_nmr, pga, pcp);
90
RESET(start_file);
91
RESET(output_file);
92
break;
93
94
case ITERATION:
95
print_group_details(pga, pcp);
96
/* check if automorphism group is now soluble */
97
change = (pga->soluble == LINK_SOLUBLE_FLAG);
98
copy_flags(flag, pga);
99
if (change)
100
pga->soluble = LINK_SOLUBLE_FLAG;
101
if (!select_group(&min_step, &max_step, order_bound, pga, pcp)) {
102
free_array(auts, x_dim, y_dim, 1);
103
CloseFile(tmp_file);
104
break;
105
}
106
107
for (step = min_step; step <= max_step; ++step) {
108
pga->step_size = step;
109
start_stage(output_file, k, auts, pga, pcp);
110
report(pga->nmr_of_capables - nmr_of_capables,
111
pga->nmr_of_descendants - nmr_of_descendants,
112
0,
113
pga,
114
pcp);
115
nmr_of_descendants = pga->nmr_of_descendants;
116
nmr_of_capables = pga->nmr_of_capables;
117
free_array(auts, x_dim, y_dim, 1);
118
if (step != max_step) {
119
auts = restore_group(TRUE, tmp_file, 1, pga, pcp);
120
RESET(tmp_file);
121
}
122
pga->nmr_of_descendants = nmr_of_descendants;
123
pga->nmr_of_capables = nmr_of_capables;
124
change = (pga->soluble == LINK_SOLUBLE_FLAG);
125
copy_flags(flag, pga);
126
if (change)
127
pga->soluble = LINK_SOLUBLE_FLAG;
128
}
129
CloseFile(tmp_file);
130
break;
131
} /* switch */
132
133
/* were terminal groups processed? */
134
if (pga->terminal)
135
return nmr_of_descendants;
136
else
137
return nmr_of_capables;
138
}
139
140
/* report on the number immediate descendants and on those capable */
141
142
void report(int nmr_of_capables,
143
int nmr_of_descendants,
144
int nmr_of_covers,
145
struct pga_vars *pga,
146
struct pcp_vars *pcp)
147
{
148
register int *y = y_address;
149
150
/*
151
FILE * COUNT;
152
COUNT = OpenFile ("COUNT", "a+");
153
fprintf (COUNT, "%d,\n", nmr_of_descendants);
154
*/
155
156
if (nmr_of_descendants != 0) {
157
printf("# of immediate descendants of order %d^%d is %d\n",
158
pcp->p,
159
y[pcp->clend + pcp->cc - 1] + pga->step_size,
160
nmr_of_descendants);
161
if (nmr_of_capables != 0)
162
printf("# of capable immediate descendants is %d\n", nmr_of_capables);
163
} else if (nmr_of_covers != 0)
164
printf("# of reduced %d-covering groups is %d\n", pcp->p, nmr_of_covers);
165
}
166
167
/* print out basic information about the starting group */
168
169
void print_group_details(struct pga_vars *pga, struct pcp_vars *pcp)
170
{
171
register int *y = y_address;
172
int order;
173
174
printf("\n**************************************************\n");
175
printf("Starting group: %s\n", pcp->ident);
176
order = pcp->newgen ? y[pcp->clend + pcp->cc - 1] : y[pcp->clend + pcp->cc];
177
printf("Order: %d^%d\n", pcp->p, order);
178
printf("Nuclear rank: %d\n", pga->nuclear_rank);
179
printf("%d-multiplicator rank: %d\n", pga->p, pga->multiplicator_rank);
180
}
181
182
/* check if the group is a valid starting group */
183
184
static Logical select_group(int *min_step,
185
int *max_step,
186
int order_bound,
187
struct pga_vars *pga,
188
struct pcp_vars *pcp)
189
{
190
register int *y = y_address;
191
192
int max_extension = order_bound - y[pcp->clend + pcp->cc - 1];
193
Logical select = TRUE;
194
195
if (pga->step_size == ALL) {
196
*max_step = MIN(pcp->newgen, max_extension);
197
if (*max_step <= 0) {
198
invalid_group(pcp);
199
return FALSE;
200
} else
201
*min_step = 1;
202
} else {
203
if (pga->step_size > pcp->newgen || pga->step_size > max_extension) {
204
invalid_group(pcp);
205
return FALSE;
206
} else
207
*min_step = *max_step = pga->step_size;
208
}
209
210
return select;
211
}
212
213
/* print a message that the group is not a valid starting group */
214
215
void invalid_group(struct pcp_vars *pcp)
216
{
217
printf("Group %s is an invalid starting group\n", pcp->ident);
218
}
219
220
/* enforce laws on p-covering group of starting group --
221
these include exponent and metabelian laws */
222
223
void
224
enforce_laws(struct pga_vars *flag, struct pga_vars *pga, struct pcp_vars *pcp)
225
{
226
struct exp_vars exp_flag;
227
228
if (flag->exponent_law != 0) {
229
initialise_exponent(&exp_flag, pcp);
230
pcp->extra_relations = flag->exponent_law;
231
extra_relations(&exp_flag, pcp);
232
eliminate(FALSE, pcp);
233
set_values(pga, pcp);
234
}
235
}
236
237