File: modfree.tst

package info (click to toggle)
gap 4r4p12-2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 29,584 kB
  • ctags: 7,113
  • sloc: ansic: 98,786; sh: 3,299; perl: 2,263; makefile: 498; asm: 63; awk: 6
file content (201 lines) | stat: -rw-r--r-- 5,538 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#############################################################################
##
#W  modfree.tst                 GAP library                     Thomas Breuer
##
#H  @(#)$Id: modfree.tst,v 4.15.4.4 2005/08/29 14:50:35 gap Exp $
##
#Y  Copyright (C)  1996,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany
##
##  To be listed in testall.g
##

gap> START_TEST("$Id: modfree.tst,v 4.15.4.4 2005/08/29 14:50:35 gap Exp $");

gap> u:= LeftModuleByGenerators( GF(3), [ [ Z(3), 0*Z(3) ] ] );
<vector space over GF(3), with 1 generators>
gap> v:= LeftModuleByGenerators( GF(2), [ [ Z(2), Z(2) ], [ Z(4), Z(4) ] ] );
<vector space over GF(2), with 2 generators>
gap> w:= LeftModuleByGenerators( GF(4), [ [ Z(2), Z(2) ] ] );
<vector space over GF(2^2), with 1 generators>
gap> u = v;
false
gap> v = u;
false
gap> v = w;
true
gap> v1:= LeftModuleByGenerators( GF(2), [ [Z(2),0*Z(2)], [0*Z(2),Z(2)] ] );
<vector space over GF(2), with 2 generators>
gap> v2:= LeftModuleByGenerators( GF(2), [ [Z(2),Z(2)], [Z(2),0*Z(2)] ] );
<vector space over GF(2), with 2 generators>
gap> v1 = v2;
true
gap> v < w;
false
gap> w < v;
false
gap> w < v1;
false
gap> v2 < w;
true
gap> Zero( v ) in v;
true
gap> IsFiniteDimensional( v );
true
gap> IsFiniteDimensional( Integers^3 );
true
gap> IsFinite( v );
true
gap> IsFinite( Integers^3 );
false
gap> IsTrivial( v );
false
gap> IsTrivial( TrivialSubspace( v ) );
true
gap> Size( v );
4
gap> Size( Integers^4 );
infinity
gap> enum:= Enumerator( v );
<enumerator of <vector space of dimension 2 over GF(2)>>
gap> len:= Length( enum );
4
gap> l:= [];;
gap> for i in [ 1 .. len ] do
>   l[i]:= enum[i];
> od;
gap> Print(l,"\n");
[ [ 0*Z(2), 0*Z(2) ], [ Z(2^2), Z(2^2) ], [ Z(2)^0, Z(2)^0 ], 
  [ Z(2^2)^2, Z(2^2)^2 ] ]
gap> ForAll( [ 1 .. len ], i -> i = Position( enum, enum[i], 0 ) );
true
gap> v:= LeftModuleByGenerators( GF(2), [ [ Z(2), Z(2) ], [ Z(4), Z(4) ] ] );
<vector space over GF(2), with 2 generators>
gap> Print(AsList( v ),"\n");
[ [ 0*Z(2), 0*Z(2) ], [ Z(2)^0, Z(2)^0 ], [ Z(2^2), Z(2^2) ], 
  [ Z(2^2)^2, Z(2^2)^2 ] ]
gap> Print(AsSSortedList( v ),"\n");
[ [ 0*Z(2), 0*Z(2) ], [ Z(2)^0, Z(2)^0 ], [ Z(2^2), Z(2^2) ], 
  [ Z(2^2)^2, Z(2^2)^2 ] ]
gap> IsSubset( v, w );
true
gap> IsSubset( w, v );
true
gap> IsSubset( v, v1 );
false
gap> IsSubset( v, v2 );
false
gap> IsSubset( v1, GF(2)^2 );
true
gap> IsSubset( GF(2)^2, v1 );
true
gap> IsSubset( w, GF(2)^2 );
false
gap> IsSubset( GF(2)^2, w );
false
gap> IsSubset( w, GF(4)^2 );
false
gap> IsSubset( GF(4)^2, w );
true
gap> Dimension( v );
2
gap> Dimension( Integers^4 );
4
gap> GeneratorsOfLeftModule( Rationals^2 );
[ [ 1, 0 ], [ 0, 1 ] ]
gap> enum:= Enumerator( v );;
gap> Print(enum,"\n");
[ [ 0*Z(2), 0*Z(2) ], [ Z(2)^0, Z(2)^0 ], [ Z(2^2), Z(2^2) ], 
  [ Z(2^2)^2, Z(2^2)^2 ] ]
gap> iter:= Iterator( v );
<iterator>
gap> l:= [];;
gap> for i in [ 1 .. len ] do
>      l[i]:= NextIterator( iter );
>    od;
gap> IsDoneIterator( iter );
true
gap> enum:= Enumerator( Integers^3 );
<enumerator of ( Integers^3 )>
gap> l:= [];;
gap> for i in [ 1000 .. 1100 ] do
>      Add( l, enum[i] );
>    od;
gap> Print(l{ [ 17 .. 25 ] },"\n");
[ [ -5, 3, 1 ], [ -5, -3, 1 ], [ -5, 4, 1 ], [ -5, -4, 1 ], [ -5, 5, 1 ], 
  [ -5, 0, -1 ], [ -5, 1, -1 ], [ -5, -1, -1 ], [ -5, 2, -1 ] ]
gap> ForAll( [ 1 .. 1000 ], i -> i = Position( enum, enum[i], 0 ) );
true
gap> iter:= Iterator( Integers^3 );
<iterator>
gap> NextIterator( iter );
[ 0, 0, 0 ]
gap> NextIterator( iter );
[ 1, 0, 0 ]
gap> NextIterator( iter );
[ 0, 1, 0 ]
gap> for i in [ 1 .. 1000 ] do
>      NextIterator( iter );
>    od;
gap> l:= [];;
gap> for i in [ 1 .. 10 ] do
>      l[i]:= NextIterator( iter );
>    od;
gap> Print(l,"\n");
[ [ -5, 2, 0 ], [ -5, -2, 0 ], [ -5, 3, 0 ], [ -5, -3, 0 ], [ -5, 4, 0 ], 
  [ -5, -4, 0 ], [ -5, 5, 0 ], [ -5, 0, 1 ], [ -5, 1, 1 ], [ -5, -1, 1 ] ]
gap> IsDoneIterator( iter );
false
gap> v:= LeftModuleByGenerators( GF(2), [ [ Z(2), Z(2) ], [ Z(4), Z(4) ] ] );
<vector space over GF(2), with 2 generators>
gap> c:= ClosureLeftModule( v, [ 0*Z(2), Z(2) ] );
<vector space over GF(2), with 3 generators>
gap> c:= ClosureLeftModule( c, [ Z(4), 0*Z(2) ] );
<vector space over GF(2), with 4 generators>
gap> Dimension( c );
4
gap> FreeLeftModule( Integers, [ [ 1, 0 ], [ 1, 1 ] ] );
<free left module over Integers, with 2 generators>
gap> f:= FreeLeftModule( Integers, [ [ 1, 0 ], [ 1, 1 ] ], "basis" );
<free left module over Integers, with 2 generators>
gap> FreeLeftModule( Integers, [ [ 1, 0 ], [ 1, 1 ] ], [ 0, 0 ] );
<free left module over Integers, with 2 generators>
gap> FreeLeftModule( Integers, [ [ 1, 0 ], [ 1, 1 ] ], [ 0, 0 ], "basis" );
<free left module over Integers, with 2 generators>
gap> IsRowModule( f );
true
gap> IsFullRowModule( f );
true
gap> FullRowModule( Integers, 27 );
( Integers^27 )
gap> f:= FullRowModule( GF(27), 27 );
( GF(3^3)^27 )
gap> GF(27)^27 = f;
true
gap> Dimension( f );
27
gap> v:= Integers^4;
( Integers^4 )
gap> GeneratorsOfLeftModule( v );
[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]
gap> [ 1, 2, 3, 4 ] in v;
true
gap> [ 1, 2, 3, 4 ] / 2 in v;
false
gap> [ 1, 2, 3, 4 ] / 2 in Rationals^4;
true
gap> c:= CanonicalBasis( v );
CanonicalBasis( ( Integers^4 ) )
gap> BasisVectors( c );
[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]
gap> Coefficients( c, [ 1, 2, 3, 4 ] );
[ 1, 2, 3, 4 ]
gap> Basis( Integers^2 );
CanonicalBasis( ( Integers^2 ) )

gap> STOP_TEST( "modfree.tst", 37100000 );


#############################################################################
##
#E