ffsim.testing.assert_allclose_up_to_global_phase

ffsim.testing.assert_allclose_up_to_global_phase(actual, desired, rtol=1e-07, atol=0, equal_nan=True, err_msg='', verbose=True)[source]

Check if a == b * exp(i phi) for some real number phi.

Parameters:
  • actual (ndarray) – A Numpy array.

  • desired (ndarray) – Another Numpy array.

  • rtol (float) – Relative tolerance.

  • atol (float) – Absolute tolerance.

  • equal_nan (bool) – If True, NaNs will compare equal.

  • err_msg (str) – The error message to be printed in case of failure.

  • verbose (bool) – If True, the conflicting values are appended to the error message.

Raises:

AssertionError – If a and b are not equal up to global phase, up to the specified precision.