Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/GAP/tst/testinstall/opers/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 18.9.2025 mit Größe 872 B image not shown  

Quelle  RandomMat.tst   Sprache: unbekannt

 
gap> START_TEST("RandomMat.tst");

#
gap> check:=function(M, m, n, R)
>   Assert(0, Length(M) = m, "bad row count");
>   Assert(0, ForAll(M, row -> Length(row) = n), "bad row length");
>   Assert(0, ForAll(M, row -> ForAll(row, x -> x in R)), "bad entry");
> end;;

#
gap> for n in [1..10] do
>   for m in [1..10] do
>     check(RandomMat(m, n), m, n, Integers);
>   od;
> od;
gap> for n in [1..10] do
>   for m in [1..10] do
>     check(RandomMat(GlobalMersenneTwister, m, n), m, n, Integers);
>   od;
> od;

#
gap> R := GF(2);;
gap> for n in [1..10] do
>   for m in [1..10] do
>     check(RandomMat(m, n, R), m, n, R);
>   od;
> od;
gap> for n in [1..10] do
>   for m in [1..10] do
>     check(RandomMat(GlobalMersenneTwister, m, n, R), m, n, R);
>   od;
> od;

#
gap> RandomMat(0);
Error, usage: RandomMat( [rs ,] <m>, <n> [, <F>] )

#
gap> STOP_TEST("RandomMat.tst");

[ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ]