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

better bit-wrangling abstraction #113

Open
Krastanov opened this issue May 11, 2023 · 2 comments · Fixed by #367
Open

better bit-wrangling abstraction #113

Krastanov opened this issue May 11, 2023 · 2 comments · Fixed by #367
Labels
code quality Code that should be refactored enhancement New feature or request

Comments

@Krastanov
Copy link
Member

In many places in the code you can see

    T = eltype(xzs)
    lowbit = T(1)
    ibig = _div(T,i-1)+1
    ismall = _mod(T,i-1)
    ismallm = lowbit<<(ismall)

where ibig is the index within the array of UIntx and ismall is the bit within that UIntx. This is getting too repetitive at this point. Find a better way to write it, abstract it away.

Consult the small symbolic Cliffords (e.g. sHadamard) as they have some more abstraction.

@Krastanov Krastanov added the code quality Code that should be refactored label May 11, 2023
@Krastanov
Copy link
Member Author

@amicciche , this is related to your pull request

@Krastanov
Copy link
Member Author

Keeping this open as there can still be additional cleanup even after #367.

#367 would be a good reference for future work on this as well.

In particular, now with #364 we consistently just get the small and big indices, but an abstraction that does not require the user to explicitly perform that step would still be useful. E.g. something like bi = BitIndexer(stabilizer); bi[i,j] == stabilizer.xzs[ibig] & imask (up to some typos in the example). But really, it would be much better if just writing stabilizer[i,j] ends up being as fast so we do not need this explicit indexing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Code that should be refactored enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant