Initiation of the project
This project started before the qiskit
library developers implemented a proper circuit visualisation method. When the development of qasm2image
started, the only way of visualising quantum circuits from qiskit
was to call a function included in the library that:
- Translates the quantum circuit to $\LaTeX$ code.
- Calls
pdflatex
on the generated $\LaTeX$ code. - (optional) Calls the
convert
tool (on Linux ) to convert the generated PDF to another image format.
There were several issues with this method:
- A working $\LaTeX$ compiler should be present on the machine
- Some non-standard $\LaTeX$ package should be installed
- The conversion process is long and calls external tools
pdflatex
was giving up as soon as the quantum circuit had more than $\approx 30$ gates
The last issue was particularly problematic for me: how can I try to debug my quantum program without having the possibility to view it in a understandable way?
Goal of the project
The main goal of the project was to increase the limit on the quantum circuit size indirectly imposed by pdflatex
.
During the development process, generating nice looking quantum circuit visualisations became a secondary goal: why looking at something ugly if it can be nice without too much efforts?
Conclusion of the project
The project was a success: the main goal was achieved by generating images in SVG format, that could then be exported to PNG, PS and PDF thanks to the cairo library or left in a SVG format. The inclusion into qiskit
has been discussed with some of qiskit
maintainer but:
- The visualisation part of
qiskit
was on the verge of being reworked from scratch to address the exact same issues I tried to fix. qasm2image
was developed as a “satelite” tool and was not really thought to be included in a larger code base.- The output of the
qasm2image
tool was, in my opinion, not good-looking enough to be included as-is.
A few months later, qiskit
launched its new quantum circuit visualisation implementation, which is exceptional when compared to mine.