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

reinterpret to permit easily changing the internal bit-packing of the tableaux #453

Open
Krastanov opened this issue Dec 21, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Krastanov
Copy link
Member

We pack the bits representing the tableau in UInts and use bit-wise operations on them.

The library is set to support any sized UInt8/16/..., but we usually just use the default one.

There are a few tests that make sure that other sizes are still suported though (e.g. bitpacking and ecc_syndromes).

It would be useful to create the appropriate methods of reinterpret so that such tests are easier to write.

Here are some untested draft implementations (not a particularly good API design either):

    using QuantumClifford: Tableau
    reinterpret_frame(frame) = PauliFrame(reinterpret_stab(frame.frame), copy(frame.measurements))
    reinterpret_stab(s) = Stabilizer(Tableau(copy(phases(s)), nqubits(s), collect(reinterpret(UInt8, collect(s.tab.xzs)))[[1:1+(nqubits(s)-1)÷8;end÷2+1:end÷2+1+(nqubits(s)-1)÷8],:]))
    reinterpret_p(p) = PauliOperator(p.phase, nqubits(p), collect(reinterpret(UInt8, p.xz))[[1:1+(nqubits(p)-1)÷8;end÷2+1:end÷2+1+(nqubits(p)-1)÷8]])

This is also of great use when considering GPU code. (there should be "See also" entries to fastcolumn and fastrow and tocpu and togpu).

@Krastanov Krastanov added enhancement New feature or request good first issue Good for newcomers labels Dec 21, 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 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant