  The Clifford hierarchy is a foundational concept for universal quantum
computation (UQC). It was introduced to show that UQC can be realized via
quantum teleportation, given access to certain standard resources. While the
full structure of the hierarchy is still not understood, Cui et al.
(arXiv:1608.06596) recently described the structure of diagonal unitaries in
the hierarchy. They considered diagonal gates whose action on a computational
basis qudit state is described by a $2^k$-th root of unity raised to a
polynomial function of the state, and they established the level of such
unitaries in the hierarchy. For qubit systems, we consider $k$-th level
diagonal gates that can be described just by quadratic forms of the state over
the ring $\mathbb{Z}_{2^k}$ of integers mod $2^k$. These involve symmetric
matrices over $\mathbb{Z}_{2^k}$ that can be used to efficiently describe all
$2$-local and certain higher locality diagonal gates in the hierarchy. We also
provide explicit algebraic descriptions of their action on Pauli matrices,
which establishes a natural recursion to diagonal gates from lower levels. This
involves symplectic matrices over $\mathbb{Z}_{2^k}$ and hence our perspective
unifies these gates with the binary symplectic framework for Clifford gates. We
augment our description with simple examples for certain standard gates. In
addition to demonstrating structure, these formulas might prove useful in
applications such as (i) classical simulation of quantum circuits, especially
via the stabilizer rank approach, (ii) synthesis of logical non-Clifford
unitaries, specifically alternatives to magic state distillation, and (iii)
decomposition of arbitrary unitaries beyond the Clifford+$T$ set of gates,
perhaps leading to shorter depth circuits. Our results suggest that some
non-diagonal gates might be understood by generalizing other binary symplectic
matrices to integer rings.
