qbraid.passes.qasm

Module for transforming and extracting data from OpenQASM programs.

Functions

rebase(qasm, gateset[, require_predicates, ...])

Rebases an OpenQASM 3 program according to a given basis gate set.

insert_gate_def(qasm3_str, gate_name[, ...])

Add gate definitions to an Open0QASM 3 string.

replace_gate_names(qasm, gate_mappings[, ...])

Replace occurrences of specified gate names in a QASM program string.

add_stdgates_include(qasm_str)

Add 'include "stdgates.inc";' to the QASM string if it is missing.

remove_stdgates_include(qasm)

Remove 'include "stdgates.inc";' from the QASM string.

convert_qasm_pi_to_decimal(qasm)

Convert all instances of 'pi' in the QASM string to their decimal value.

normalize_qasm_gate_params(qasm)

Normalize the parameters of the gates in the QASM string using function composition.