mqt-core icon indicating copy to clipboard operation
mqt-core copied to clipboard

✨ Create QuantumComputation from CompoundOperation

Open ystade opened this issue 9 months ago • 0 comments

What's the problem this feature will solve?

A QuantumComputation and a CompoundOperation represent almost the same thing. However, they are treated separately and some tooling only exists for one of them, e.g., the reordering pass from the circuit optimiser, see include/mqt-core/CircuitOptimizer.hpp#L48.

Describe the solution you'd like

I see two possibilities to reduce code duplication:

  1. One could refactor the compound operation that it has a QuantumComputation object as a member instead of a vector of operations, or
  2. The QuantumComputation class can provide a function fromCompoundOperation similar to fromQASM that creates a QuantumComputation from a CompoundOperation.

Important to note here, is that the reverse direction already exists, see include/mqt-core/QuantumComputation.hpp#L844.

Originally posted by @burgholzer in https://github.com/cda-tum/mqt-core/pull/596#discussion_r1584817469

ystade avatar Apr 30 '24 14:04 ystade