qbraid_qir.qasm3.qasm3_to_qir
- qasm3_to_qir(program, name=None, external_gates=None, **kwargs)[source]
Converts an OpenQASM 3 program to a PyQIR module.
- Parameters:
program (openqasm3.ast.Program or str) – The OpenQASM 3 program to convert.
name (str, optional) – Identifier for created QIR module. Auto-generated if not provided.
external_gates (list[str], optional) – A list of custom gate names that are not natively recognized by pyqasm but should be treated as valid during program unrolling.
- Keyword Arguments:
initialize_runtime (bool) – Whether to perform quantum runtime environment initialization, defaults to True.
record_output (bool) – Whether to record output calls for registers, defaults to True.
- Return type:
Module
- Returns:
The QIR
pyqir.Module
representation of the input OpenQASM 3 program.- Raises:
TypeError – If the input is not a valid OpenQASM 3 program.
Qasm3ConversionError – If the conversion fails.