Qubit, An Intuition #5 — Quantum Circuit and Reversible Transformation

TL;DR; 
- Reversible operations in quantum circuits with examples and their implementation in IBM quantum.
- Discussion includes Reversible Transformations in Quantum Circuit, Quantum Circuit written as Unitary Matrix, and The Execution of the Quantum Circuit on IBM Quantum.

For an introductory helicopter view of the overall six articles in the series, please visit this link “Embarking on a Journey to Quantum Computing — Without Physics Degree.”

Please refer to the previous articles:
Qubit, An Intuition #1 — First Baby Steps in Exploring the Quantum World” for a discussion on a single qubit as a computing unit for quantum computation.
- "Qubit, An Intuition #2 - Inner Product, Outer Product, and Tensor Product" for a discussion on two-qubits operations.
- "Qubit, An Intuition #3 - Quantum Measurement, Full and Partial Qubits" for examples on full and partial quantum measurements.
- "Qubit, An Intuition #4 - Unitary Matrices for Quantum Computation."

Reversible Transformations in Quantum Circuit

Reversible operations in a quantum circuit. The output quantum state |Ψ’> is returned to |Ψ> after performing U conjugate transpose. The illustration is created by Quirk (Strilanc, 2019).
Unitary matrices for H, X, Z, and CNOT gates.
Matrix for the R90 gate.
Matrix for the R90-inverse gate.
Reversible operations in a quantum circuit, the output quantum state |Ψ’> is returned to |Ψ> after performing U conjugate transpose (simulated with variable input, the rotation along X-axis).

Quantum Circuit — Written as Unitary Matrix

Executing the Quantum Circuit on IBM Quantum

The Reversible operations in a quantum circuit. The output quantum state |Ψ’> is returned to |Ψ> after performing U conjugate transpose. The illustration is created using IBM Quantum (IBM, 2021a).
The final result 010 after executing our quantum circuit with 8192 shots on the real quantum computer, IBM’s 5 qubits Quantum Computer “ibmq_athens.”
Matrix for the R90 gate.
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[3];
id q[0];
x q[1];
barrier q[0];
barrier q[1];
h q[0];
h q[1];
u(pi/2,-pi/2,pi/2) q[0];
cx q[1],q[2];
x q[0];
id q[1];
z q[2];
barrier q[0];
barrier q[1];
barrier q[2];
x q[0];
id q[1];
z q[2];
u(-pi/2,-pi/2,pi/2) q[0];
cx q[1],q[2];
h q[0];
h q[1];
id q[2];
barrier q[0];
barrier q[1];
barrier q[2];
measure q[0] -> c[0];
measure q[1] -> c[1];
measure q[2] -> c[2];
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from numpy import pi
qreg_q = QuantumRegister(3, 'q')
creg_c = ClassicalRegister(3, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)
circuit.id(qreg_q[0])
circuit.x(qreg_q[1])
circuit.barrier(qreg_q[0])
circuit.barrier(qreg_q[1])
circuit.h(qreg_q[0])
circuit.h(qreg_q[1])
circuit.u(pi/2, -pi/2, pi/2, qreg_q[0])
circuit.cx(qreg_q[1], qreg_q[2])
circuit.x(qreg_q[0])
circuit.id(qreg_q[1])
circuit.z(qreg_q[2])
circuit.barrier(qreg_q[0])
circuit.barrier(qreg_q[1])
circuit.barrier(qreg_q[2])
circuit.x(qreg_q[0])
circuit.id(qreg_q[1])
circuit.z(qreg_q[2])
circuit.u(-pi/2, -pi/2, pi/2, qreg_q[0])
circuit.cx(qreg_q[1], qreg_q[2])
circuit.h(qreg_q[0])
circuit.h(qreg_q[1])
circuit.id(qreg_q[2])
circuit.barrier(qreg_q[0])
circuit.barrier(qreg_q[1])
circuit.barrier(qreg_q[2])
circuit.measure(qreg_q[0], creg_c[0])
circuit.measure(qreg_q[1], creg_c[1])
circuit.measure(qreg_q[2], creg_c[2])

Moving Forward

References

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store