Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.28k stars 2.37k forks source link

Modifier methods for Qobj #696

Closed ajavadia closed 6 years ago

ajavadia commented 6 years ago

What is the expected behavior?

A typical scenario in variational algorithms is that many circuits get compiled, which have the same skeleton and only differ in some rotation angles. These should not independently go through the compilation process. It would be much faster to compile the 1st circuit into a Qobj, then modify that Qobj in-place to create other Qobjs for circuits 2 .. 1000. This eliminates the overhead of building new QuantumCircuits and compiling them.

delapuente commented 6 years ago

How would be the API of this? Do we want to make it explicit or auto-detected? Similarly to #695, I would not extend the Qobj container; this is an optimization happening in the transpilation pipeline and should live there.

jaygambetta commented 6 years ago

@ajavadia lets talk in person as this is related to the last one and when we start to have relations between the circuits we need to have a real quantum program not just a hack.

ajavadia commented 6 years ago

After in-person discussions, I am closing this issue. We agreed that Qobj should be the container that we send to backends, and is final. We want to do most of the modifications in QuantumCircuit, and in cases of requiring finer control (e.g. for speed in this case), we can make modifications in DAGCircuit.