up previous next
RandomUnimodularMat

random unimodular matrix

Syntax
RandomUnimodularMat(R: RING, N: INT): MAT
RandomUnimodularMat(R: RING, N: INT, Niters: INT): MAT

Description
The function returns a random N -by- N matrix with integer entries, and determinant +1 or -1. The matrix is over the ring R .

The optional 3rd argument says how many internal iterations to perform: the algorithm starts with an identity matrix, then on each iteration simply adds or substracts one random row to another random row. The default number of iterations is currently 25*N .

Example
/**/ RandomUnimodularMat(ZZ, 3);
matrix(ZZ,
 [[-684, -2919, -769],
  [1054, 4498, 1185],
  [-519, -2215, -584]])

See Also