Circuit.check_region

Circuit.check_region(region, strict=False)[source]

Check region to be a valid in the context of this circuit.

Parameters:
  • region (CircuitRegionLike) – The region to check.

  • strict (bool) – If True, fail on any disconnect, even if there are no gates in the disconnect. (Default: False)

Raises:
  • ValueError – If region includes qudits not in the circuit, or if the region is too large for the circuit.

  • ValueError – If the region cannot be folded due to a possible change to simulation order. This can happen when the region is disconnected between qudits and outside gates occur in the disconnect.