The Ultimate Comparison Between Competing Popular Quantum Computing Frameworks With Source Code
IBM Qiskit vs. Microsoft Q# vs. Google Cirq vs. Amazon Braket vs. Rigetti Forest
The State of Affairs
As it stands, compared to classical computing, quantum computing is now in the roughly early 1970s era with a lot of work being done at the hardware level and now, some software abstractions have been introduced. In this article, we walk you through the major six competing frameworks by showing you (with code, output, and explanation) how to implement a Bell State (Hello World of Quantum Computation) in all of these frameworks (We exclude D-Wave because it is not a general-purpose quantum computing framework, it is designed only for simulated annealing and has a limited mode of operation, although it solves similar problems). So strap yourself in, it’s gonna be a fun ride! BTW, if you don’t know what a Bell state is feel free to read this quantum computing article in the link below.
Quantum Computing: Bell State and Entanglement with Qiskit
Entangled Qubits with Hadamard Gate and CNOT Gate
Bell State Algorithm
It has a QASM (Open Quantum Assembly Language) formulation which is given below:
<figure>The Bell State QASM Code
The Bell state uses two quantum bits and two classical bits, the latter to store the output of the computation. We apply a CNOT and a Hadamard gate to both qubits and measure the output, which becomes a maximally entangled state. This is deep for beginners, but the example is trivial for most quantum computing experts around the world. The explanation is provided with the code, so I think you should go through the QASM code in detail. This will give you an intuitive feel of what we’re trying to do with the other computing frameworks. Same algorithms on various Python-derived dialects (Q# is the exception. It borrows from C# and F#).
The Current Leader — IBM Qiskit
Source Code (using Carbon):
<figure>The Bell State in Qiskit
After importing the necessary libraries, lines 3 and 4 set up our quantum circuit with two qubits and two classical bits. The two quantum gates are used for the quantum operation, the classical bits to read the output. Applying a Hadamard (line 7)and a CNOT (line 9)gate to the two qubits establishes the quantum effect we want. Finally, we measure the outputs in lines 10 and 11 using the classical bits. This entire operation is repeated hundreds of times and the average result is a maximally entangled pair of qubits 50% in the |0> state and 50% in the |1> state, if there is no noise and the quantum device works without measurement errors. More on these details in the linked article above.
<figure>The Bell State rendered in IBM Qiskit
Microsoft Q# — The Long Term Bet
Keep reading with a 7-day free trial
Subscribe to The Blog of Thomas Cherickal to keep reading this post and get 7 days of free access to the full post archives.