mqt-core
mqt-core copied to clipboard
✨ Create QuantumComputation from CompoundOperation
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:
- One could refactor the compound operation that it has a
QuantumComputation
object as a member instead of a vector of operations, or - The
QuantumComputation
class can provide a functionfromCompoundOperation
similar tofromQASM
that creates aQuantumComputation
from aCompoundOperation
.
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