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

Implementation of a pauli observable structure #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Rommartin
Copy link

Implement an efficient structure to store Pauli observables. It uses a dictionnary which keys are integers corresponding to positions where the observable is different from identity, the value associated is the corresponding observable (X, Y or Z).
Classical Shadows estimations (robust and standard) have been adapted to this structure. Derandomization and other procedures have yet to be adapted.

@lvignoli lvignoli self-assigned this Mar 7, 2023
@lvignoli lvignoli added the enhancement New feature or request label Mar 7, 2023
@lvignoli lvignoli self-requested a review March 7, 2023 19:19
@lvignoli lvignoli assigned Rommartin and unassigned lvignoli Mar 7, 2023
Copy link
Collaborator

@lvignoli lvignoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made two small requests regarding of the PauliObs struct, otherwise I am fine with it :)

function PauliObs_to_string(obs::PauliObs)::String
string = collect("I"^obs.n_qubits)
for p in obs.pauli
string[p[1]] = p[2]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since p is a dict, it would be nice to use it as such.

n_qubits = length(obs)
pauli = Dict{Int64, Char}()
for i in 1:n_qubits
if obs[i] != 'I'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is now guarantee that obs[i] is 'X', 'Y' or 'Z'.
obs should be validate using re_pauli_string in observables.jl before parsing.

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

Successfully merging this pull request may close these issues.

2 participants