question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

arbitrary order in circuit drawers

See original GitHub issue

What should we add?

Circuit drawers currently have reverse_bits, as an option to modify the order in which wires are represented. @ajavadia suggests a generalized version of that feature: wire_order. This parameter might define the order of the wires draw(..., wire_order=[3,0,2,1]) and can eventually replace reverse_bits with draw(..., wire_order='reverse'.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
enavarro51commented, Jun 5, 2022

A couple of more questions,

If a user uses both reverse_bits and wire_order, do we

  • raise
  • prioritize one or the other
  • do wire_order and then reverse it

If the the wire_order list is not the right length or does not have a unique integer for each bit, do we

  • raise using the same error message for each
  • raise with separate explanations
  • warn and continue without using wire_order
1reaction
ajavadiacommented, May 21, 2022

But what I’m saying is that QuantumCircuit.reverse_bits() is not just a change in visualization, it actually changes the circuit. So I think we need both the circuit option and the visualization option.

In [5]: qc.draw()
Out[5]:
     β”Œβ”€β”€β”€β”
q_0: ─ H β”œ
     β””β”€β”€β”€β”˜
q_1: ─────

q_2: ─────


In [6]: qc.draw(reverse_bits=True)    # same circuit, just drawn differently (top-to-bottom instead of bottom-to-top)
Out[6]:

q_2: ─────

q_1: ─────
     β”Œβ”€β”€β”€β”
q_0: ─ H β”œ
     β””β”€β”€β”€β”˜

In [7]: qc.reverse_bits().draw()   # a different circuit: H is now applied to a different qubit
Out[7]:

q_0: ─────

q_1: ─────
     β”Œβ”€β”€β”€β”
q_2: ─ H β”œ
     β””β”€β”€β”€β”˜

and so we need to add a generalization of these in the form of QuantumCiruit.permute_bits([....]) and QuantumCircuit.draw(permute_bits=[...])

Read more comments on GitHub >

github_iconTop Results From Across the Web

Watt Circuit Component Drawer Build - YouTube
In this video we're building a rotating component tower for component storage. 800 drawers in under 1/3m2 floor area.
Read more >
Organizing resistors - Electrical Engineering Stack Exchange
For bandoliered resistors (paper strip holding them together), I write the value on the bandolier then store the resistors in component drawers ......
Read more >
PennyLane on Twitter: " Shiny new circuit drawer The ...
PennyLane v0.20 is out, with a new graphical circuit drawer, ... been rewritten to support: Arbitrary nth order gradients on hardware Batched executionΒ ......
Read more >
Free Online Schematic and Diagramming Tool - Scheme-It
Scheme-it is an online schematic and diagramming tool that allows anyone to design and share electronic circuit diagrams. Walk through how to create...
Read more >
10 Best Circuit Diagram Maker for 2022 - My Chart Guide
Circuit diagrams are a necessity in drawing electrical circuits. The best circuit diagram makers do make the process a lot easier for youΒ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found