cirq.testing.assert_allclose_up_to_global_phase

cirq.testing.assert_allclose_up_to_global_phase(actual: numpy.ndarray, desired: numpy.ndarray, *, rtol: float = 1e-07, atol: float, equal_nan: bool = True, err_msg: Optional[str] = '', verbose: bool = True) → None[source]

Checks if a ~= b * exp(i t) for some t.

Parameters:
  • actual – A numpy array.
  • desired – Another numpy array.
  • rtol – Relative error tolerance.
  • atol – Absolute error tolerance.
  • equal_nan – Whether or not NaN entries should be considered equal to other NaN entries.
  • err_msg – The error message to be printed in case of failure.
  • verbose – If True, the conflicting values are appended to the error message.
Raises:

AssertionError – The matrices aren’t nearly equal up to global phase.