Skip to content

QuTech-Delft/qx-simulator

Repository files navigation

QX simulator

CI cpp-linter PyPI OS License

QX simulator is a simulator of cQASM programs, developed by QuTech. At the moment, QX simulator only supports cQASM v3.0 programs (see cQASM-spec for the language specification).

It performs simulations of input programs received via file or string. It produces one of the following results:

  • A simulation result: a quantum state and, optionally, a list of measurements.
  • An error. In case the input program was malformed or the simulation failed.

It can be used:

  • As a standalone executable (built from C++), from the command line.
  • As a module (called qxelarator), from Python projects (as a Python package).

Getting started

Given a cQASM program example.cq.

version 3.0

qubit[2] q
bit[2] b

H q[0]
CNOT q[0], q[1]
b = measure q

We can simulate this circuit using QX simulator, either from the command line, or with a Python script.

Command line

build/Release# ./qx-simulator -c 1000 example.cq

Python

import qxelarator

if __name__ == "__main__":
    result = qxelarator.execute_file('example.cq', iterations=1000)
    print(result)

Documentation

The QX simulator documentation is hosted through GitHub Pages.

License

QX simulator is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Authors

Quantum Inspire: [email protected]