Circuit.surround

Circuit.surround(point, num_qudits, bounding_region=None, fail_quickly=False)[source]

Retrieve the maximal region in this circuit with point included.

Parameters:
  • point (CircuitPointLike) – Find a surrounding region for this point. This point will be in the final CircuitRegion.

  • num_qudits (int) – The number of qudits to include in the region.

  • bounding_region (CircuitRegionLike | None) – An optional region that bounds the resulting region.

  • fail_quickly (bool) – If set to true, will not branch on an invalid region. This will lead to a much faster result in some cases at the cost of only approximating the maximal region.

Raises:
  • IndexError – If point is not a valid index.

  • ValueError – If num_qudits is nonpositive.

  • ValueError – If the operation at point is too large for num_qudits.

  • ValueError – If bounding_region is invalid.

Notes

This algorithm explores outward horizontally as much as possible. When a gate is encountered that involves another qudit not currently in the region, a decision needs to be made on whether that gate will be included or not. These decisions form a tree; an exhaustive search is employed to find the maximal region from this decision tree.