Skip to content

Commit 1152ea5

Browse files
ffmat: remove undocumented RandomMatrix(field, dim, rank/s)
These function conflict with forthcoming changes in GAP, and since they are undocumented, I'm just removing them in this commit. See: gap-system/gap#6232 #1158
1 parent 27f9b6a commit 1152ea5

File tree

6 files changed

+21
-111
lines changed

6 files changed

+21
-111
lines changed

gap/elements/ffmat.gi

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -69,43 +69,6 @@ function(field, n)
6969
return Matrix(field, xy);
7070
end);
7171

72-
InstallMethod(RandomMatrixOp,
73-
"for a finite field, dimension, and list of ranks",
74-
[IsField and IsFinite, IsPosInt, IsList],
75-
function(R, n, ranks)
76-
local z, rk, mat, zv, conj, j;
77-
78-
if ForAny(ranks, x -> (x < 0) or (x > n)) then
79-
ErrorNoReturn("the list of ranks has to consist of numbers > 0 and < n");
80-
fi;
81-
82-
z := Zero(R);
83-
# Choose a matrix of given rank
84-
rk := Random(ranks);
85-
if rk = 0 then
86-
return ZeroMatrix(R, n, n);
87-
fi;
88-
mat := Unpack(Random(GL(rk, R)));
89-
# Extend it to n x n
90-
zv := [1 .. n - rk] * z;
91-
for j in [1 .. rk] do
92-
Append(mat[j], zv);
93-
od;
94-
zv := [1 .. n] * z;
95-
for j in [1 .. n - rk] do
96-
Add(mat, zv);
97-
od;
98-
# Swirl around
99-
# Is Permuting rows/columns enough?
100-
conj := Random(GL(n, R)); # PermutationMat(Random(Sym(n)), n, R);
101-
return Matrix(R, mat ^ conj);
102-
end);
103-
104-
InstallMethod(RandomMatrixOp,
105-
"for a finite field, dimension, and pos int",
106-
[IsField and IsFinite, IsPosInt, IsPosInt],
107-
{R, n, rank} -> RandomMatrixOp(R, n, [rank]));
108-
10972
#############################################################################
11073
# 2. Rows bases etc
11174
#############################################################################

gap/elements/semiringmat.gd

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ DeclareOperation("RandomMatrix",
8282
DeclareOperation("RandomMatrix",
8383
[IsOperation, IsPosInt, IsInt, IsInt]);
8484
DeclareOperation("RandomMatrix", [IsSemiring, IsInt]);
85-
DeclareOperation("RandomMatrix", [IsSemiring, IsInt, IsPosInt]);
86-
DeclareOperation("RandomMatrix", [IsSemiring, IsInt, IsList]);
8785

8886
DeclareConstructor("RandomMatrixCons", [IsMatrixOverSemiring,
8987
IsPosInt]);
@@ -95,9 +93,6 @@ DeclareConstructor("RandomMatrixCons", [IsMatrixOverSemiring,
9593
IsInt,
9694
IsInt]);
9795
DeclareOperation("RandomMatrixOp", [IsSemiring, IsPosInt]);
98-
DeclareOperation("RandomMatrixOp", [IsField and IsFinite, IsPosInt, IsList]);
99-
DeclareOperation("RandomMatrixOp", [IsField and IsFinite, IsZeroCyc, IsList]);
100-
DeclareOperation("RandomMatrixOp", [IsField and IsFinite, IsPosInt, IsPosInt]);
10196

10297
DeclareAttribute("AsList", IsMatrixOverSemiring);
10398
DeclareOperation("AsMutableList", [IsMatrixOverSemiring]);

gap/elements/semiringmat.gi

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -307,23 +307,23 @@ function(semiring, dim)
307307
return RandomMatrixOp(semiring, dim);
308308
end);
309309

310-
InstallMethod(RandomMatrix, "for a semiring, non-negative int, and pos int",
311-
[IsSemiring, IsInt, IsPosInt],
312-
function(semiring, dim, rank)
313-
if dim < 0 then
314-
TryNextMethod();
315-
fi;
316-
return RandomMatrixOp(semiring, dim, rank);
317-
end);
318-
319-
InstallMethod(RandomMatrix, "for a semiring, non-negative int, and list",
320-
[IsSemiring, IsInt, IsList],
321-
function(semiring, dim, ranks)
322-
if dim < 0 then
323-
TryNextMethod();
324-
fi;
325-
return RandomMatrixOp(semiring, dim, ranks);
326-
end);
310+
# InstallMethod(RandomMatrix, "for a semiring, non-negative int, and pos int",
311+
# [IsSemiring, IsInt, IsPosInt],
312+
# function(semiring, dim, rank)
313+
# if dim < 0 then
314+
# TryNextMethod();
315+
# fi;
316+
# return RandomMatrixOp(semiring, dim, rank);
317+
# end);
318+
#
319+
# InstallMethod(RandomMatrix, "for a semiring, non-negative int, and list",
320+
# [IsSemiring, IsInt, IsList],
321+
# function(semiring, dim, ranks)
322+
# if dim < 0 then
323+
# TryNextMethod();
324+
# fi;
325+
# return RandomMatrixOp(semiring, dim, ranks);
326+
# end);
327327

328328
InstallMethod(AsTransformation, "for a matrix over semiring",
329329
[IsMatrixOverSemiring],

gap/semigroups/semiffmat.gi

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,19 +308,17 @@ SEMIGROUPS_ProcessRandomArgsCons(IsMatrixOverFiniteFieldSemigroup, params));
308308
InstallMethod(RandomSemigroupCons,
309309
"for IsMatrixOverFiniteFieldSemigroup and list",
310310
[IsMatrixOverFiniteFieldSemigroup, IsList],
311-
function(_, params) # params = [nrgens, dim, field, ranks]
311+
function(_, params) # params = [nrgens, dim, field]
312312
return Semigroup(List([1 .. params[1]], i -> RandomMatrix(params[3],
313-
params[2],
314-
params[4])));
313+
params[2])));
315314
end);
316315

317316
InstallMethod(RandomMonoidCons,
318317
"for IsMatrixOverFiniteFieldMonoid and list",
319318
[IsMatrixOverFiniteFieldMonoid, IsList],
320-
function(_, params) # params = [nrgens, dim, field, ranks]
319+
function(_, params) # params = [nrgens, dim, field]
321320
return Monoid(List([1 .. params[1]], i -> RandomMatrix(params[3],
322-
params[2],
323-
params[4])));
321+
params[2])));
324322
end);
325323

326324
InstallMethod(RandomInverseSemigroupCons,

tst/standard/elements/ffmat.tst

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,6 @@ gap> NrRows(x);
8787
gap> x := RandomMatrix(GF(8), 10);;
8888
gap> NrRows(x);
8989
10
90-
gap> x := RandomMatrix(GF(3), 3, [3]);;
91-
gap> Rank(x);
92-
3
93-
gap> x := RandomMatrix(GF(3), 10, [3 .. 8]);;
94-
gap> Rank(x) in [3 .. 8];
95-
true
96-
gap> x := RandomMatrix(GF(3), 5, [0]);
97-
[ [ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ],
98-
[ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ],
99-
[ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ],
100-
[ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ],
101-
[ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ] ]
102-
gap> x := RandomMatrix(GF(3), 5, [1, -2, 1314]);
103-
Error, the list of ranks has to consist of numbers > 0 and < n
10490

10591
# Test \ = , \< for row basis
10692
gap> mat := Matrix(GF(3 ^ 2),
@@ -217,13 +203,6 @@ gap> Display(mat);
217203
9 2 7 8 10
218204
. 3 8 9 1
219205

220-
# Test RandomMatrix for finite field, dim, rank
221-
gap> x := RandomMatrix(GF(3), 3, 1);;
222-
gap> Rank(x);
223-
1
224-
gap> Rank(TransposedMat(x));
225-
1
226-
227206
# Test MatrixNC
228207
gap> x := Matrix(GF(3), [[Z(3) ^ 0, 0 * Z(3), Z(3)], [Z(3), 0 * Z(3), Z(3)],
229208
> [Z(3) ^ 0, Z(3) ^ 0, Z(3)]]);;
@@ -234,17 +213,6 @@ gap> z := Matrix(Unpack(x), y);
234213
gap> z = x;
235214
true
236215

237-
# Test RandomMatrix
238-
gap> RandomMatrix(GF(11), 0, []);
239-
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
240-
Error, no 1st choice method found for `RandomMatrixOp' on 3 arguments
241-
gap> RandomMatrix(GF(11), 0, [0]);
242-
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
243-
Error, no 1st choice method found for `RandomMatrixOp' on 3 arguments
244-
gap> RandomMatrix(GF(11), 0, [1]);
245-
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
246-
Error, no 1st choice method found for `RandomMatrixOp' on 3 arguments
247-
248216
# Test AsList for IsPlistMatrixRep
249217
gap> S := Semigroup(Transformation([2, 3, 1]));;
250218
gap> IsGroupAsSemigroup(S);

tst/standard/elements/semiringmat.tst

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -499,14 +499,6 @@ gap> mat := Matrix(GF(3), [[Z(3)]]);
499499
gap> Matrix(GF(3), mat);
500500
[ [ Z(3) ] ]
501501
502-
# Test RandomMatrix for a finite field
503-
gap> mat := RandomMatrix(GF(3), 3, 2);;
504-
gap> Rank(mat);
505-
2
506-
gap> mat := RandomMatrix(GF(3), 3, [2, 3]);;
507-
gap> Rank(mat) in [2, 3];
508-
true
509-
510502
# Test OneImmutable, fails
511503
gap> coll := [Matrix(IsNTPMatrix, [[2, 2], [0, 1]], 10, 10),
512504
> Matrix(IsNTPMatrix, [[2, 2], [0, 1]], 10, 9)];;
@@ -589,12 +581,6 @@ IO_Error
589581
gap> RandomMatrix(Integers, -1);
590582
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
591583
Error, no 2nd choice method found for `RandomMatrix' on 2 arguments
592-
gap> RandomMatrix(Integers, -1, 2);
593-
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
594-
Error, no 2nd choice method found for `RandomMatrix' on 3 arguments
595-
gap> RandomMatrix(Integers, -1, [2]);
596-
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
597-
Error, no 2nd choice method found for `RandomMatrix' on 3 arguments
598584

599585
#
600586
gap> SEMIGROUPS.StopTest();

0 commit comments

Comments
 (0)