Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

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

563604 views
1
#include"typedef.h"
2
/**************************************************************************\
3
@---------------------------------------------------------------------------
4
@---------------------------------------------------------------------------
5
@ FILE: orb_division.c
6
@---------------------------------------------------------------------------
7
@---------------------------------------------------------------------------
8
@
9
\**************************************************************************/
10
11
12
/*****************************************
13
@ matrix_TYP *orbit_representatives(M, Manz, G, option, orbit_no, is_sorted)
14
@ matrix_TYP **M;
15
@ bravais_TYP *G;
16
@ int *option, Manz, *orbit_no;
17
@ int is_sorted;
18
@
19
@ The function 'orbit_representatives' calculates representatives
20
@ of a group 'G' (*bravais_TYP) on a set 'M' (**matrix_TYP) of matrices.
21
@ 'Manz' denotes the number of matrices in 'M'.
22
@ The number of representatives is return via the pointer (int *orbit_no).
23
@ If the set 'M' is sorted (with respect to the order defined in the
24
@ function 'cmp_mat()') the function makes use of it by searching
25
@ orbit elements in a sorted list.
26
@ if is_sorted = 1, it is assumed that 'M' is sorted.
27
@ CAUTION: This is not checked !
28
@ So is_sorted = 1 for unsorted 'M' yields a wrong result.
29
@ if is_sorted = 0, it is assumed that 'M' is unsorted.
30
@
31
@ The options are the same as in 'orbit_alg'.
32
******************************************/
33
34
matrix_TYP *orbit_representatives(M, Manz, G, option, orbit_no, is_sorted)
35
matrix_TYP **M;
36
bravais_TYP *G;
37
int *option, Manz, *orbit_no;
38
int is_sorted;
39
{
40
matrix_TYP *erg, **or;
41
int i,j,k, no;
42
int *merk, found;
43
44
extern matrix_TYP *init_mat();
45
extern matrix_TYP **orbit_alg();
46
extern int mat_comp();
47
48
erg = init_mat(2, Manz, "");
49
if((merk = (int *)calloc(Manz , sizeof(int))) == NULL)
50
{
51
printf("calloc of 'merk' in 'orbit_representatives' failed\n");
52
exit(2);
53
}
54
55
i = 0;
56
no = 0;
57
while(i<Manz)
58
{
59
while(i<Manz && merk[i] != 0)
60
i++;
61
if(i<Manz)
62
{
63
erg->array.SZ[0][no] = i;
64
or = orbit_alg(M[i], G, NULL, option, &(erg->array.SZ[1][no]));
65
merk[i] = no+1;
66
if(is_sorted == 1)
67
{
68
for(j=1;j<erg->array.SZ[1][no];j++)
69
{
70
found = mat_search(or[j], M, Manz, mat_comp);
71
if(found != -1)
72
merk[found] = no+1;
73
}
74
}
75
else
76
{
77
for(j=1;j<erg->array.SZ[1][no];j++)
78
{
79
found = FALSE;
80
for(k=i+1;k<Manz && found == FALSE;k++)
81
{
82
if(merk[k] != 1 && cmp_mat(or[j], M[k]) == 0)
83
{
84
merk[k] = no+1;
85
found = TRUE;
86
}
87
}
88
}
89
}
90
for(j=0;j<erg->array.SZ[1][no];j++)
91
free_mat(or[j]);
92
free(or);
93
no++;
94
}
95
}
96
real_mat(erg, 2, no);
97
*orbit_no = no;
98
free(merk);
99
return(erg);
100
}
101
102