It is well known that circuit
can be replaced with this circuit
The situation is even easier in case of controlled $\mathrm{Z}$ where gate controlled by $q_0$ and acting on $q_1$ have same matrix as one controlled by $q_1$ and acting on $q_0$. This means that replacing gate controled by qubit "below" with one controlled by qubit "above" does not need any additional gate.
I was thinking about general case, i.e. how to replace general controlled gate $\mathrm{U}$ with controlling qubit "below" by the gate controlled by qubit "above". The very basic idea is to apply swap gate, then controlled $\mathrm{U}$ with controlling qubit "above" and then again swap gate. This is right approach because $\mathrm{U}$ gate controlled by qubit "above" is described by matrix
$$ \mathrm{CU_{above} =} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & u_{11} & u_{12} \\ 0 & 0 & u_{21} & u_{22} \end{pmatrix} $$
and the gate controlled by qubit "below" has this matrix
$$ \mathrm{CU_{below} =} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & u_{11} & 0 & u_{12} \\ 0 & 0 & 1 & 0 \\ 0 & u_{21} & 0 & u_{22} \end{pmatrix}. $$
It can be easily checked that $\mathrm{CU_{bellow}} = \mathrm{SWAP} \cdot \mathrm{CU_{above}} \cdot \mathrm{SWAP}$.
Swap gate can be implemented with three $\mathrm{CNOT}$, two controlled by qubit "above", one controlled by qubit "below". However, the latter can be converted to $\mathrm{CNOT}$ controlled by qubit "above" with help of Hadamards. Ultimatelly, all $\mathrm{CNOT}$s in swap gate are controlled by qubit "above".
So, this is a desired general approach how to convert a gate controlled by qubit "below" to one controlled by qubit "above". However, application of two swap gates increases depth of the circuit.
My question are these:
- Is there a simpler general approach how to convert a gate controlled by qubit "below" to one controlled by qubit "above"?
- Are there other specific construction for other controlled gates similar to approach for controlled $\mathrm{X}$ and $\mathrm{Z}$? For example for controlled $\mathrm{Y}$, $\mathrm{H}$, $\mathrm{Ry}$ etc.