qbraid.interface.circuits_allclose

circuits_allclose(circuit0, circuit1, index_contig=False, allow_rev_qubits=False, strict_gphase=False, atol=1e-07)[source]

Check if quantum program unitaries are equivalent.

Parameters:
  • circuit0 (QPROGRAM) – First quantum program to compare

  • circuit1 (QPROGRAM) – Second quantum program to compare

  • index_contig (bool) – If True, calculates circuit unitaries using contiguous qubit indexing.

  • allow_rev_qubits (bool) – Whether to count identical circuits with reversed qubit ordering as equivalent.

  • strict_gphase (bool) – If False, disregards global phase when verifying equivalence of the input circuit’s unitaries.

  • atol (float) – Absolute tolerance parameter for np.allclose function.

Return type:

bool

Returns:

True if the input circuits pass unitary equality check