qbraid.transpiler.conversions.openqasm3.openqasm3_to_pyquil

openqasm3_to_pyquil(program)[source]

Returns a pyQuil Program equivalent to the input OpenQASM 3 program.

Supports the standard gate set (including gate modifiers and controlled gates, which pyqasm decomposes during unrolling), measurement, barrier (-> pyQuil FENCE), reset (-> RESET), delay (-> DELAY), and if (c == 0|1) classical feedforward (-> conditional JUMP-WHEN). Declared-but-idle qubits below the highest qubit in use are padded with identity, so the program spans a contiguous block; idle qubits above it are omitted rather than padded.

Qubits may be addressed either through a declared register (qubit[2] q; h q[0];) or as physical qubits (h $0;). Physical qubit indices are passed through verbatim and are not padded, since such a program is already mapped to specific hardware qubits.

Parameters:

program (str or openqasm3.ast.Program) – OpenQASM 3 program to convert.

Returns:

pyQuil Program equivalent to the input program.

Return type:

pyquil.Program

Raises:

ProgramConversionError – If the program is malformed or contains a gate/statement that is not supported by the conversion.