pub fn HGate(radix: usize) -> UnitaryExpressionExpand description
The one-qudit Hadamard gate. This is a Clifford/Weyl-Heisenberg gate.
The qubit (radix = 2) Hadamard gate is given by the following matrix:
$$ \begin{pmatrix} \frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} \\ \frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} \\ \end{pmatrix} $$
However, generally it is given by the following formula:
$$ H = \frac{1}{\sqrt{d}} \sum_{ij} \omega^{ij} \ket{i}\bra{j} $$
where
$$ \omega = \exp\Big(\frac{2\pi i}{d}\Big) $$
and $d$ is the number of levels (2 levels is a qubit, 3 levels is a qutrit, etc.)
References: