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

Improvements to backend methods #1023

Closed
3 tasks done
renatomello opened this issue Oct 2, 2023 · 3 comments · Fixed by #1045
Closed
3 tasks done

Improvements to backend methods #1023

renatomello opened this issue Oct 2, 2023 · 3 comments · Fixed by #1045
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@renatomello
Copy link
Contributor

renatomello commented Oct 2, 2023

Right now, backend.calculate_norm calculates one specific norm, which is the Frobenius (aka Hilbert-Schmidt) norm.

So, there are two possibilities here:

  1. Give the method more flexibility to calculate different norms (e.g. numpy.linalg.norm)
  2. Rename the method to specify the only norm that calculates

Another thing is, since the Hilbert-Schmit inner product between two operators is the HS norm squared, we could use backend.calculate_norm to replace backend.calculate_overlap and backend.calculate_overlap_density_matrix entirely.

Moreover, backend.entanglement_entropy is now redundant with qibo.quantum_info.entanglement_entropy.

Tasks

Preview Give feedback
  1. documentation enhancement
    renatomello
  2. documentation enhancement
    renatomello
  3. documentation enhancement
    renatomello
@renatomello renatomello added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 2, 2023
@renatomello renatomello changed the title Improvements to backend.calculate_norm Improvements to backend methods Oct 2, 2023
@scarrazza scarrazza added this to the Qibo 0.2.2 milestone Oct 10, 2023
@renatomello
Copy link
Contributor Author

renatomello commented Oct 12, 2023

@stavros11 @scarrazza Now that I am looking at it, there is a bigger problem here: backend.entanglement_entropy is not calculating Entanglement Entropy between two partitions of a quantum system (see qibo.quantum_info.metrics.entanglement_entropy). It is instead calculating "just" the von Neumann entropy of a quantum system (see qibo.quantum_info.metrics.entropy).

Besides that, since the functions in qibo.quantum_info are backend-agnostic, do we even need to keep this method?

@stavros11
Copy link
Member

@stavros11 @scarrazza Now that I am looking at it, there is a bigger problem here: backend.entanglement_entropy is not calculating Entanglement Entropy between two partitions of a quantum system (see qibo.quantum_info.metrics.entanglement_entropy). It is instead calculating "just" the von Neumann entropy of a quantum system (see qibo.quantum_info.metrics.entropy).

Indeed, as far as I remember this function was written only for the EntanglementEntropy callback, which is calling the partial trace in a previous step

rho = backend.partial_trace(state, self.partition, self.nqubits)

I guess that's the difference you mean. Maybe the name in backend.entanglement_entropy was not the best choice.

Besides that, since the functions in qibo.quantum_info are backend-agnostic, do we even need to keep this method?

If it is possible to replace it with some other existing method then we don't need to keep both. We should avoid repetition as much as possible.

@renatomello
Copy link
Contributor Author

If it is possible to replace it with some other existing method then we don't need to keep both. We should avoid repetition as much as possible.

I'll try to implement this callback using qibo.quantum_info.entanglement_entropy so then we can remove these redundancies.

@renatomello renatomello linked a pull request Oct 18, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants