snippetMinor
How do you apply a multi qubit gate to specific qubits in a multi qubit circuit?
Viewed 0 times
multiyouapplyhowqubitsgatespecificqubitcircuit
Problem
Let's say that you have a 6 qubit system and you want to apply a Hadamard gate to qubits 2 and 4.
How would you construct a matrix that did that, while leaving the state of the other qubits alone?
How would you construct a matrix that did that, while leaving the state of the other qubits alone?
Solution
Imagine that the qubits were $0$ and $1$ (or $1$ and $2$, depending on your numbering scheme). You want to apply the Hadamard gate on the first two coordinates, and nothing – the identity – on the rest. This leads to a block diagonal matrix whose second block is the $4\times 4$ identity.
Now make the necessary arrangements for the qubits you're interesting it.
Now make the necessary arrangements for the qubits you're interesting it.
Context
StackExchange Computer Science Q#48397, answer score: 3
Revisions (0)
No revisions yet.