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

563667 views
1
#include "typedef.h"
2
#include "matrix.h"
3
#include "longtools.h"
4
#include "sort.h"
5
#include "bravais.h"
6
7
static matrix_TYP *formspace_operation(matrix_TYP **F,int Fno,matrix_TYP *N)
8
{
9
10
int i;
11
12
matrix_TYP *res,
13
*tmp,
14
*N_tr;
15
16
res = init_mat(Fno,Fno,"");
17
N_tr = tr_pose(N);
18
19
for (i=0;i<Fno;i++){
20
tmp = scal_pr(N_tr,F[i],TRUE);
21
form_to_vec_modular(res->array.SZ[i],tmp,F,Fno);
22
free_mat(tmp);
23
}
24
25
free_mat(N_tr);
26
27
return res;
28
}
29
30
31
static int position(matrix_TYP **a,matrix_TYP *x,int n)
32
/* returns the first index i<n such that a[i] == x, and
33
-1 if none exists */
34
{
35
int i=0;
36
37
while (i<n){
38
if (mat_comp(a[i],x) == 0){
39
return i;
40
}
41
i++;
42
}
43
return -1;
44
}
45
46
void red_normal(bravais_TYP *G)
47
{
48
49
int i;
50
51
matrix_TYP **REP,
52
*tmp;
53
54
REP = (matrix_TYP **) malloc(G->normal_no * sizeof(matrix_TYP *));
55
56
/* calculate the presentation on the formspace (bare in mind that it
57
is faithfull for N_GL_n(Z) (G)/G if G is a bravais_group */
58
for (i=0;i<G->normal_no;i++){
59
REP[i] = formspace_operation(G->form,G->form_no,G->normal[i]);
60
}
61
62
/* see if the are nessesary */
63
for (i=1;i<G->normal_no;i++){
64
if (position(REP,REP[i],i) != (-1)){
65
/* throw it away */
66
free_mat(G->normal[i]);
67
G->normal[i] = NULL;
68
}
69
else{
70
/* we might got an inverse already */
71
tmp = long_mat_inv(REP[i]);
72
if (position(REP,tmp,i) != (-1)){
73
free_mat(G->normal[i]);
74
G->normal[i] = NULL;
75
}
76
free_mat(tmp);
77
}
78
}
79
80
/* free REP */
81
for (i=0;i<G->normal_no;i++)
82
free_mat(REP[i]);
83
free(REP);
84
85
/* now swap out the NULL's we got in G->normal */
86
for (i=0;i<G->normal_no;i++){
87
if (G->normal[i] == NULL){
88
G->normal_no--;
89
G->normal[i]= G->normal[G->normal_no];
90
i--;
91
}
92
}
93
94
return;
95
}
96
97