Revision history [back]

I'd like to generate some unimodular matrices over ZZ with some restrictions:

1. the entries are between -2 and 2
2. the main diagonal entries are fixed: $a_{jj} = 2$
3. the matrix is symmetric: $A = A^t$

Item 1 above can be addressed with the option upper_bound. Simply searching for matrices satisfying (1) and (3),

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)-(3) within the unimodular algorithm? Or another workaround?

I'd like to generate some unimodular matrices over ZZ with some restrictions:

1. the entries are between -2 and 2
2. the main diagonal entries are fixed: $a_{jj} = 2$
3. the matrix is symmetric: $A = A^t$

Item 1 (1) above can be addressed with the option upper_bound. Simply searching for matrices satisfying (1) and (3),

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)-(3) within the unimodular algorithm? Or another workaround?

I'd like to generate some unimodular matrices over ZZ with some restrictions:

1. the entries are between -2 and 2
2. the main diagonal entries are fixed: $a_{jj} = 2$
3. the matrix is symmetric: $A = A^t$

Item (1) above can be addressed with the option upper_bound. Simply searching for matrices satisfying (1) and (3),(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)-(3) (1),(2) within the unimodular algorithm? Or another workaround?

I'd like to generate some unimodular matrices over ZZ with some restrictions:

1. the entries are between -2 and 2
2. the matrix is symmetric: $A = A^t$

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.