CNOT control reversal in the Hadamard basis (source code)

= CNOT control reversal in the Hadamard basis
{c}
{title2=$(H\otimes H)\operatorname{CNOT}_{A\to B}(H\otimes H)=\operatorname{CNOT}_{B\to A}$}

Writing a <CNOT gate> as $P_0\otimes I+P_1\otimes X$ gives $I\otimes Q_++Z\otimes Q_-$, where $Q_\pm=(I\pm X)/2$. In the <Hadamard basis>, $Z$ flips the sign label and $X$ is diagonal. Thus the same gate matrix reverses its control and target roles under the two local basis changes.