CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
2
7 Examples of SCSCP usage
3
4
In this chapter we are going to demonstrate some examples of communication
5
between client and server using the SCSCP.
6
7
8
7.1 Providing services with the SCSCP package
9
10
You can try to run the SCSCP server with the configuration file
11
scscp/example/myserver.g. To do this, go to that directory and enter gap
12
myserver.g. After this you will see some information messages and finally
13
the server will start to wait for the connection. The final part of the
14
startup screen may look as follows:
15
16
 Example 
17

18
#I Installed SCSCP procedure Factorial
19
#I Installed SCSCP procedure WS_Factorial
20
#I Installed SCSCP procedure GroupIdentificationService
21
#I Installed SCSCP procedure IdGroup512ByCode
22
#I Installed SCSCP procedure WS_IdGroup
23
#I Installed SCSCP procedure WS_Karatsuba
24
#I Installed SCSCP procedure EvaluateOpenMathCode
25
#I Ready to accept TCP/IP connections at localhost:26133 ...
26
#I Waiting for new client connection at localhost:26133 ...
27

28

29
30
See further self-explanatory comments in the file scscp/example/myserver.g.
31
There also some test files in the directory scscp/tst/ supplied with
32
detailed comments. First, you may use demonstration files, preliminary
33
turning on the demonstration mode as it is explained in these files, or just
34
executing step by step each command from scscp/tst/demo.g and
35
scscp/tst/omdemo.g. Then you can try to use files scscp/tst/id512.g,
36
scscp/tst/idperm.g and scscp/tst/factor.g for further tests of SCSCP
37
services.
38
39
40
7.2 Identifying groups of order 512
41
42
We will give an example guiding you through all steps of creation of your
43
own SCSCP service.
44
45
The GAP Small Group Library does not provide identification for groups of
46
order 512 using the function IdGroup:
47
48
 Example 
49

50
gap> IdGroup( DihedralGroup( 256 ) );
51
[ 256, 539 ]
52
gap> IdGroup(DihedralGroup(512)); 
53
Error, the group identification for groups of size 512 is not available 
54
called from
55
<function "unknown">( <arguments> )
56
 called from read-eval loop at line 71 of *stdin*
57
you can 'quit;' to quit to outer loop, or
58
you can 'return;' to continue
59
brk> 
60

61

62
63
However, the GAP package ANUPQ [GNO] has a function
64
IdStandardPresented512Group that does this work as demonstrated below:
65
66
 Example 
67

68
gap> LoadPackage("anupq");
69
---------------------------------------------------------------------------
70
Loading ANUPQ (ANU p-Quotient) 3.1.4
71
GAP code by Greg Gamble <[email protected]> (address for correspondence)
72
 Werner Nickel (http://www.mathematik.tu-darmstadt.de/~nickel/)
73
 [uses ANU pq binary (C code program) version: 1.9]
74
C code by Eamonn O'Brien (http://www.math.auckland.ac.nz/~obrien)
75
Co-maintained by Max Horn <[email protected]>
76

77
 For help, type: ?ANUPQ
78
---------------------------------------------------------------------------
79
true
80
gap> G := DihedralGroup( 512 ); 
81
<pc group of size 512 with 9 generators>
82
gap> F := PqStandardPresentation( G );
83
<fp group on the generators [ f1, f2, f3, f4, f5, f6, f7, f8, f9 ]>
84
gap> H := PcGroupFpGroup( F );
85
<pc group of size 512 with 9 generators>
86
gap> IdStandardPresented512Group( H );
87
[ 512, 2042 ]
88

89

90
91
The package ANUPQ requires UNIX environment and it is natural to provide an
92
identification service for groups of order 512 to make it available for
93
other platforms.
94
95
Now we need to decide how the client will transmit a group to the server.
96
Can we encode this group in OpenMath? But there is no content dictionary for
97
PcGroups. Should we convert it to a permutation representation to be able to
98
use existing content dictionaries? But then the resulting OpenMath code will
99
be not compact. However, the SCSCP protocol provides enough freedom for the
100
user to select its own data representation, and since we are linking
101
together two copies of the same system, we may use the pcgs code to pass the
102
data to the server (see CodePcGroup (Reference: CodePcGroup).
103
104
First we create a function which accepts the integer number that is the code
105
for pcgs of a group of order 512 and returns the number of this group in the
106
GAP Small Groups library:
107
108
 Example 
109

110
IdGroup512ByCode := function( code )
111
local G, F, H;
112
G := PcGroupCode( code, 512 );
113
F := PqStandardPresentation( G );
114
H := PcGroupFpGroup( F );
115
return IdStandardPresented512Group( H );
116
end;
117

118

119
120
After such function was created on the server, we need to make it visible as
121
an SCSCP procedure:
122
123
 Example 
124

125
gap> InstallSCSCPprocedure("IdGroup512", IdGroup512ByCode );
126
InstallSCSCPprocedure : procedure IdGroup512 installed. 
127

128

129
130
Note that this function assumes that the argument is a valid code for some
131
group of order 512, and we wish the client to make it sure that this is the
132
case. To do this, and also for the client's convenience, we provide the
133
client's counterpart for this service. Here the group must be a pc-group of
134
order 512, otherwise an error message will appear.
135
136
 Example 
137

138
gap> IdGroup512 := function( G )
139
>  local code, result;
140
>  if Size( G ) <> 512 then
141
>  Error( "G must be a group of order 512 \n" );
142
>  fi;
143
>  code := CodePcGroup( G );
144
>  result := EvaluateBySCSCP( "IdGroup512ByCode", [ code ], 
145
>  "localhost", 26133 );
146
>  return result.object;
147
> end;;
148

149

150
151
Now the client can call the function IdGroup512, and the procedure of
152
getting result is as much straightforward as using IdGroup for those groups
153
where it works:
154
155
 Example 
156

157
gap> IdGroup512(DihedralGroup(512));
158
[ 512, 2042 ]
159

160

161
162
163