Revision history [back]

One can construct matrix space over GF(3) and then change ring of each matrix to ZZ and subtract 1:

MS = MatrixSpace(GF(3),2,2)
for T in MS:
M = T.change_ring(ZZ).apply_map(lambda x: x-1)
print(M,'\n')


One To get all matrices over ${ -1, 0, +1}$ one can construct matrix space over GF(3) and then change ring of each matrix to ZZ and subtract 1:1 from each element:

MS = MatrixSpace(GF(3),2,2)
for T in MS:
MatrixSpace(GF(3),2,2):
M = T.change_ring(ZZ).apply_map(lambda x: x-1)
print(M,'\n')


To get all matrices over ${$\{ -1, 0, +1}$+1\}$ one can construct matrix space over GF(3) and then change ring of each matrix to ZZ and subtract 1 from each element:

for T in MatrixSpace(GF(3),2,2):
M = T.change_ring(ZZ).apply_map(lambda x: x-1)
print(M,'\n')