Create the parity transformation matrices

I want to generate all the possible parity transformation matrices, which can be obtained via an identity
matrix using the method described here:

It’s easy to see that flipping n of coordinates (regardless of the
number dimensions) produces a matrix with −1 appearing n-times on the
diagonal, so the transformation has odd parity if and only if n is
odd.

For example, in the 3-dimensional case, the following should be the result:

{{{ -1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }},
{{ 1, 0, 0 }, { 0, -1, 0 }, { 0, 0, 1 }},
{{ 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, -1 }},
{{ -1, 0, 0 }, { 0, -1, 0 }, { 0, 0, -1 }}}

Any tips for generating the corresponding matrices gracefully for a given dimension, say, 7?

Regards,
Zhao

I figured out the following solution:

In[62]:= d=7;
lst=ConstantArray[1,d];

Subsets[Range[d],{#}]&/@(Range[d] // Select[OddQ])//ArrayFlatten[#,1]&;
Table[Rule[#,-1]&/@ i, {i, %}];
ReplacePart[lst, #]&/@%

Out[66]= {{-1, 1, 1, 1, 1, 1, 1}, {1, -1, 1, 1, 1, 1, 1}, {1, 1, -1, 
  1, 1, 1, 1}, {1, 1, 1, -1, 1, 1, 1}, {1, 1, 1, 1, -1, 1, 1}, {1, 1, 
  1, 1, 1, -1, 1}, {1, 1, 1, 1, 1, 1, -1}, {-1, -1, -1, 1, 1, 1, 
  1}, {-1, -1, 1, -1, 1, 1, 1}, {-1, -1, 1, 1, -1, 1, 1}, {-1, -1, 1, 
  1, 1, -1, 1}, {-1, -1, 1, 1, 1, 1, -1}, {-1, 1, -1, -1, 1, 1, 
  1}, {-1, 1, -1, 1, -1, 1, 1}, {-1, 1, -1, 1, 1, -1, 1}, {-1, 1, -1, 
  1, 1, 1, -1}, {-1, 1, 1, -1, -1, 1, 1}, {-1, 1, 1, -1, 1, -1, 
  1}, {-1, 1, 1, -1, 1, 1, -1}, {-1, 1, 1, 1, -1, -1, 1}, {-1, 1, 1, 
  1, -1, 1, -1}, {-1, 1, 1, 1, 1, -1, -1}, {1, -1, -1, -1, 1, 1, 
  1}, {1, -1, -1, 1, -1, 1, 1}, {1, -1, -1, 1, 1, -1, 1}, {1, -1, -1, 
  1, 1, 1, -1}, {1, -1, 1, -1, -1, 1, 1}, {1, -1, 1, -1, 1, -1, 
  1}, {1, -1, 1, -1, 1, 1, -1}, {1, -1, 1, 1, -1, -1, 1}, {1, -1, 1, 
  1, -1, 1, -1}, {1, -1, 1, 1, 1, -1, -1}, {1, 1, -1, -1, -1, 1, 
  1}, {1, 1, -1, -1, 1, -1, 1}, {1, 1, -1, -1, 1, 1, -1}, {1, 1, -1, 
  1, -1, -1, 1}, {1, 1, -1, 1, -1, 1, -1}, {1, 1, -1, 1, 
  1, -1, -1}, {1, 1, 1, -1, -1, -1, 1}, {1, 1, 1, -1, -1, 1, -1}, {1, 
  1, 1, -1, 1, -1, -1}, {1, 1, 1, 1, -1, -1, -1}, {-1, -1, -1, -1, -1,
   1, 1}, {-1, -1, -1, -1, 1, -1, 1}, {-1, -1, -1, -1, 1, 
  1, -1}, {-1, -1, -1, 1, -1, -1, 1}, {-1, -1, -1, 1, -1, 
  1, -1}, {-1, -1, -1, 1, 1, -1, -1}, {-1, -1, 1, -1, -1, -1, 
  1}, {-1, -1, 1, -1, -1, 1, -1}, {-1, -1, 1, -1, 1, -1, -1}, {-1, -1,
   1, 1, -1, -1, -1}, {-1, 1, -1, -1, -1, -1, 1}, {-1, 1, -1, -1, -1, 
  1, -1}, {-1, 1, -1, -1, 1, -1, -1}, {-1, 1, -1, 1, -1, -1, -1}, {-1,
   1, 1, -1, -1, -1, -1}, {1, -1, -1, -1, -1, -1, 
  1}, {1, -1, -1, -1, -1, 1, -1}, {1, -1, -1, -1, 
  1, -1, -1}, {1, -1, -1, 1, -1, -1, -1}, {1, -1, 
  1, -1, -1, -1, -1}, {1, 
  1, -1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1, -1, -1}}

Any better or elegant solution will be appreciated.

Regards,
Zhao

Maybe something like this:

OddParityDiagonals[n_] := 
 Catenate[Table[Permutations[PadRight[ConstantArray[-1, k], n, 1]], {k, 1, n, 2}]]

You can use DiagonalMatrix to generate an actual matrix:

DiagonalMatrix /@ OddParityDiagonals[3]

{{{-1,0,0},{0,1,0},{0,0,1}},{{1,0,0},{0,-1,0},{0,0,1}},{{1,0,0},{0,1,0},{0,0,-1}},{{-1,0,0},{0,-1,0},{0,0,-1}}}