cirq.match_global_phase

cirq.match_global_phase(a: numpy.ndarray, b: numpy.ndarray) → Tuple[numpy.ndarray, numpy.ndarray][source]

Phases the given matrices so that they agree on the phase of one entry.

To maximize precision, the position with the largest entry from one of the
matrices is used when attempting to compute the phase difference between
the two matrices.
Parameters:
  • a – A numpy array.
  • b – Another numpy array.
Returns:

A tuple (a’, b’) where a’ == b’ implies a == b*exp(i t) for some t.