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

embed for single-qubit and two-qubit symbolic Clifford Operators #415

Closed
wants to merge 1 commit into from
Closed
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
36 changes: 36 additions & 0 deletions src/symbolic_cliffords.jl
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,42 @@ LinearAlgebra.inv(op::sInvSQRTXX) = sSQRTXX(op.q1, op.q2)
LinearAlgebra.inv(op::sSQRTYY) = sInvSQRTYY(op.q1, op.q2)
LinearAlgebra.inv(op::sInvSQRTYY) = sSQRTYY(op.q1, op.q2)

"""
Embed a single-qubit Clifford operator in a larger Clifford operator.

```jldoctest
julia> embed(5, 4, sHadamard)
X₁ ⟼ + X____
X₂ ⟼ + _X___
X₃ ⟼ + __X__
X₄ ⟼ + ___Z_
X₅ ⟼ + ____X
Z₁ ⟼ + Z____
Z₂ ⟼ + _Z___
Z₃ ⟼ + __Z__
Z₄ ⟼ + ___X_
Z₅ ⟼ + ____Z
```

Embed a two-qubit Clifford operator in a larger Clifford operator.

```jldoctest
julia> embed(5, (2,3), sCNOT)
X₁ ⟼ + X____
X₂ ⟼ + _XX__
X₃ ⟼ + __X__
X₄ ⟼ + ___X_
X₅ ⟼ + ____X
Z₁ ⟼ + Z____
Z₂ ⟼ + _Z___
Z₃ ⟼ + _ZZ__
Z₄ ⟼ + ___Z_
Z₅ ⟼ + ____Z
```
"""
embed(n::Int, i::Int, t::Type{<:AbstractSingleQubitOperator}) = CliffordOperator(t(i), n)
embed(n::Int, indices::Tuple{Int,Int}, t::Type{<:AbstractTwoQubitOperator}) = CliffordOperator(t(indices...), n)

##############################
# Functions that perform direct application of common operators without needing an operator instance
##############################
Expand Down
Loading