quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Default insertion strategy EARLIEST #1119

Closed dabacon closed 5 years ago

dabacon commented 5 years ago

The default insertion strategy is currently NEW_THEN_INLINE. This is a) one of the most complicated insertion strategies, and b) not likely the one most NISQ folks want as they want to minimize depth. I think we should change the default to EARLIEST. I find myself changing this default a lot, which I think is a sign.

smitsanghavi commented 5 years ago

I also agree with this, NEW_THEN_INLINE is definitely more readable but wasteful for depth limited applications. I can take this issue. I'm assuming the main work will be to fix tests that rely on this default.

smitsanghavi commented 5 years ago

One issue I'm realizing with making EARLIEST the default is that it doesn't respect explicitly defined moments or OP_TREE structure. Will this be an issue for people using the APIs? What is the expectation in case of circuits specified as series of explicit moments?

Strilanc commented 5 years ago

Currently, passing more than one moment into append or insert is considered to be an error. And if you pass in a moment, it goes directly into the list without any re-arranging of the gates. So I don't think this will be an issue.