qbraid.interface.assert_allclose_up_to_global_phase

assert_allclose_up_to_global_phase(a, b, atol, **kwargs)[source]

Checks if two numpy arrays are equal up to a global phase, within a specified tolerance, i.e. if a ~= b * exp(i t) for some t.

Parameters:
  • a (np.ndarray) – The first input array.

  • b (np.ndarray) – The second input array.

  • atol (float) – The absolute error tolerance.

  • **kwargs – Additional keyword arguments to pass to np.testing.assert_allclose.

Raises:

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

Return type:

None