I'd like to ask the following question:
Let $A$ be a finite set of complex numbers.
I would like to obtain in GAP the set $B$ of all $n\times n$ - matrices where in each row and column there is exactly one non-zero entry and this entry is from the set $A$.
Thus this set $B$ of $n\times n$-matrices should have cardinality $m^n \cdot n!$ where $m$ is the cardinality of $A$.
Is there an easy way to obtain this set $B$ in GAP?
Thank you very much.
(Example: When $A$ is equal to the set $\{1\}$, then we get for $B$ the set of $n\times n$ permutation matrices.)
The easiest is probably to take diagonal matrices and to permute them in all possible ways:
Now we have the diagonal matrices, we permute the rows in each (matrices can be treated as lists of rows) with all permutations in $S_n$, and concatenate the lists:
For large values of $n$ or $|A|$ it is probably preferrable to not create $B$ as one list, but to have two
forloops overdiagand oversymto iterate over all elements in the huge list.