principal-ideal-domain
principal-ideal-domain

Reputation: 4296

Loop through all matrices

How do I loop through all nxn matrices of a finite field like Z/pZ in sage?

Do I have to build up n² iterated loops or is there a better way? I'd like to let n flexible.

Upvotes: 0

Views: 55

Answers (1)

kcrisman
kcrisman

Reputation: 4402

The MatrixSpace type is what you want.

M = MatrixSpace(GF(5),2,2)
M.list()

Don't try this at home with large numbers!

Upvotes: 1

Related Questions