Skip to content

General-purpose SDKs

QuantumComputing

Maintained by corbett

Quintuple This is an implementation of IBM's Quantum Experience in simulation; a 5-qubit quantum computer with a limited set of gates "the world’s first quantum computing platform delivered via the IBM Cloud".

PythonGPL-3.0
QuantumComputing illustration

Resource snapshot

Category

General-purpose SDKs

Stars

627

Last pushed

Dec 29, 2022Updated 3y ago

Open issues

3

Quickstart

Get running in a few lines.

Quickstart
from QuantumComputer import *
ghz_example_code="""h q[0];
		h q[1];
		x q[2];
		cx q[1], q[2];
		cx q[0], q[2];
		h q[0];
		h q[1];
		h q[2];"""
qc=QuantumComputer()
qc.execute(ghz_example_code)
Probability.pretty_print_probabilities(qc.qubits.get_quantum_register_containing("q0").get_state())

What it is

QuantumComputing is maintained by corbett and sits in the General-purpose SDKs lane of the open-source quantum map.

Quintuple This is an implementation of IBM's Quantum Experience in simulation; a 5-qubit quantum computer with a limited set of gates "the world’s first quantum computing platform delivered via the IBM Cloud".

Last verified by Qtangl generator on May 27, 2026

Who it's for

Developers who want a broad entry point for building circuits, experimenting with algorithms, and integrating quantum workflows into larger applications.

What you can build or learn

  • Prototype end-to-end circuit workflows without committing to a niche backend too early.
  • Learn how the project represents circuits, gates, jobs, and results.
  • Compare how a major ecosystem frames practical quantum development.

License

GPL-3.0

SPDX identifier detected from the repository metadata or license files.

Repository README

Preview from the project README.

Rendered as Markdown inside a scrollable preview. Long READMEs stay contained; expand or open on GitHub for the full document.

~601 words · about 3 min readOpen on GitHub

Quintuple

This is an implementation of IBM's Quantum Experience in simulation; a 5-qubit quantum computer with a limited set of gates "the world’s first quantum computing platform delivered via the IBM Cloud". Their implementation is available at http://www.research.ibm.com/quantum/.

This code allows you to execute code printed from the Quantum Composer in the following syntax:

descriptionusage
available qubit listq[0], q[1], q[2], q[3], q[4]
1-qubit gate listh,t,tdg,s,sdg,x,y,z,id
1-qubit gate actiongate q[i];
2-qubit CNOT gate listcx
2-qubit CNOT gate actioncx q[control], q[target];
measurement operation listmeasure, bloch
measurement operation actionoperation q[i];

It is much easier to dig into the internals of how the quantum computer computes by seeing and tracing the linear algebra representation of gates and states and their interactions as desired–for IBM's examples or for one's own code.

100% of the examples on the IBM tutorial are provided here, tested for and supported, and many addition tests and examples are provided. In fact, the implementation of the 5-qubit quantum computer simulator is only 675 lines, with approximately twice as many lines of test programs and examples provided.

Check out any of the test functions for example usage, and the Programs class contains many example programs in IBM's syntax all available in one place.

If you make use of this work, please cite my paper available on the physics arXiv as Quintuple: a Python 5-qubit quantum computer simulator to facilitate cloud quantum computing. For the making of story of this code, along with some pointers to resources on quantum computation, check out my blog post.

Example usage

from QuantumComputer import *
ghz_example_code="""h q[0];
		h q[1];
		x q[2];
		cx q[1], q[2];
		cx q[0], q[2];
		h q[0];
		h q[1];
		h q[2];"""
qc=QuantumComputer()
qc.execute(ghz_example_code)
Probability.pretty_print_probabilities(qc.qubits.get_quantum_register_containing("q0").get_state())

This will print

|psi>=0.70710678118654724|000>+-0.70710678118654724|111>
Pr(|000>)=0.500000; Pr(|111>)=0.500000; 

Or, using the swap Qubits example IBM tutorial Section IV, Page 2

swap_example_code="""x q[2];
		cx q[1], q[2];
		h q[1];
		h q[2];
		cx q[1], q[2];
		h q[1];
		h q[2];
		cx q[1], q[2];
		measure q[1];
		measure q[2];"""
qc.reset()
qc.execute(swap_example_code)
Probability.pretty_print_probabilities(qc.qubits.get_quantum_register_containing("q2").get_state())

will print

|psi>=|10>
Pr(|10>)=1.000000; 
<state>=-1.000000

We'll continue with this example in pure python below.

Note: using IBM's measurment code measure q[0]; will actually collapse the state, but for convenience the internal state before collapse is stored in qubit.get_noop(). Nature doesn't give this to us, but I can give it to you!

Pure python quantum computing machinery

Quantum computing operations can also be done in pure python, either with the QuantumComputer machinery or by directly manipulating gates.

QuantumComputer machinery

# Swap Qubits example IBM tutorial Section IV, Page 2
qc=QuantumComputer()
qc.apply_gate(Gate.X,"q2")
qc.apply_two_qubit_gate_CNOT("q1","q2")
qc.apply_gate(Gate.H,"q1")
qc.apply_gate(Gate.H,"q2")
qc.apply_two_qubit_gate_CNOT("q1","q2")
qc.apply_gate(Gate.H,"q1")
qc.apply_gate(Gate.H,"q2")
qc.apply_two_qubit_gate_CNOT("q1","q2")
qc.measure("q1")
qc.measure("q2")
Probability.pretty_print_probabilities(qc.qubits.get_quantum_register_containing("q1").get_state())

Will print

|psi>=|10>
Pr(|10>)=1.000000; 
<state>=-1.000000

Working with Individual States and gates

Note that states are combined by using the Kronecker product. Gates that operate on entangled states are composed from single qubit gates by the Kronecker product of the gate with the Identity. See the internals of qc.apply_gate or qc.apply_two_qubit_gate_CNOT for general examples, or feel free to use them instead.

# Swap Qubits example IBM tutorial Section IV, Page 2
q1=State.zero_state
q2=State.zero_state
q2=Gate.X*q2
new_state=Gate.CNOT2_01*np.kron(q1,q2)
H2_0=np.kron(Gate.H,Gate.eye)
H2_1=np.kron(Gate.eye,Gate.H)
new_state=H2_0*new_state
new_state=H2_1*new_state
new_state=Gate.CNOT2_01*new_state
new_state=H2_0*new_state
new_state=H2_1*new_state
new_state=Gate.CNOT2_01*new_state
Probability.pretty_print_probabilities(new_state)

Will print

|psi>=0.99999999999999967|10>
Pr(|10>)=1.000000;
<state>=-1.000000

This final manner of working with the library provides the most complete mathematical understanding of what's going on. Any individual state or gate can be printed, and it is clear how entanglement is represented as this is not done under the hood in this scenario.

Read on GitHub

Activity

Latest release

—

Watchers

75

Python support

—

Learn digest

Get monthly updates when library entries change.

Monthly digest: new library entries, updated flagships, and one editorial pick.

Related resources

Keep exploring nearby tools.

quantumlib

Cirq

Python framework for creating, editing, and running Noisy Intermediate-Scale Quantum (NISQ) circuits.

PythonApache-2.0Flagship

4,971 stars · Updated 3mo ago

XanaduAI

pennylane

PennyLane is an open-source quantum software platform for quantum computing, quantum machine learning, and quantum chemistry.

PythonApache-2.0FlagshipQtangl relevant

3,229 stars · Updated 3mo ago

QISKit

qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

PythonApache-2.0FlagshipQtangl relevant

7,412 stars · Updated 3mo ago

Qiskit

qiskit-terra

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

PythonApache-2.0

7,412 stars · Updated 3mo ago

Microsoft

QuantumKatas

Tutorials and programming exercises for learning Q# and quantum computing

Jupyter NotebookMITFlagshipArchive

4,862 stars · Updated 2y ago

QuantumBFS

Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.

JuliaApache-2.0Flagship

1,032 stars · Updated 3mo ago