CircuitLocation

class CircuitLocation(location)[source]

Bases: Sequence[int]

The CircuitLocation class.

A CircuitLocation is an ordered set of qudit indices. In context, this usually describes where a gate or operation is being applied.

__init__(location)[source]

Construct a CircuitLocation from location.

Parameters:

location (int | Sequence[int]) – The qudit indices.

Raises:
  • ValueError – If any qudit index is negative.

  • ValueError – If there are duplicates in location.

Attributes

pairs

Return all pairs of unique elements in the location.

Methods

count(value)

index(value, [start, [stop]])

Raises ValueError if the value is not present.

intersection(other)

Return the location containing qudits from self and other.

is_location(location[, num_qudits])

Determines if the sequence of qudits form a valid location.

union(other)

Return the location containing qudits from self or other.