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.

Draw circuit without passing circuit arguments

See original GitHub issue

Feature details

Currently, to draw a circuit, we need to pass the inputs which are then used in the circuit drawing. I suggest having a general circuit drawing function that can draw the circuit without those inputs. Instead of showing the angles of rotation, for example, it can simply say which type of rotation gate it is. We can then have a general circuit. Not a parameterized one.

Implementation

Drawing capability is already there. Just need to modify it such that circuit.draw() will draw a general circuit if no parameters have been passed, instead of raising an error. If parameters are given, circuit.draw() will function as it does now and circuit.draw(parametric=False) will draw the general circuit.

How important would you say this feature is?

1: Not important. Would be nice to have.

Additional information

#1484 is somewhat related. It enables drawing of mpl circuits. Not sure if will draw general circuits or not. If not, this issue can also be added for that. Parameterized circuits are good but general circuits are also needed.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ankit27khcommented, Apr 8, 2022

Hello @albi3ro! Thanks for this! And also for the wonderful mpl drawer! Great addition!

1reaction
albi3rocommented, Apr 7, 2022

@ankit27kh

As long as the values don’t have any classical processing (like x+y or if x), then strings can be used in place of numbers in the current circuit drawer.

@qml.qnode(qml.device('default.qubit', wires=1))
def circ(x):
    qml.RX(x, wires=0)
    return qml.expval(qml.PauliZ(0))

print(qml.draw(circ)('x'))
0: ──RX(x)─┤  <Z>

Does this provide what you wanted? It won’t work in all situations, but hopefully will be useful enough for most.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visualizing a Quantum Circuit - Qiskit
Controlling output from circuit.draw()¶ ... By default, the draw() method returns the rendered image as an object and does not output anything. The...
Read more >
How to visualize quantum circuits in PennyLane
In order to visualize your circuit, you can define a drawer that comes from your corresponding circuit by using qml.draw() , and visualize...
Read more >
Oral Arguments (Panel VI) - 2:00PM Tuesday 5/3/2022
Cases:0:10:20 - 22-1251 Audio livestream of oral arguments for the US Court of Appeals for the Fourth Circuit.For more information on cases ...
Read more >
Federal Rules of Appellate Procedure - Seventh Circuit
(3) The petition and answer will be submitted without oral argument unless the court of appeals orders otherwise. (c) Form of Papers; Number...
Read more >
Telephonic oral arguments: tips for advocates
Similarly, the Seventh Circuit will hear oral argument by phone through ... to be able to speak for longer intervals without interruption.
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