Go package for Quantum Computing, implemented as a complement of a project led in the context of the course IQ01 at the University of Technology of Compiègne (UTC), supervised by Mr. Walter Schön and Mr. Ahmed Lounis.
The package is based on the Qiskit and Cirq libraries. It can be used to create, display and simulate quantum circuits.
- Create, display and simulate quantum circuits. The package includes the composition of quantum gates, and the measurement of qubits.
- Export the circuit to a file in the QASM format. 2 formats are available.
- Install the package with the following command:
go get github.com/milairhu/quantut
- Import the package in your code:
import "github.com/milairhu/quantut/pkg/quantut"
// Create a quantum circuit with 2 qubits and 2 classical bits
qc := quantut.NewQuantumCircuit(2)
qc.InitClassicalRegister(2)
qc.H(0)
qc.CNOT(0, 1)
qc.Measure(0, 0)
qc.Measure(1, 1)
// Display the circuit
qc.Draw()
// Simulate the circuit
sim := quantut.NewSimulator(qc, 1000)
res := sim.Run()
fmt.Println(res)
// Export the circuit to a file
qc.ToQASM("circuit.qasm", "OPENQASM 2.0")
The package is functionnal. However, it can be improved in the following ways:
- Add more quantum gates. So far, only the most common gates are implemented. Among the gates that could be added are the rotation gates (Rx, Ry, Rz).
- Add pre-built quantum circuits. For example, the Grover algorithm, the Shor algorithm, Deutsch-Jozsa algorithm, etc.
- Improve the display of the circuit. The current display resembles the one of Cirq, but it can be improved. Especially, some gates could be displayed on a single vertical line to gain space.
- Improve the performance of the simulator. The simulator is currently quite slow. It could be improved by using matrix product instead of the current "hand-made" method.
- Read QASM file for circuits loading