PauliOps
submodule
Example
julia> using QuantumLegos
julia> p = PauliOps.single_pauliop('I')
I::SinglePauliOp = 0
julia> typeof(p)
Enum QuantumLegos.PauliOps.SinglePauliOp:
I = 0
X = 1
Y = 2
Z = 3
julia> pauliop("IXYZ")
4-element PauliOp:
I::SinglePauliOp = 0
X::SinglePauliOp = 1
Y::SinglePauliOp = 2
Z::SinglePauliOp = 3
julia> typeof(ans)
SVector{4, SinglePauliOp} (alias for StaticArraysCore.SArray{Tuple{4}, QuantumLegos.PauliOps.SinglePauliOp, 1, 4})
julia> PauliOps.I * PauliOps.X
X::SinglePauliOp = 1
julia> PauliOps.X * PauliOps.Z
Y::SinglePauliOp = 2
julia> pauliop("IIX") .* pauliop("XIY")
3-element PauliOp:
X::SinglePauliOp = 1
I::SinglePauliOp = 0
Z::SinglePauliOp = 3
API
QuantumLegos.PauliOps
— ModulePauli operator
QuantumLegos.PauliOps.GeneratedPauliGroup
— Typestruct GeneratedPauliGroup
Iterator for group generated from gens
.
GeneratedPauliGroup(gens::AbstractVector{T}) where {T <: PauliOp}
Examples
julia> gens = pauliop.(["IIXX", "IZZI"])
2-element Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop("IIXX")
pauliop("IZZI")
julia> g = PauliOps.GeneratedPauliGroup(gens)
GeneratedPauliGroup{4}(StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}[pauliop("IIXX"), pauliop("IZZI")], IterTools.Subsets{Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}}(StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}[pauliop("IIXX"), pauliop("IZZI")]))
julia> collect(g)
4-element Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop("IIII")
pauliop("IIXX")
pauliop("IZZI")
pauliop("IZYX")
QuantumLegos.PauliOps.PauliOp
— TypePauliOp{N}
Pauli operator on multiple qubits.
QuantumLegos.PauliOps.SinglePauliOp
— Type@enum SinglePauliOp begin
I
X
Y
Z
end
Pauli Operator on a single qubit.
QuantumLegos.PauliOps.pauliop
— Methodpauliop(str::AbstractString)::PauliOp
Convert str
to PauliOp
.
QuantumLegos.PauliOps.single_pauliop
— Methodsingle_pauliop(char::Char)::SinglePauliOp
Convert char
to SinglePauliOp
.
QuantumLegos.PauliOps.weight
— Functionweight(p::PauliOp, [init = 1])
Weight of the operator p
, i.e. non $I$ operator.
QuantumLegos.PauliOps.xweight
— Functionxweight(p::PauliOp, [init = 1])
Number of $X, Y$ in p
.
QuantumLegos.PauliOps.zweight
— Functionzweight(p::PauliOp, [init = 1])
Number of $Z, Y$ in p
. a