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

563665 views
1
#include"typedef.h"
2
#include"bravais.h"
3
#include"matrix.h"
4
#include"symm.h"
5
#include"autgrp.h"
6
7
/*******************************************************************************
8
@
9
@-------------------------------------------------------------------------------
10
@ FILE: bravais_tools.h
11
@
12
@-------------------------------------------------------------------------------
13
@
14
*******************************************************************************/
15
16
/*******************************************************************************
17
@
18
@------------------------------------------------------------------------------
19
@
20
@ bravais_TYP *bravais_group(bravais_TYP *H,int flag)
21
@
22
@ Calculates the bravais group of H. the result G of this function
23
@ will have G->gen and G->form assigned.
24
@ The program relies on H->form to be correct if it is given.
25
@ If flag>0, then the function will pair reduce the first form.
26
@ It is save to use this optiuon, but slower in well behaved examples.
27
@------------------------------------------------------------------------------
28
@
29
******************************************************************************/
30
bravais_TYP *bravais_group(bravais_TYP *H,int flag)
31
{
32
int i,
33
F_no;
34
35
matrix_TYP **F,
36
*PF,
37
*ID,
38
*SV;
39
40
bravais_TYP *G;
41
42
ID = init_mat(H->dim,H->dim,"1");
43
PF = rform(H->gen,H->gen_no,ID,101);
44
45
if (!flag){
46
SV = short_vectors(PF,max_diagonal_entry(PF),0,0,0,&i);
47
}
48
49
/* calculate the formspace if not given */
50
if (H->form_no == 0){
51
H->form = formspace(H->gen,H->gen_no,1,&H->form_no);
52
}
53
54
/* F will hold input for autgrp */
55
F_no = H->form_no;
56
F = (matrix_TYP **) malloc( (F_no+1) * sizeof(matrix_TYP *));
57
for (i=0;i<F_no;i++) F[i+1] = copy_mat(H->form[i]);
58
F[0] = PF;
59
60
if (!flag){
61
/* call autgrp to get the result */
62
G = autgrp(F,F_no+1,SV,NULL,0,NULL);
63
}
64
else{
65
G = pr_aut(F,F_no+1,NULL,0,NULL);
66
}
67
68
/* copy the forms to G->form */
69
G->form = (matrix_TYP **) malloc(F_no * sizeof(matrix_TYP *));
70
G->form_no = F_no;
71
for (i=0;i<G->form_no;i++) G->form[i] = F[i+1];
72
73
/* clean up */
74
free(F);
75
free_mat(PF);
76
if (!flag) free_mat(SV);
77
free_mat(ID);
78
79
return G;
80
}
81
82
/****************************************************************************
83
@
84
@----------------------------------------------------------------------------
85
@
86
@ bravais_TYP *copy_bravais(bravais_TYP *H)
87
@
88
@ copies all data form H to the result. Nothing is checked.
89
@----------------------------------------------------------------------------
90
@
91
*****************************************************************************/
92
bravais_TYP *copy_bravais(bravais_TYP *H)
93
{
94
95
int i;
96
97
bravais_TYP *G;
98
99
G = init_bravais(H->dim);
100
101
if (H->order != 0){
102
G->order = H->order;
103
memcpy(G->divisors,H->divisors,100*sizeof(int));
104
}
105
if (H->gen_no != 0){
106
G->gen = (matrix_TYP **) malloc(H->gen_no * sizeof(matrix_TYP *));
107
for (i=0;i<H->gen_no;i++) G->gen[i] = copy_mat(H->gen[i]);
108
G->gen_no = H->gen_no;
109
}
110
if (H->cen_no != 0){
111
G->cen = (matrix_TYP **) malloc(H->cen_no * sizeof(matrix_TYP *));
112
for (i=0;i<H->cen_no;i++) G->cen[i] = copy_mat(H->cen[i]);
113
G->cen_no = H->cen_no;
114
}
115
if (H->normal_no != 0){
116
G->normal = (matrix_TYP **) malloc(H->normal_no * sizeof(matrix_TYP *));
117
for (i=0;i<H->normal_no;i++) G->normal[i] = copy_mat(H->normal[i]);
118
G->normal_no = H->normal_no;
119
}
120
if (H->form_no != 0){
121
G->form = (matrix_TYP **) malloc(H->form_no * sizeof(matrix_TYP *));
122
for (i=0;i<H->form_no;i++) G->form[i] = copy_mat(H->form[i]);
123
G->form_no = H->form_no;
124
}
125
if (H->zentr_no != 0){
126
G->zentr = (matrix_TYP **) malloc(H->zentr_no * sizeof(matrix_TYP *));
127
for (i=0;i<H->zentr_no;i++) G->zentr[i] = copy_mat(H->zentr[i]);
128
G->zentr_no = H->zentr_no;
129
}
130
131
return G;
132
133
}
134
135