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

563680 views
1
#include "typedef.h"
2
#include "datei.h"
3
#include "matrix.h"
4
#include "getput.h"
5
6
lattice_element **super_lattice(char *symb,int dim,int almost,int zclass,
7
int *no, int OPTION)
8
{
9
10
int i,
11
j,
12
pos,
13
found;
14
15
FILE *infile;
16
17
lattice_element **RES,
18
*TMP;
19
20
/* saves space on the stack */
21
static char filename[1000];
22
23
/* get the appropiate filename */
24
sprintf(filename,"%s%s%d/%s%s_%d_%d",TOPDIR,"/tables/lattices/dim",
25
dim,"reverse_",symb,almost,zclass);
26
27
infile = fopen(filename,"r");
28
29
/* save cores */
30
if (infile == NULL){
31
fprintf(stderr,"Couldn't find my input file %s\n",filename);
32
exit(4);
33
}
34
35
fscanf(infile,"%d\n",no);
36
37
RES = (lattice_element **) malloc(no[0] * sizeof(lattice_element *));
38
39
for (i=0;i<no[0];i++){
40
RES[i] = init_lattice_element();
41
42
fscanf(infile,"%s %d %d\n",
43
RES[i]->symbol,&RES[i]->almost,&RES[i]->zclass);
44
}
45
46
fclose(infile);
47
48
if (OPTION){
49
for (i=0;i<no[0];i++){
50
51
found = FALSE;
52
/* get the appropiate filename */
53
sprintf(filename,"%s%s%d/%s%s_%d_%d",TOPDIR,"/tables/lattices/dim",
54
dim,"lattice_",RES[i]->symbol,RES[i]->almost,RES[i]->zclass);
55
56
infile = fopen(filename,"r");
57
fscanf(infile,"#%d\n",&pos);
58
j = 0;
59
while (!found && j<pos){
60
TMP = fget_lattice_element(infile,FALSE);
61
62
found = (strcmp(TMP->symbol,symb) == 0);
63
found = found && (TMP->almost == almost) && (TMP->zclass == zclass);
64
65
if (found){
66
RES[i]->TR = TMP->TR;
67
TMP->TR = NULL;
68
RES[i]->N_orbits = TMP->N_orbits;
69
TMP->N_orbits = 0;
70
}
71
72
j++;
73
free_lattice_element(TMP);
74
}
75
fclose(infile);
76
77
if (!found){
78
fprintf(stderr,"ERROR: super_lattice\n");
79
exit(3);
80
}
81
82
/* get the apropriate group */
83
RES[i]->grp = brav_from_datei(RES[i]->symbol,
84
RES[i]->almost,RES[i]->zclass);
85
}
86
}
87
88
return RES;
89
}
90
91
92