Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

## v0.10.1-dev

- Add a `CliffordOperator` constructor that builds a dense clifford from a `PauliOperator`
- Add a `phases` getter for `CliffordOperator`
- The generalized hypergraph product code is implemented in the ECC submodule.
- Add novel `[[n² + m²,(n - rank([C ∣ M]))² + (m − rank([C ∣ M]ᵀ))², d]]` quantum Tillich-Zémor `random_TillichZemor_code` codes to `QECCore` and introduce `QECCoreNemoExt` for accurate matrix `rank` computation.
- The D-dimensional Surface and Toric codes are now implemented using `Oscar`'s chain complexes and `GF2` homology in the ECC submodule.
Expand Down
7 changes: 7 additions & 0 deletions src/dense_cliffords.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ end
CliffordOperator(op::CliffordOperator) = op
CliffordOperator(paulis::AbstractVector{<:PauliOperator}) = CliffordOperator(Tableau(paulis))
CliffordOperator(destab::Destabilizer) = CliffordOperator(tab(destab))
function CliffordOperator(pauli::PauliOperator)
res = one(CliffordOperator, nqubits(pauli))
comm!(phases(res), pauli, tab(res))
tab(res).phases .*= 0x02
return res
end

Base.:(==)(l::CliffordOperator, r::CliffordOperator) = tab(l) == tab(r)
Base.hash(c::T, h::UInt) where {T<:CliffordOperator} = hash(T, hash(tab(c), h))
Expand Down Expand Up @@ -91,6 +97,7 @@ function Base.copy(c::CliffordOperator)
end

@inline nqubits(c::CliffordOperator) = nqubits(tab(c))
@inline phases(c::CliffordOperator) = phases(tab(c))

Base.zero(c::CliffordOperator) = CliffordOperator(zero(tab(c)))
Base.zero(::Type{<:CliffordOperator}, n) = CliffordOperator(zero(Tableau, 2n, n))
Expand Down
7 changes: 7 additions & 0 deletions test/test_cliff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
@testset "Constructors" begin
@test_throws DimensionMismatch CliffordOperator(T"X")
end
@testset "Constructor from PauliOperator" begin
for n in test_sizes
l = random_clifford(n)
pauli = random_pauli(n)
@test apply!(copy(l), pauli; phases=true) == apply!(l, CliffordOperator(pauli); phases=true)
end
end
@testset "Permutations of qubits" begin
for c in [tCNOT, tId1⊗tHadamard, tCNOT⊗tCNOT, tensor_pow(tCNOT,6), tensor_pow(tCNOT,7), tensor_pow(tCNOT,6)⊗tPhase, tensor_pow(tCNOT,7)⊗tPhase]
for rep in 1:5
Expand Down
Loading