Skip to content

Executing Alternative Formats

In addition to executing a Classiq quantum program, you may use the Classiq platform to execute other quantum programming languages.

The Classiq engine currently supports the OpenQASM format.

You may execute an OpenQASM program by uploading the code file to the Classiq platform.

Go to the "Circuit" tab and follow the instructions to upload a .qasm file:

Upload circuit

Continue executing the circuit as usual. See Execution.

You may integrate your OpenQASM code inside the Classiq quantum model. See User-defined Functions.

Following is a full example of executing an OpenQASM program:

from typing import Tuple
from classiq import QReg, Model, synthesize, execute, qfunc

BELL_STATE_QASM = """
    OPENQASM 3.0;
    include "stdgates.inc";

    qubit q0;
    qubit q1;

    h q0;
    cx q0, q1;
"""


@qfunc
def my_qasm(q0: QReg[1], q1: QReg[1]) -> Tuple[QReg[1], QReg[1]]:
    return BELL_STATE_QASM


model = Model()
model.apply(my_qasm)
model.sample()

circuit = synthesize(model.get_model())
results = execute(circuit)