1
0
Fork
You've already forked QuantumSim
0
A basic quantum circuit simulator in C++
  • C++ 94%
  • Makefile 6%
Niko 858af2a33d Made project usable as a library
Can now be built and used as a library simply by doing `make`. The main
file was turned into an example that can be built separately
2026年06月30日 12:24:25 +03:00
include/qsim Made project usable as a library 2026年06月30日 12:24:25 +03:00
src Made project usable as a library 2026年06月30日 12:24:25 +03:00
.gitattributes Initial commit 2025年09月26日 13:54:07 +03:00
.gitignore Made project usable as a library 2026年06月30日 12:24:25 +03:00
LICENSE Initial commit 2025年09月26日 13:54:07 +03:00
makefile Made project usable as a library 2026年06月30日 12:24:25 +03:00
README.md Made project usable as a library 2026年06月30日 12:24:25 +03:00

QuantumSim

This is an educational project that implements a quantum circuit simulator in C++ for quantum registers. It implements the fundamental quantum gates and not much else but is easy to extend. There are no complexity optimizations for how the state vector is modified so the practical limit is around 20-30 qubits.

Usage

src/example.cpp currently holds an example circuit for Grover's algorithm applied to a very primitive 8 bit hash function. Typical usage is:

//create 2 qubit register collapsed to |00>
qureg r(2, 0);
//randomize bit 0
r.op_hadamard(0);
//controlled NOT on bit 1 with control bit 0
r.op_CX(1, 0);
//system will collapse to either |00> or |11> with equal probabilities
//this is known as the Bell state
r.measure();

Building

Simply run make to build the library at build/. You can build the example with make example.

git clone https://codeberg.org/Niko64/QuantumSim.git
cd QuantumSim
make

Windows

Use the MINGW=1 flag to build for Windows:

make MINGW=1