8000 Implement basic circuit optimisations · Issue #157 · zxcalc/quizx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Implement basic circuit optimisations #157
Open
@akissinger

Description

@akissinger

PyZX does a pass of basic gate-level optimisations as a final stage in most circuit-to-circuit optimisations (see the basic_optimization function).

We should do something like this in QuiZX. The PyZX version has gotten increasingly elaborate over the years, so we might not need something this heavy weight. Just scanning forward and backwards and doing obvious commutations/cancellations should suffice for now. Ideally any fancier stuff should be done at the ZX and/or circuit extraction level.

Implementation

QuiZX uses the Circuit struct to store quantum circuits. This is essentially a Vec of Gate's.

For this task, add a new file called something like circuit_optimizer.rs and implement a function that traverses this list, possibly in multiple passes, and cancels/combines basic gates wherever possible. If it is useful to have many flags or keep some state around, then this function could be wrapped in a struct like it is in PyZX.

Optimisation should be done up-to-commutativity: if we have a sequence of gates U; V1; V2; ...; Vn; W where U commutes with all the Vi gates and U can cancel or combine with W, then we should try and find this optimisation and apply it.

There is some tradeoff between finding all such cancellations and producing a simple and efficient procedure. Here, I suggest we shoot for some middle ground.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersrustPull requests that update Rust code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0