# weylchamber.local_invariants module¶

## Summary¶

Functions:

 J_T_LI Calculate value of the local-invariants functional closest_LI Find the closest gate that has the given Weyl chamber coordinates g1g2g3 Calculate local invariants $$(g_1, g_3, g_3)$$ g1g2g3_from_c1c2c3 Calculate local invariants from the Weyl chamber coordinates

__all__: J_T_LI, closest_LI, g1g2g3, g1g2g3_from_c1c2c3

## Reference¶

weylchamber.local_invariants.g1g2g3(U, ndigits=8)[source]

Calculate local invariants $$(g_1, g_3, g_3)$$

Given a two-qubit gate, calculate local invariants $$(g_1, g_2, g_3)$$. U must be in the canonical basis. For numerical stability, the resulting values are rounded to the given precision, cf. the ndigits parameter of the built-in round() function.

>>> print("%.2f %.2f %.2f" % g1g2g3(qutip.gates.cnot()))
0.00 0.00 1.00

Return type: Tuple[float, float, float]
weylchamber.local_invariants.g1g2g3_from_c1c2c3(c1, c2, c3, ndigits=8)[source]

Calculate local invariants from the Weyl chamber coordinates

Calculate the local invariants $$(g_1, g_2, g_3)$$ from the Weyl chamber coordinates $$(c_1, c_2, c_3)$$, in units of π. The result is rounded to the given precision, in order to enhance numerical stability (cf. ndigits parameter of the built-in round() function)

Example

>>> CNOT = qutip.gates.cnot()
>>> print("%.2f %.2f %.2f" % g1g2g3_from_c1c2c3(*c1c2c3(CNOT)))
0.00 0.00 1.00

Return type: Tuple[float, float, float]
weylchamber.local_invariants.J_T_LI(O, U, form='g')[source]

Calculate value of the local-invariants functional

Parameters: O (Union[Qobj, ndarray]) – The optimal gate U (Union[Qobj, ndarray]) – The achieved gate form (str) – form of the functional to use, ‘g’ or ‘c’
weylchamber.local_invariants.closest_LI(U, c1, c2, c3, method='leastsq', limit=1e-06)[source]

Find the closest gate that has the given Weyl chamber coordinates

The c1, c2, c3 are given in units of π