Skip to content

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

@Krastanov

Description

@Krastanov

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions