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

States convention #710

Open
jwnys opened this issue May 14, 2021 · 1 comment · May be fixed by #1738
Open

States convention #710

jwnys opened this issue May 14, 2021 · 1 comment · May be fixed by #1738
Labels
forget-me-not Things that should not be forgotten

Comments

@jwnys
Copy link
Collaborator

jwnys commented May 14, 2021

I'm wondering why "all_states" (and to also states_to_number) of the hilbert space "Spin" uses the convention

state[i] = - 2 sz[i] ?

Using "all_states" on a hilbert space of just one spin-1/2, you get the states array: [[-1],[1]]. In essence, if you implement a new type of operator (e.g. in my case PauliStrings that work with Spin instead of Qubit), you might want to check the sz[i] directly to compute the "get_conn_padded" (as is now also done for the qubit case). Wouldn't it be more straightforward to take state[i] = 2 sz[i] ?
This does not really affect much code, I think, since all operators use the 'number' indices of the states anyways. However, if you want to extend PauliStrings to Spins, it would be clearer if you change signs whenever "-1" occurs.

@PhilipVinc
Copy link
Member

It’s a limitation of our implementation of local operators.
We need the states to be sorted from lowest to highest, but the standard convention of writing the Pauli basis is from highest to lowest.

we would like to address this but to solve it we need to support arbitrary ordering of the local basis in LocalOperator.
The change is not trivial because that code is rather messy.
I was planning on rewriting it eventually and with a rewrite address this issue, automatically.
But right now I don’t have time to work on this

@PhilipVinc PhilipVinc added the forget-me-not Things that should not be forgotten label May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forget-me-not Things that should not be forgotten
Projects
None yet
2 participants