Matrix exponential of “-i H t”The qprof idea came just after the implementation of the quantum wave equation solver using QatHS, when I reached the optimisation step. Once again the issue was the lack of proper tooling around quantum computing frameworks: I wanted to optimise my implementation, but no tool I was aware of was capable of analysing the quantum circuits I generated and to give me the numbers I want.
The target of this project was to produce a gprof-compatible tool: a program that would analyse quantum circuits and output a summary in the exact same format as gprof.
The constraint on the output format (that should be exactly the same as gprof) was motivated by several points:
gprofis nearly 40 years old and is still recognised as one of the standard tools to profile code nowadays. As such, I came to the conclusion that its output format should be the result of many years of polishing and is probably a good starting point.- There exist a plethora of tools that plug themselves to
gprofpost-processing its output. I was mostly looking at the excellentgprof2dottool that generates adotfile fromgprofoutput. Having an output format compatible withgprofmade the usage of all these tools possible and easy.
This project has already been tested on a big implementation involving a lot of nested calls: QatHS. The results are already quite nice as you can see on the following call graphs, generated with qprof, gprof2dot and Graphviz' dot tool using quantum circuits from QatHS.


I ended up reworking a little bit the implementation, taking out of qprof the circuit-wrapper code that was abstracting away the framework the circuit was written in to let qprof ingest a large variety of circuits. The new library doing that is called qcw (which stands for Quantum Circuit Wrapper) and is open-source and available on PyPI with plugins for qiskit, openqasm2 and myqlm.