Implementing a single-qubit gate in a multi-qubit register is relatively easy. For example, this gate:
This is equivalent to $I \otimes H \otimes I$. If the $H$ gate was on the first bit, it would be $H \otimes I^{\otimes 2}$ etc.
What about this gate?
There doesn't seem to be any Kronecker product of the CNOT matrix that will produce the correct matrix for this. Is there a simple way to calculate the matrix for the general case of a multi-qubit gate on a larger register?
I imagine it could be done by rearranging the qubits to put the gate on the first qubits of a register, and then reversing the rearrangement after the gate. This is a lot harder than the single-gate case though.

