qbraid.programs.OpenQasm2Program
- class OpenQasm2Program(program)[source]
Wrapper class for OpenQASM 2 strings.
- __init__(program)
Methods
__init__
(program)convert_to_contiguous
([expansion])Remove empty registers of circuit.
draw
([package, output])Draw circuit
reverse_qubit_order
()Reverses the qubit ordering of a openqasm program.
transpile
(conversion_type)Transpile a qbraid quantum program wrapper object to quantum program object of type specified by
conversion_type
.unitary
()Calculate unitary of circuit.
unitary_little_endian
()Converts unitary calculated using big-endian system to its equivalent form in a little-endian system.
unitary_rev_qubits
()Peforms Kronecker (tensor) product factor permutation of given matrix.
Attributes
depth
Calculates circuit depth of OpenQASM 2 string
num_clbits
Return the number of classical bits in the circuit.
num_qubits
Return the number of qubits in the circuit.
package
Return the original package of the wrapped circuit.
program
Return the wrapped quantum program object.
qubits
Use regex to extract all qreg definitions from the string