qiskit-js icon indicating copy to clipboard operation
qiskit-js copied to clipboard

Quantum State Visualization (with ECharts & ECharts-GL)

Open indisoluble opened this issue 7 years ago • 3 comments

I am not sure if proving quantum state visualization is already in the roadmap but, one way or another, I think it might be worthy to comment here how I added this functionality to qiskit-sdk-swift.

On the contrary to the python repo where the visualization is based on matplotlib, there were nothing equivalent for Swift (that was also available on macOS, iOS & Linux); so I ended up using the following JavaScript libraries to display the graphs embedded in web views:

These libraries provided (out of the box) all I needed to plot the quantum states, also without any other dependency. They are under Apache license and behind them is a big company: Baidu, so I think we can assume they will be maintained for a while.

I hope the javascript code I wrote might serve as an example.

What is the expected behavior?

The code I mention above is located in:

Swift & JavaScript code are mixed in the same files but I think it is quite readable.

To end, any suggestion about how to improve the existing javascript code is welcome, in fact it would be very appreciated :)

indisoluble avatar Jun 20 '18 22:06 indisoluble

Hi, thanks for the idea. We use this project to experiment for now, so feel free to open a PR with any feature you want. Some steps to start:

  • Add a new package with all the new stuff.
  • Respect the structure of the rest ones.
  • Try to reuse things if possible. Probably only the "utils" package.
  • Add a couple of tests please.
  • When it's finished we can see if we want to add new commands to the command line client to support these new features.

:D

jesusprubio avatar Jun 21 '18 10:06 jesusprubio

Oh, I will keep this in mind but JS and the ecosystem around it are not my strong suit, so it might take me a while :)

indisoluble avatar Jun 21 '18 20:06 indisoluble

I'll keep the issue opened just in case I could find time to take a look in deep to the JS stuff of that repo. I think that stuff is interesting. Thank you :)

jesusprubio avatar Jun 21 '18 21:06 jesusprubio