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

563642 views
1
#include"typedef.h"
2
#include"matrix.h"
3
#include"bravais.h"
4
/**************************************************************************\
5
@---------------------------------------------------------------------------
6
@---------------------------------------------------------------------------
7
@ FILE: tr_bravais.c
8
@---------------------------------------------------------------------------
9
@---------------------------------------------------------------------------
10
@
11
\**************************************************************************/
12
13
14
/**************************************************************************\
15
@---------------------------------------------------------------------------
16
@ bravais_TYP *tr_bravais(B, calcforms, invert)
17
@ bravais_TYP *B;
18
@ int calcforms;
19
@ int invert;
20
@
21
@ 'tr_bravais' caclulates the group G = B^{tr}
22
@ The matrices in B->gen, B->zentr, B->normal and B->cen are transposed
23
@ (if exists)
24
@ If calcforms == 0, then the matrices of G->form are not calculated
25
@ If calcforms == 1, then G->form is calculated with 'formspace'
26
@ If calcforms == 2, then G->form is calculated with 'invar_space'
27
@ if B->form_no != 0, invar_space is started with
28
@ fdim = B->form_no, otherwise the argument 'fdim'
29
@ for invar_space is calculated by calculating the
30
@ formspace with p_formspace modulo 101.
31
@ If (invert == TRUE) the matrices in G->gen,G->cen,G->normal
32
@ are inverted.
33
@---------------------------------------------------------------------------
34
@
35
\**************************************************************************/
36
bravais_TYP *tr_bravais(B, calcforms,invert)
37
bravais_TYP *B;
38
int calcforms;
39
int invert;
40
{
41
bravais_TYP *G;
42
int i,j,k;
43
matrix_TYP **XX,
44
*tmp;
45
46
G = init_bravais(B->dim);
47
if(B->gen_no != 0)
48
{
49
G->gen_no = B->gen_no;
50
if( (G->gen = (matrix_TYP **)malloc(G->gen_no *sizeof(matrix_TYP *))) == NULL)
51
{
52
printf("malloc of 'G->gen' in 'tr_bravais' failed\n");
53
exit(2);
54
}
55
for(i=0;i<G->gen_no;i++)
56
if (invert){
57
tmp = mat_inv(B->gen[i]);
58
G->gen[i] = tr_pose(tmp);
59
free_mat(tmp);
60
}
61
else{
62
G->gen[i] = tr_pose(B->gen[i]);
63
}
64
}
65
if(B->zentr_no != 0)
66
{
67
G->zentr_no = B->zentr_no;
68
if( (G->zentr = (matrix_TYP **)malloc(G->zentr_no *sizeof(matrix_TYP *))) == NULL)
69
{
70
printf("malloc of 'G->zentr' in 'tr_bravais' failed\n");
71
exit(2);
72
}
73
for(i=0;i<G->zentr_no;i++)
74
G->zentr[i] = tr_pose(B->zentr[i]);
75
}
76
if(B->normal_no != 0)
77
{
78
G->normal_no = B->normal_no;
79
if( (G->normal = (matrix_TYP **)malloc(G->normal_no *sizeof(matrix_TYP *))) == NULL)
80
{
81
printf("malloc of 'G->normal' in 'tr_bravais' failed\n");
82
exit(2);
83
}
84
for(i=0;i<G->normal_no;i++)
85
if (invert){
86
tmp = mat_inv(B->normal[i]);
87
G->normal[i] = tr_pose(tmp);
88
free_mat(tmp);
89
}
90
else{
91
G->normal[i] = tr_pose(B->normal[i]);
92
}
93
}
94
if(B->cen_no != 0)
95
{
96
G->cen_no = B->cen_no;
97
if( (G->cen = (matrix_TYP **)malloc(G->cen_no *sizeof(matrix_TYP *))) == NULL)
98
{
99
printf("malloc of 'G->cen' in 'tr_bravais' failed\n");
100
exit(2);
101
}
102
for(i=0;i<G->cen_no;i++)
103
if (invert){
104
tmp = mat_inv(B->cen[i]);
105
G->cen[i] = tr_pose(tmp);
106
free_mat(tmp);
107
}
108
else{
109
G->cen[i] = tr_pose(B->cen[i]);
110
}
111
}
112
if(calcforms == 1)
113
G->form = formspace(G->gen, G->gen_no, 1, &G->form_no);
114
if(calcforms == 2)
115
{
116
if(B->form_no != 0)
117
G->form = invar_space(G->gen, G->gen_no, B->form_no, 1, 100, &G->form_no);
118
else
119
{
120
XX = p_formspace(G->gen, G->gen_no, 101, 1, &i);
121
for(j=0;j<i;j++)
122
free_mat(XX[i]);
123
free(XX);
124
G->form = invar_space(G->gen, G->gen_no, i, 1, 100, &G->form_no);
125
}
126
}
127
128
/* inserted a return: tilman 7/1/97 */
129
return G;
130
}
131
132