Skip to content

Utils

Utils.

The module contains the following tools:

  • LoopMode - Quantum loop mode.
  • count_qubits() - Counting the number of conceptual qubits of your computer.

LoopMode

Bases: Enum

Quantum loop mode.

Source code in src/ql/utils.py
class LoopMode(Enum):
    """Quantum loop mode."""

    PROCESS_POOL = 1
    THREAD_POOL = 2

count_qubits()

Counting the number of conceptual qubits of your computer.

Conceptual qubit is quantum of algorithm (task) that is executed in iterations of a cycle in a separate processor thread.

Quantum of algorithm is a function for data processing.

Examples:

>>> from ql import count_qubits
>>> count_qubits()
16

Returns:

Type Description
int

The number of conceptual qubits.

Source code in src/ql/utils.py
def count_qubits() -> int:
    """Counting the number of conceptual qubits of your computer.

    Conceptual qubit is quantum of algorithm (task) that is executed in
    iterations of a cycle in a separate processor thread.

    Quantum of algorithm is a function for data processing.

    Examples:
        >>> from ql import count_qubits
        >>> count_qubits()
        16

    Returns:
        The number of conceptual qubits.
    """
    return multiprocessing.cpu_count() - 1