qleap.Qubit

class qleap.Qubit(qState=None, index=0)

Qubit is a class that represents a single qubit in the QLeap framework.

__init__(qState=None, index=0)

Creates a Qubit instance. This constructor can be used in two ways: 1. If a QState instance is provided, this constructor creates a Qubit instance that represents the qubit at the given index in the provided QState instance. This is used when a Qubit instance is created by indexing a QState instance. 2. If no QState instance is provided, this constructor creates a new Qubit instance that allocates a new qubit using the private allocate method in the Circuit class. This is used when a Qubit instance is created independently of a QState instance.

Parameters:
  • qState (QState, optional) – The QState instance from which to initialize this qubit, by default None

  • index (int, optional) – The index of the qubit within the QState instance, by default 0

Methods

__init__([qState, index])

Creates a Qubit instance.

get_results()

Gets the results of measuring this QState instance.