From the course: Quantum Computing Fundamentals
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Toffoli gate with Qiskit
From the course: Quantum Computing Fundamentals
Toffoli gate with Qiskit
- [Instructor] To demonstrate the toffoli gate with qiskit, lets add toffoli gate to the simple three-qubit circuit. To do that I'll type circuit.toffoli(0) for the first control qubit. (1) for the second control qubit and (2) for the target qubit. I'll click the run all button to run all the notebook cells and we can see that all three simulated bloch spheres are unchanged, and still in the initial 0 state. That makes sense because the control qubits are 0 so the toffoli gate wouldn't do anything. Let's try inserting an X gate, in front of the first control qubit. I'll press Shift Enter twice to run all those cells again and now the first qubit is flipped to 1 but the target qubit is still 0. Remember that the toffoli gate doesn't flip the target unless both control qubits are 1. So, let's insert another X gate, in front of the second control qubit. Run those cells again and now since both controls are 1 the target…
Contents
-
-
-
-
-
-
-
(Locked)
Controlled-NOT (CNOT) gate2m 46s
-
(Locked)
Controlled-NOT (CNOT) gate with Qiskit3m 19s
-
(Locked)
Toffoli gate2m 27s
-
(Locked)
Toffoli gate with Qiskit2m 39s
-
(Locked)
Swap and Fredkin gates2m 21s
-
(Locked)
Swap and Fredkin gates with Qiskit2m 22s
-
(Locked)
Challenge: Classical two-bit adder2m 17s
-
(Locked)
Solution: Classical two-bit adder2m 24s
-
(Locked)
-
-
-
-