7

It's not possible to implement a Toffoli using only Fredkin gates, because Fredkin gates preserve the number of 1s in the state while Toffolis do not.


4

Assuming you've got Toffoli and single-qubit rotations, you can implement the following: This basically works because if either of the controls is not $|1\rangle$, the Toffoli does nothing and the two single-qubit unitaries cancel each other. Whereas, if both controls are $|1\rangle$, then the net gate on the target qubit is $$ (\cos\frac{\pi}{8}I+i\sin\...


4

Nielsen and Chuang book may be confusing; I will try to explain. Any classical algorithm can be presented as a circuit consisting of $NOT$ and $AND$ gates; this means that if we can make quantum gates computing $NOT$ and $AND$, and make fanout, we can run any classical algorithm on quantum computer. $NOT$ is reversible and we have quantum $NOT$ gate; many ...


3

Consider some simpler cases, $(j,j+1)$ for general $j$. Then you can do you want with plugging in $j=i$, $j=i+1$, $j=i+3$ and $j=i+4$ and concatenating the circuits appropriately and then simplifying. So how to do $(j,j+1)$? That is conjugate to $(0,1)$, so just consider that for now. $(0,1)$ would be NOT but controlled on making sure all the higher places ...


3

On hardware, the number of moments is the relevant metric. That is why cirq focuses on that. To compute circuit depth in cirq, create a new circuit using just the operations. It defaults to packing them as tightly as possible, so the number of moments will be the depth. depth = len(cirq.Circuit(my_circuit.all_operations()))


2

Summarization based on discussion with user met927: Transpiled circuit form depends on used backend - it is different for simulator and real quantum processor: On simulator, the $\mathrm{CH}$ gate is transpiled to the circuit shown above On real quantum processor, the gate is implemented with two $\mathrm{U2}$ gates and $\mathrm{CNOT}$ (i.e. like in the ...


2

A brute force solution :). You can also obtain CCH via qiskit's basic gates with help of get_controlled_circuit method. from qiskit import * from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit q_reg = QuantumRegister(3, 'q') qc_h = QuantumCircuit(q_reg) qc_ch = QuantumCircuit(q_reg) qc_cch = QuantumCircuit(q_reg) qc_h.h(q_reg[0]) ...


1

Based on paper Five Two-Bit Quantum Gates are Sucient to Implement the Quantum Fredkin Gate provided by Norbert Schuch, I realized that there is a more efficient implementation in terms of number of gates. Here is a result: Matrix of CNOT acting on $|q_1\rangle$ controlled by $|q_2\rangle$ is \begin{equation} CNOT_{2}= \begin{pmatrix} 1 & 0 & 0 &...


Only top voted, non community-wiki answers of a minimum length are eligible