Skip to content
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

Avoid using QuantumCircuit.name and eval to encode information #14

Open
nelimee opened this issue Apr 7, 2024 · 0 comments
Open

Avoid using QuantumCircuit.name and eval to encode information #14

nelimee opened this issue Apr 7, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nelimee
Copy link
Owner

nelimee commented Apr 7, 2024

Currently, the function sqt.basis.equidistant.get_approximately_equidistant_circuits is encoding the 1-qubit quantum state prepared by each quantum circuit returned as a string representation of the 3-dimensional point on the unit sphere representing the state, in the quantum circuit name.

This has been done to tie together a quantum circuit with the state it prepares and ensure that the library was recovering the correct results from the jobs. The goal was to create the circuits and then be able to recover them and the point they prepare with something like:

circuits = get_approximately_equidistant_circuits(10)
points = [eval(c.name) for c in circuits]

This is bad for several reasons, using eval being the most obvious and visible one. Due to that, it would be nice to be able to remove that behaviour from the library. A few potential tracks:

  • QuantumCircuit.name will still have to be fixed to known values, but could be a simple integer that would then index in a list of points.
  • this will help Better exchange formats #3 as one of the issue is to encode QuantumCircuit as JSON (which, with the current code, requires to also save the QuantumCircuit name),
  • this change will impact a lot of places in the code: circuit construction, execution, backup and result retrieval.
@nelimee nelimee added the enhancement New feature or request label Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant