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

Constructing a Stabilizer(phases, xs, zs) should not allow the phases array to be longer than the height of the Hx or Hz matrix #208

Open
Benzillaist opened this issue Dec 30, 2023 · 0 comments
Labels
better error messages bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Benzillaist
Copy link
Contributor

Benzillaist commented Dec 30, 2023

When calling the stabilizer constructor on line 358 in QuantumClifford.jl:

Stabilizer(phases::AbstractVector{UInt8}, xs::AbstractMatrix{Bool}, zs::AbstractMatrix{Bool}) = Stabilizer(Tableau(phases, xs, zs))

The length of the phases array and the height of the xs and zs matrices are not compared, allowing invalid Stabilizers to be Created. For example, calling
Stabilizer(fill(0x0, 10), Hx, Hz)
where Hx and Hz are 3x6 matrices, creates a Stabilizer with no problems which is in fact invalid.

This is true for most Stabilizer/Tableau constructors, so looking at the Tableau constructor might be a good place to start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better error messages bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants