Unimodular matrices with additional restrictions
I'd like to generate some unimodular matrices over ZZ with some restrictions:
- the entries are between -2 and 2
- the matrix is symmetric: A=At
Item (1) above can be addressed with the option upper_bound
. Simply searching for matrices satisfying (1) and (2),
for j in [1..1000]:
A = random_matrix(ZZ,3,3, algorithm = 'unimodular', upper_bound = 3, max_tries = 1000)
if A == A.transpose():
A
becomes extremely inefficient, especially as the dimension grows. Is there a way to enforce items (1),(2) within the unimodular algorithm? Or another workaround?
Edit: I originally also wanted the diagonal entries fixed at 2, but this is a bit too restrictive.
Are you sure that your restrictions are correct? For example, let A=(2aba2cbc2), with a,b,c∈Z. Since det(A)=8+2(abc−a2−b2−c2), A will be unimodular if and only if a2+b2+c2−abc=72, which is impossible because a2+b2+c2−abc∈Z.
Good point. This certainly works if the dimension is 8 e.g. the E8 root lattice gram matrix: E8 lattice wiki. I edited the post. Thank you