qbraid.passes.qasm3

Module for appyling transformations to OpenQASM 3 programs.

Functions

rebase(qasm, basis_gates[, require_predicates])

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

decompose_qasm3(qasm)

Decompose an OpenQASM 3 program.

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

Add gate definitions to an Open0QASM 3 string.

replace_gate_name(qasm, old_gate_name, ...)

Replace occurrences of a specified gate name in a QASM program string with a new gate name, while optionally enforcing the replacement even if the new gate name isn't in the predefined gate map.

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_str)

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.

remove_unused_gates(qasm)

Remove unused gate definitions from a QASM string.