5. Backends

Loom supports conversion to different formats to run quantum experiments, allowing users to easily compare and choose the most suitable platform for their needs. These tools are provided in the executor package.

The following formats are currently supported:

5.1. OpenQASM 3.0

OpenQASM3 is an imperative programming language for describing quantum circuits. eka_circuit_to_qasm_converter() allows you to convert Loom experiments into OpenQASM3 format, enabling execution on any platform that supports OpenQASM3. The following example shows how to convert a Loom’s InterpretationStep into a OpenQASM3 string:

# interpreted_eka: InterpretationStep
qasm_string = convert_circuit_to_qasm(
    interpreted_eka.final_circuit,
    interpreted_eka.syndromes,
    interpreted_eka.detectors,
    interpreted_eka.logical_observables,
)

5.2. Stim

Stim is an open-source tool for high-performance simulation of quantum stabilizer circuits. Loom experiments can be converted to Stim format using EkaCircuitToStimConverter. This allows for efficient simulation and analysis of quantum circuits. The following example shows how to convert an InterpretationStep to Stim (check the list of Stim’s supported operations here):

converter = EkaCircuitToStimConverter()

# interpreted_eka: InterpretationStep
stim_circuit = converter.convert(interpreted_eka)