tqec icon indicating copy to clipboard operation
tqec copied to clipboard

Specifying an `Observable` requires too much knowledge about implementation details

Open nelimee opened this issue 1 year ago • 3 comments

The issue

We have an Observable operation that can be used to add an observable to the quantum circuit generated.

Creating correctly an observable currently requires to know implementation details. For example, because you can only create an observable by providing global qubit positions, you need to understand how the code is working in order to pick the right qubits.

Expected improvement

It would be nice to be able to create an observable without needing any knowledge about the internal implementation details.

I do not have any idea to make that easy at the time being, I am open to all suggestions.

nelimee avatar Feb 15 '24 13:02 nelimee

Hi Adrien,

Some ideas below...

A final observable will be associated with an array of measurements, so potentially fairly simple plaquettes. Is it possible to write a function that detects whether a square template with just measurement plaquettes has a well defined central vertical line or horizontal line of qubits? The idea is to scalably choose the observable. A function that takes a final measurement layer in, and H or V, and produces an observable. I believe Stim is capable of detecting whether an observable is valid. It's ok if the function fails to cope with some inputs.

I believe that ultimately to automate things we are going to need to be able to detect such midlines.

When it comes to moving observables horizontally, and assuming we have well defined midlines, it seems that templates with plaquettes with single measurements as well as clean midlines would be a good starting point. Moving observables from midline to midline would then typically mean choosing to extend and contract along midlines, or using one half of the checkerboard of plaquettes to move a midline operator sideways.

Happy to chat more 1-1 or in our next meeting.

Best, Austin.

On Thu, Feb 15, 2024 at 5:33 AM Adrien Suau @.***> wrote:

The issue

We have an Observable https://github.com/QCHackers/tqec/blob/09229fe45ede2827fa1718cf6fac6c3613254733/src/tqec/detectors/operation.py#L200 operation that can be used to add an observable to the quantum circuit generated.

Creating correctly an observable currently requires to know implementation details. For example, because you can only create an observable by providing global qubit positions, you need to understand how the code is working in order to pick the right qubits. Expected improvement

It would be nice to be able to create an observable without needing any knowledge about the internal implementation details.

I do not have any idea to make that easy at the time being, I am open to all suggestions.

— Reply to this email directly, view it on GitHub https://github.com/QCHackers/tqec/issues/141, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTHTDOIZFI327YIB7DDYTYFCFAVCNFSM6AAAAABDKITCOSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZTMNJUGAZTCNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

afowler avatar Feb 19 '24 02:02 afowler

I think that implementing that on the template side makes a lot of sense. This is an approach I did not think about, but defining a method (that could be named qubits_on_midline for example) on Template instances might do the trick for simple templates.

As soon as more complex composition is needed, it might be tough to define a "midline". I need to think more about it, and happy to discuss that whenever you are available.

nelimee avatar Feb 19 '24 20:02 nelimee

I can have a look at this

Gistbatch avatar Apr 10 '24 15:04 Gistbatch