Skip to content

Commit 207cf44

Browse files
mahrudd-torrance
authored andcommitted
fixes #3451
1 parent c12eed4 commit 207cf44

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

M2/Macaulay2/m2/genmat.m2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ random(List,Ring) := RingElement => opts -> (deg,R) -> (
7272

7373
random(ZZ,Ring) := RingElement => opts -> (n,R) -> random({n},R,opts)
7474

75+
other := (i, m) -> (i + random m) % m
7576
randomMR := opts -> (F,G) -> (
7677
R := ring F;
7778
m := numgens F;
@@ -83,7 +84,6 @@ randomMR := opts -> (F,G) -> (
8384
if m>k then f = f || random(R^(toList( m-k : d1 )), R^n, opts)
8485
else if n > k then f = f | random(R^m, R^(toList (n-k : -d1)), opts);
8586
f = mutableMatrix f;
86-
other := (i,m) -> (i + random(m-1)) % m;
8787
if m>k then (
8888
for i to k-1 do rowAdd(f, i, random(d0,R,opts), random(k,m-1));
8989
for i to k-1 do rowSwap(f, i, other(i,m)))

M2/Macaulay2/tests/normal/randommat.m2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ assert isIsomorphism random(R^4,R^4,MaximalRank=>true)
3131
assert isInjective random(R^6,R^3,MaximalRank=>true)
3232
assert isSurjective random(R^3,R^6,MaximalRank=>true)
3333

34+
assert(random(ZZ^2, ZZ^2, MaximalRank => true) - id_(ZZ^2) != 0)
35+
assert(random(QQ^2, QQ^2, MaximalRank => true) - id_(QQ^2) != 0)
36+
assert(random(R^2, R^2, MaximalRank => true) - id_(R^2) != 0)

0 commit comments

Comments
 (0)