Skip to content

quick.circuit.Circuit.__eq__ inconsistency depending on operation order #28

@ACE07-Sev

Description

@ACE07-Sev

quick.circuit.Circuit.__eq__ inconsistency depending on operation order

Description

The __eq__ method for quick.circuit.Circuit uses the circuit_log attribute to assert equality. This means the order determines equality as well. Whilst order is important, certain operations can be reordered as they do not alter the circuit definition itself. For instance:

qc = QiskitCircuit(3)
qc.X(0)
qc.X(1)

qc_eq = QiskitCircuit(3)
qc.X(1)
qc.X(0)

won't be equal, even though they are in fact equal.

Tips

  • Instead of operation order alone, use a QIR for proper assessment. This could be done using the DAG representation, however, one must note that the DAG does NOT check for equal definition if the gates are of the same name. This will cause incorrect functionality should users accidentally or intentionally introduce gates with different definitions but identical name to an existing gate.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions