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

Horizontal concatenation (hcat) for Tableaux and Stabilizers #304

Merged
merged 16 commits into from
Sep 27, 2024
Merged
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

# News

## v0.9.5 - dev

- Addition of a horizontal concatenation for Tableaus -- `hcat`.
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved

## v0.9.4 - 2024-06-28

- Addition of a constructor for concatenated quantum codes -- `Concat`.
Expand Down
14 changes: 14 additions & 0 deletions src/QuantumClifford.jl
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,20 @@

Base.vcat(stabs::Stabilizer...) = Stabilizer(vcat((tab(s) for s in stabs)...))

function Base.hcat(tabs::Tableau...)

Check warning on line 925 in src/QuantumClifford.jl

View check run for this annotation

Codecov / codecov/patch

src/QuantumClifford.jl#L925

Added line #L925 was not covered by tests
# Ensure all Tableaus have the same number of rows
nqubits = tabs[1].nqubits
if !all(t -> t.nqubits == nqubits, tabs)
throw(ArgumentError("All Tableaus must have the same number of qubits for horizontal concatenation."))

Check warning on line 929 in src/QuantumClifford.jl

View check run for this annotation

Codecov / codecov/patch

src/QuantumClifford.jl#L927-L929

Added lines #L927 - L929 were not covered by tests
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
end
Tableau(

Check warning on line 931 in src/QuantumClifford.jl

View check run for this annotation

Codecov / codecov/patch

src/QuantumClifford.jl#L931

Added line #L931 was not covered by tests
tabs[1].phases, #does not make sense, better method needed for phases concatenation
sum(s.nqubits for s in tabs),
hcat((s.xzs for s in tabs)...))
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
end

Base.hcat(stabs::Stabilizer...) = Stabilizer(hcat((tab(s) for s in stabs)...))

Check warning on line 937 in src/QuantumClifford.jl

View check run for this annotation

Codecov / codecov/patch

src/QuantumClifford.jl#L937

Added line #L937 was not covered by tests

##############################
# Unitary Clifford Operations
##############################
Expand Down
Loading