gulps.analysis.region.ReachableRegion

class gulps.analysis.region.ReachableRegion(_bounds)[source]

Bases: object

One orientation of the local-equivalence classes a gate sentence reaches.

Use reaches() to test whether the sentence can implement a target. It checks this orientation and its mirror, rho. Coordinates are Weyl (c1, c2, c3) in units of pi. Construct with of().

Parameters:

_bounds (tuple[float, ...])

classmethod of(sentence)

The region reached by a sentence of these classes, in any order.

Parameters:

sentence (Iterable[LocalEquivalenceClass]) – The invariant classes of the two-qubit gates.

Return type:

ReachableRegion

property rho: ReachableRegion

The mirror orientation of the same sentence’s reach.

property vertices: ndarray | None

The polytope’s vertices as an (N, 3) Weyl array, or None if empty.

property faces: list[ndarray]

The polygonal faces, each an (k, 3) Weyl array in cyclic order.

property haar_mass: float

The fraction of Haar-random two-qubit unitaries whose class lies inside.

contains(target)

Whether a class lies inside this orientation, by the compiler’s test.

Parameters:

target (LocalEquivalenceClass | ndarray) – A LocalEquivalenceClass, one Weyl triple, or an (N, 3) array of Weyl triples.

Returns:

One bool, or a bool array with one entry per row.

Return type:

bool | ndarray

reaches(target)

Whether the sentence can implement a target, allowing global phase.

Unlike contains(), this checks both orientations of the region.

Parameters:

target (LocalEquivalenceClass | ndarray) – A LocalEquivalenceClass, one Weyl triple, or an (N, 3) array of Weyl triples.

Returns:

One bool, or a bool array with one entry per row.

Return type:

bool | ndarray