gulps.invariants.LocalEquivalenceClass

class gulps.invariants.LocalEquivalenceClass(weyl)[source]

Bases: object

The local-equivalence class of a two-qubit gate.

Construct from Weyl coordinates, or with from_unitary().

Two classes are equal, and hash equal, when their monodromy coordinates round to the same point of a fixed grid, far finer than any gate’s precision.

Parameters:

weyl (Sequence[float]) – Weyl coordinates (c1, c2, c3) in units of pi, with c2 <= c1, c1 + c2 <= 1, and |c3| <= c2, each within the class tolerance. A point with c3 < 0, or with c3 zero within the class tolerance and c1 > 1/2, is replaced by (1 - c1, c2, -c3), the same class.

Raises:

ValueError – If a coordinate is not finite or the point is outside that region.

static from_unitaries(matrices)

The classes of many two-qubit gates or matrices, computed in parallel.

Parameters:

matrices (Sequence[qiskit.circuit.Gate | qiskit.quantum_info.Operator | np.ndarray | LocalEquivalenceClass]) – Classes in the input are returned unchanged.

Returns:

In input order.

Return type:

list[LocalEquivalenceClass]

Raises:
static from_unitary(gate)

The class of a two-qubit gate or matrix.

Parameters:

gate (qiskit.circuit.Gate | qiskit.quantum_info.Operator | np.ndarray) – Unitary to within the input tolerance; a nearly unitary matrix is projected through its closest unitary.

Returns:

LocalEquivalenceClass

makhlin

The Makhlin invariants (Re G1, Im G1, Re G2).

Type:

np.ndarray

matrix

The canonical gate exp(iπ/2 (c1 XX + c2 YY + c3 ZZ)) of this class.

Type:

np.ndarray

weyl

Weyl coordinates (c1, c2, c3) in units of pi.

Type:

np.ndarray