pyqasm.Qasm3Module
- class Qasm3Module(name, program)[source]
A module representing an openqasm3 quantum program.
- Parameters:
name (str) – Name of the module.
program (Program) – The original openqasm3 program.
statements (list[Statement]) – list of openqasm3 Statements.
Methods
__init__(name, program)accept(visitor)Accept a visitor for the module
compare(other_module)Compare two QasmModule objects across multiple attributes.
copy()Return a deep copy of the module
depth([decompose_native_gates])Calculate the depth of the unrolled openqasm program.
has_barriers()Check if the module has any barrier operations.
has_measurements()Check if the module has any measurement operations.
populate_idle_qubits([in_place])Populate the idle qubits in the module with identity gates
rebase(target_basis_set[, in_place])Rebase the AST to use a specified target basis set.
remove_barriers([in_place])Remove the barrier operations
remove_idle_qubits([in_place])Remove idle qubits from the module.
remove_includes([in_place])Remove the include statements from the module
remove_measurements([in_place])Remove the measurement operations
reverse_qubit_order([in_place])Reverse the order of qubits in the module.
unroll(**kwargs)Unroll the module into basic qasm operations.
validate()Validate the module
Attributes
historyReturns the user operations performed on the module.
nameReturns the name of the module.
num_clbitsReturns the number of classical bits in the circuit.
num_qubitsReturns the number of qubits in the circuit.
original_programReturns the program AST for the original qasm supplied by the user
unrolled_astReturns the unrolled AST for the module