pygsti.tools.optools.compute_best_case_gauge_transform#
- compute_best_case_gauge_transform(gate_mx, target_gate_mx, return_all=False)#
Returns a gauge transformation that maps gate_mx into a matrix that is co-diagonal with target_gate_mx.
(Co-diagonal means that they share a common set of eigenvectors.)
Gauge transformations effectively change the basis of all the gates in a model. From the perspective of a single gate a gauge transformation leaves it’s eigenvalues the same and changes its eigenvectors. This function finds a real transformation that transforms the eigenspaces of gate_mx so that there exists a set of eigenvectors which diagonalize both gate_mx and target_gate_mx.
- Parameters:
gate_mx (numpy.ndarray) – Gate matrix to transform.
target_gate_mx (numpy.ndarray) – Target gate matrix.
return_all (bool, optional) – If true, also return the matrices of eigenvectors for Ugate for gate_mx and Utgt for target_gate_mx such that U = dot(Utgt, inv(Ugate)) is real.
- Returns:
U (numpy.ndarray) – A gauge transformation such that if epgate = U * gate_mx * U_inv, then epgate (which has the same eigenalues as gate_mx), can be diagonalized with a set of eigenvectors that also diagonalize target_gate_mx. Furthermore, U is real.
Ugate, Utgt (numpy.ndarray) – only if return_all == True. See above.