-
Notifications
You must be signed in to change notification settings - Fork 73
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
add quantikz circuit plotting #714
add quantikz circuit plotting #714
Conversation
FWIW this implementation is heavily inspired by the pyquil version I wrote in 2019. Perhaps I should make a note about that somewhere... |
Looks great! Are there any plans to have multiple frontends for this (e.g. slime using something like this)? |
Good question -- I'm still slowly but surely iterating on the features for this, but will take at the possibility of multiple render targets. |
98c7257
to
d763c0b
Compare
Awesome! |
This adds rudimentary plotting via LaTeX + Quantikz, usable a few ways. For example, in a Jupyter notebook
or in a SLIME session
Backends
In general, we always convert the instructions of a parsed program to a
diagram
, which is basically just a set of lists corresponding to operations on qubit lines, and then emit this as latex source.What happens next depends on the choice of "backend", cf. methods on the
RENDER
generic. We currently have three:latex
just passes the generated latex through:jupyter-svg
usespdflatex
andpdf2svg
to generate a SVG file, and then constructs ajupyter:svg
object from this:slime-png
usespdflatex
andconvert
to generate a PNG file, and then pushes this via SWANK to the slime repl, as described in https://righele.it/2012/02/22/display-images-in-slime-from-common-lisp/ (ht @colescott )See
src/tools/README.md
for installation details.