Qubit#

class Qubit(identifier)[source]#

This class describes qubits. Qubits are created by supplying the identifier string.

A bare Qubit can be obtained from a QuantumVariable by indexing it (qv[0] returns a Qubit, qv[0:2] returns a list of Qubits) or by accessing the entries of its qubits list.

Attributes:
identifierstr

A string to identify the Qubit.

Examples

We create a Qubit and add it to a QuantumCircuit:

>>> from qrisp import QuantumCircuit, Qubit
>>> qb = Qubit("alphonse")
>>> qc = QuantumCircuit()
>>> qc.add_qubit(qb)
>>> qc.x(qb)
>>> print(qc)
          ┌───┐
alphonse: ┤ X ├
          └───┘