Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circuit editor multi-register operation dragging #14

Open
stewdio opened this issue Apr 16, 2020 · 1 comment
Open

Circuit editor multi-register operation dragging #14

stewdio opened this issue Apr 16, 2020 · 1 comment
Labels

Comments

@stewdio
Copy link
Owner

stewdio commented Apr 16, 2020

Now that multi-register creation is possible through the Circuit editor, we need to be able to drag those operations to new positions without destroying them.

If all components of a multi-register operation are dragged together the interface should treat them as intact, sending a set$ command to the circuit for the new position. (If portions of the operation will fall outside of the circuit’s moment and register bounds it is the job of the set$ routine to handle this.)

If some (but not all) components of a multi-register operation are dragged to new registers within the same moment—and these new positions do not overwrite a sibling component—the operation should also remain intact, sending a set$ command for the whole operation with a modified register indices array that addresses the dragged components’ new positions. If the drag-and-drop overwrites any sibling components then more logic is needed to determine how to proceed.

If some (but not all) components of a multi-register operation are dragged to a new moment then the operation must be broken in to its individual components. The control component should resolve to an identity gate. The remaining should resolve to the overall operation—for example the target component of a controlled-not gate should resolve to a Pauli-X operation.

@stewdio
Copy link
Owner Author

stewdio commented Apr 30, 2020

This is 90% resolved 😄

A user can now drag multi-register operations all around! Drag the whole thing. Drag part of it. Drag pieces within the same moment. Drag one component onto a sibling component (thereby erasing the sibling underneath). It works!

But before closing this we ought to update Q.Circuit.prototype.clear$ to be kinder to existing multi-register operations. Right now clearing one cell that happens to be occupied by one component of a multi-reg op will erase the whole thing. That’s not so much fun. We ought to break it apart and just erase the piece that was cleared.

@stewdio stewdio added Q.Circuit Enhancement New feature or request labels Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant