Goto Chapter: Top 1 2 3 4 5 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

5 Utility Functions
 5.1 Utility Functions

5 Utility Functions

5.1 Utility Functions

The following functions were created while implementing the high-level functions, but we found that they could be useful outside of our functions, too. You can find the specifications of the functions and some small examples here.

5.1-1 IsMatrixInRREF
‣ IsMatrixInRREF( mat )( function )

Returns: bool

Checks whether the matrix mat is in RREF

gap> M := RandomMat( 3, 3 );;
gap> Display( M );
[ [   1,   0,  -1 ],
  [  -1,  -1,   1 ],
  [  -1,   1,  -2 ] ]
gap> IsMatrixInRREF( M );
false
gap> L := [ [ 1, 0, 3 ], [ 0, 1, 5 ] ];;
gap> Display( L );
[ [  1,  0,  3 ],
  [  0,  1,  5 ] ]
gap> IsMatrixInRREF( L );
true

5.1-2 RandomEchelonMat
‣ RandomEchelonMat( height, width, rank, randomSeed, field )( function )

Returns: mat

Constructs a random matrix in RREF of the given height (number of rows), width (number of columns) and rank over the given field. Using the same random seed will recreate the same matrix.

gap> # We use Mersenne twister as a random seed here.
gap> randomSeed := RandomSource(IsMersenneTwister, 42);;
gap> M := RandomEchelonMat(10, 10, 5, randomSeed, GF(5));;
gap> Display(M);
1 . . . . . 1 4 4 .
. 1 . . . 1 3 2 4 3
. . 1 . . . 3 . 1 .
. . . 1 . 2 2 3 4 2
. . . . 1 2 2 4 1 4
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 Ind

generated by GAPDoc2HTML