CircuitLocation.is_location

static CircuitLocation.is_location(location, num_qudits=None)[source]

Determines if the sequence of qudits form a valid location. A valid location is a set of qubit indices (integers) that are greater than or equal to zero, and if num_qudits is specified, less than num_qudits.

Parameters:
  • location (Any) – The location to check.

  • num_qudits (int | None) – The total number of qudits. All qudit indices should be less than this. If None, don’t check.

Returns:

True if the location is valid.

Return type:

(TypeGuard[CircuitLocationLike])