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

563603 views
1
#include "typedef.h"
2
3
/***************************************************************************
4
@
5
@---------------------------------------------------------------------------
6
@ FILE: put_word.c
7
@---------------------------------------------------------------------------
8
@
9
****************************************************************************/
10
11
/***************************************************************************
12
@
13
@---------------------------------------------------------------------------
14
@
15
@ void put_word(int *w,
16
@ char *O)
17
@ outputs the word w to stdout.
18
@ the string O contatins the options. If O contains a 'G', the output
19
@ is done in gap format, if O contains a 'M', the output is
20
@ done in matrix format. Both is possible simultanously.
21
@---------------------------------------------------------------------------
22
@
23
****************************************************************************/
24
void put_word(int *w,
25
char *O)
26
{
27
28
int i;
29
30
if (strchr(O,'G')){
31
if (w[0] == 0){
32
printf("g[1]*g[1]^(-1)");
33
}
34
else{
35
for(i=1;i<w[0];i++){
36
if (w[i] > 0){
37
printf("g[%d]*",w[i]);
38
}
39
else{
40
printf("g[%d]^(-1)*",-w[i]);
41
}
42
if (!(i % 10)) printf("\n");
43
}
44
if (w[i] > 0){
45
printf("g[%d]",w[i]);
46
}
47
else{
48
printf("g[%d]^(-1)",-w[i]);
49
}
50
}
51
52
printf("\n");
53
}
54
55
if (strchr(O,'M')){
56
if (w[0] == 0){
57
printf("c 1 -1");
58
}
59
else{
60
printf("c ");
61
for(i=1;i<=w[0];i++)
62
printf("%d ",w[i]);
63
}
64
65
printf("\n");
66
}
67
68
69
fflush(stdout);
70
71
return;
72
73
} /* put_word(...) */
74
75
76