qleap.Circuit

class qleap.Circuit

Circuit is the main class for running quantum circuits.

The Circuit class collects operations, manages qubit allocation, and handles the execution of quantum programs, either through simulation or by generating a trace of the program’s execution. The Circuit class is designed to be used in conjunction with the Operation, QState, and Qubit classes, which are used to construct quantum circuits. When an Operation is created, it is added to the list of operations in the Circuit class. When a QState or Qubit is created, qubits are allocated for it using the private allocate method in the Circuit class.

__init__()

Methods

__init__()

clear()

Clears the state of the Circuit class, including the list of operations, the quantum interface, and the results.

draw()

Draws the quantum circuit that has been constructed by the Circuit class.

get_results()

Gets the results of the most recent simulation.

run([args])

Runs the quantum program that has been constructed by the Circuit class.

toQASM()

Converts the quantum program that has been constructed by the Circuit class to openQASM 3.0 code.