I want to construct a following 16x16 matrix (system of four qubits)
$U=\text{diag}(1,1,...,1,e^{-iV},e^{-iV})$
where $V$ is a constant.
So this matrix describe these rotations:
$|1110 \rangle \to e^{-iV}|1110\rangle$
$|1111 \rangle \to e^{-iV}|1111\rangle$
No rotation is applied to other computational basis states.
Following the book Principles of quantum computation and information I can build this $C^4$-$U$ gate: (with ancillary qubits)
In my situation, I have to build a $C^3$-$U$ gate, but the procedure is the same.
My problem is when I have to apply this $C$-$U$ that appears in the middle of the $C^3$-$U$ gate.
I don't know how to construct the $C$-$U$ gate so that it performs ONLY the rotation $e^{-iV}$ on q[0]
, leaving the rest of thee qubits (q[1]
, q[2]
, q[3]
) as they were.
I understand that if I know how to construct the $C$-$U$, I will have the $C^3$-$U$ gate which represents the matrix I want to implement.