Skip to content

scope

scope ¤

Scope ¤

Bases: frozenset[int]

An immutable container for a set of int to represent the scope of a node in the region graph or a layer in the circuit. A scope should always be a subset of range(num_variables), but for efficiency this is not checked.

Source code in cirkit/utils/scope.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class Scope(frozenset[int]):
    """An immutable container for a set of int to represent the scope of a node in the region
    graph or a layer in the circuit. A scope should always be a subset of range(num_variables),
    but for efficiency this is not checked.
    """

    def __repr__(self) -> str:
        """Generate the repr string of the scope, for repr().

        Returns:
            str: The str representation of the scope.
        """
        return f"Scope({repr(set(self))})"  # Scope({0, 1, ...}).

__repr__() ¤

Generate the repr string of the scope, for repr().

Returns:

Name Type Description
str str

The str representation of the scope.

Source code in cirkit/utils/scope.py
 7
 8
 9
10
11
12
13
def __repr__(self) -> str:
    """Generate the repr string of the scope, for repr().

    Returns:
        str: The str representation of the scope.
    """
    return f"Scope({repr(set(self))})"  # Scope({0, 1, ...}).