Skip to content

softwareQinc/qasm3tools

Repository files navigation

qasm3tools

GitHub actions


Setup

cmake -B build
cmake --build build --parallel 8

This creates the parser executable.

./parser /path/to/circuit.qasm

Interpreter

To build the interpreter, you must have qpp installed. Execute

cmake -B build -DWITH_INTERPRETER=ON
cmake --build build --parallel 8

This creates the interpreter executable. Usage:

./interpreter /path/to/circuit.qasm

If the OpenQASM 3.0 file contains n input variables, then the interpreter requires exactly n additional commandline arguments to specify their values. For example, if the file contains

input float[32] fl;
input bool bl;

Then it could be executed with

./interpreter example.qasm "pi/2" "true"

Unit testing

cmake --build build --target unit_tests --parallel 8
ctest --test-dir build

Notes

  1. The interpreter is implemented to exclude the endpoints of ranges. As of August 10, 2022, in the OpenQASM 3.0 live specification, range endpoints are included.

  2. The OpenQASM 3.0 standard library defines the u3 and u2 gates differently than the Qiskit specifications.

Gate OpenQASM 3.0 Qiskit Phase inconsistency
u3 equation equation equation
u2 equation equation equation