Full API
Index:
MagicTensors.MagicTensorsMagicTensors.AbstractCAMPSMagicTensors.AbstractCliffordGateMagicTensors.AbstractCliffordGateSetMagicTensors.AbstractCliffordUnitaryMagicTensors.AbstractDisentanglerMagicTensors.AbstractDmrgDisentanglerMagicTensors.AbstractLocalDisentanglerMagicTensors.AbstractPauliMagicTensors.AbstractPauliSumMagicTensors.AbstractStandAloneDisentanglerMagicTensors.GreedyDisentanglerMagicTensors.IterativeDisentanglerMagicTensors.IterativeDmrgDisentanglerMagicTensors.MetropolisDisentanglerMagicTensors.QubitCAMPSMagicTensors.QubitCliffordGateMagicTensors.QubitCliffordGateSetMagicTensors.QubitCliffordUnitaryMagicTensors.QubitPauliMagicTensors.QubitPauliSumMagicTensors.SweepDisentanglerMagicTensors.TrivialDisentanglerMagicTensors.apply!MagicTensors.apply_and_disentangle!MagicTensors.apply_to_clifford!MagicTensors.apply_to_clifford_dagger!MagicTensors.apply_to_mps!MagicTensors.conjugateMagicTensors.disentangle!MagicTensors.dmrg!MagicTensors.embedMagicTensors.entanglement_entropyMagicTensors.expectationMagicTensors.get_cliffordMagicTensors.get_clifford_copyMagicTensors.get_mpsMagicTensors.nsitesMagicTensors.stabilizer_entropyMagicTensors.transform!
Docstrings:
MagicTensors.MagicTensors — Module
MagicTensorsTODO
MagicTensors.AbstractCAMPS — Type
AbstractCAMPSInterface for Clifford Augmented Matrix Product States (CAMPS).
Description
AbstractCAMPS defines an supertype for Clifford Augmented Matrix Product States (CAMPS). A CAMPS is a ansatz for a pure quantum state of the form |ψ⟩ = C |MPS⟩, where C is a Clifford unitary, and |MPS⟩ is a matrix product state [TODO].
Required methods
For a CAMPS x implementations must support:
apply_to_mps!(x, args...; kwargs...): – appliesargs..., withkwargs...to the MPS part of the CAMPS.apply_to_clifford!(x, args...; kwargs...: – appliesargs..., withkwargs...to the Clifford part C of the CAMPS.apply_to_clifford_dagger!(x, args...; kwargs...: – appliesargs..., withkwargs...to the daggered Clifford part C† of the CAMPS.get_clifford(x): – returns (by reference) the Clifford unitaryC, which should be of the type<:AbstractCliffordUnitary.get_clifford_copy(x): – returns a copy of the Clifford unitaryC, which should be of the type<:AbstractCliffordUnitary.get_mps(x): – returns (by reference) the matrix product state part of the CAMPS as anITensorMPS.MPSobject.
References
- TODO
See also
MagicTensors.AbstractCliffordGate — Type
AbstractCliffordGateAbstract supertype for few-qubit/qudit Clifford gates that can act both within the stabilizer formalism and as explicit unitary matrices in the computational basis.
Description
AbstractCliffordGate defines an abstract interface for Clifford gates that act on a few qubit or qudit systems. While Clifford gates are in principle Clifford unitaries, they are not a subtype of AbstractCliffordUnitary because they fulfil a different role in the logic of the MagicTensors package. AbstractCliffordGate objects constitute the bridge between tensor networks and the stabilizer formalism because they can act on a Clifford unitary (stabilizer formalism) and they can return their explicit unitary matrix for use in tensor networks. In practice, the latter restricts the employability of AbstractCliffordGate objects to only a few sites.
Required methods
For a Clifford gates x, y and compatible Clifford unitary C, implementations must support:
Base.:(==)(x,y) -> x==y: – returnstrueif the gatesxandyare identical,falseotherwise.Base.Matrix(x) -> M: – returns the gatexin the form of an explicit complex matrixM.apply!(C, x, sites) -> C': – applies gatextoCat sitessitesin-place, i.e. it replaces C → x C.nsites(x) -> n: – returns the numbernof qubits on which the gatexacts.
Notes
Types that implement this interface should be immutable.
See also
MagicTensors.AbstractCliffordGateSet — Type
AbstractCliffordGateSetAbstract supertype for a list of AbstractCliffordGate objects.
Description
AbstractCliffordGateSet defines an abstract interface for an iterable and enumerated list of Clifford gates (each acting on the same number of sites). Clifford gate sets are useful, for example, for brute force searches for disentangling Clifford circuits.
Required methods
For a Clifford gate set x implementations must support:
Base.getindex(x, i) -> gᵢ: – returns theith Clifford gategᵢin the setx.Base.length(x) -> K: – returns the number of gatesKin the setx.Base.one(x) -> I: – return the identity gate w.r.t. setx; the identityIneed not be inx.nsites(x) -> n: – returns the number of sitesnon which the gates in the set act.
See also
MagicTensors.AbstractCliffordUnitary — Type
AbstractCliffordUnitaryAbstract supertype for Clifford unitaries.
Description
AbstractCliffordUnitary defines an abstract interface for Clifford unitaries that operate on qubits, qudits, or potentially other quantum systems. Clifford unitaries map Pauli strings (AbstractPauli) to Pauli strings under conjugation. Implementations of AbstractCliffordUnitary should function even for a large system sizes by employing the stabilizer formalism.
Required methods
For a Clifford unitarys C and D, and compatible Pauli P (each acting on n sites) implementations must support:
ConcreteCliffordUnitary(n) -> Iₙ: – constructor for the identity unitary as a Clifford unitary, whereConcreteCliffordUnitary<:AbstractCliffordUnitary.Base.(==)(x,y) -> x==y: – returnstrueif the Pauli stringsxandyare identical,falseotherwise.Base.:*(C, D) -> C D: – returns the productC Dof Clifford unitariesCandD.Base.inv(C) -> C⁻¹: – returns the inverse ofC.apply!(D, C): – appliesCtoDin-place, i.e. subsitutesD → C D.conjugate(P, C) -> Q: – returns a PauliQ = C P C†with the same type asP.nsites(C) -> n: – returns the number of sitesn.
See also
MagicTensors.AbstractDisentangler — Type
AbstractDisentanglerTODO
MagicTensors.AbstractDmrgDisentangler — Type
AbstractDmrgDisentangler <: AbstractDisentanglerTODO
MagicTensors.AbstractLocalDisentangler — Type
AbstractLocalDisentangler <: AbstractDisentanglerTODO
Required methods
Implementations ConcreteLocalDisentangler<:AbstractLocalDisentangler must support:
disentangle!(de::ConcreteSweepDisentangler, camps::AbstractCAMPS, bond::Int, r::Bool) -> num, gain, info: – Lower the entanglement in the MPS part ofcampsbetween sitebondandbond +1by finding a transformation using thedemethod. Also, move the mps orthogonality center to sitebond+1whenr==trueand tobondotherwise.
MagicTensors.AbstractPauli — Type
AbstractPauliAbstract supertype for qubit/qudit Pauli strings that act on a system of qubits or qudits.
Description
AbstractPauli defines an abstract interface for Pauli strings acting on qubit or qudit systems.
Required methods
Implementations ConcretePauli<:AbstractPauli must support
ConcretePauli(n) -> x: – returns an identity Pauli stringxonnsites.Base.(==)(x,y) -> x==y: – returnstrueif the Pauli stringsxandyare identical,falseotherwise.Base.≈(x,y) -> x≈y: – returnstrueif the Pauli stringsxandyare the same, ignoring their phases,falseotherwise.Base.-(x) -> -x: – returns the Pauli string-x.embed(x, m, sites) -> y: – returns an Pauli string onm≥nsites, where the Pauli on siteiinxis put to sitesite[i]iny.nsites(x) -> n: – returns the number of sitesnthe Pauli string acts on.
Additional methods
Base.:*(x, y) -> x*y: – returns the product of two Pauli strings.
See also
MagicTensors.AbstractPauliSum — Type
AbstractPauliSumAbstract supertype for weighted unordered lists of Pauli strings.
Description
AbstractPauliSum defines an abstract interface for weighted unordered lists of Pauli strings. A Pauli sum x represents the sum over K Pauli strings Pᵢ weighted by αᵢ, i.e. x = ∑ αᵢ Pᵢ.
Required methods
Concrete implimentations ConcretePauliSum<:AbstractPauliSum must support:
ConcretPauliSum(n): – constructor returning and empty (K=0) Pauli sum onnsites.Base.length(x) -> K: – returns the number of Pauli stringsKin the sum.Base.push!(x, P, α): – adds a Pauli stringPwith the given coefficientαto the sum.Base.isapprox(x,y; kwargs...) -> x≈y: – returnstrueif the Pauli stringsxandyare approximately equal (withkwargs...piped into the scalarisapproxfunction);falseotherwise.Base.(==)(x,y) -> x==y: – returnstrueif the Pauli sumsxandyare equal,falseotherwise.embed(x, m, sites) -> y: – returns an Pauli sum onm≥nsites, where each Pauli on siteiinxis put to sitesite[i]iny.nsites(x) -> n: – returns the numbernof qubits/qudits on which the Pauli strings in the sum act.ITensorMPS.MPO(x, sites) -> mpo: – returns the Pauli sum as an ITensorMPS.MPO on the site indicessites.
Additional methods
For Pauli sums x, y, and scalar α it may be necessary for some applications to also implement the following methods:
- Simple arithmethic:
-x,x+y,x-y,α*x, andx/α, wherexandymay also be plainQubitPauliobjects. Base.:*(x, y) -> x*y: – returns the product of two Pauli sums.LinearAlgebra.adjoint(x) -> x†: – returns the adjoint of the Pauli sum.LinearAlgebra.conj(x) -> x̅: – returns the complex conjugate of the Pauli sum.LinearAlgebra.transpose(x) -> xᵀ: – returns the transpose of the Pauli sum.LinearAlgebra.ishermitian(x): – returnstrueif the Pauli sum is Hermitian, andfalseotherwise.
See also
MagicTensors.AbstractStandAloneDisentangler — Type
AbstractStandAloneDisentangler <: AbstractDisentanglerTODO
Required methods
Implementations ConcreteStandAloneDisentangler<:AbstractStandAloneDisentangler must support:
disentangle!(de::ConcreteStandAloneDisentangler, camps::AbstractCAMPS) -> num, gain, info: – Lower the entanglement in the MPS part ofcampsby finding a transformation using thedemethod.
MagicTensors.GreedyDisentangler — Type
GreedyDisentanglerTODO
MagicTensors.IterativeDisentangler — Type
IterativeDisentanglerTODO
MagicTensors.IterativeDmrgDisentangler — Type
IterativeDmrgDisentanglerTODO
MagicTensors.MetropolisDisentangler — Type
MetropolisDisentanglerTODO
MagicTensors.QubitCliffordGate — Type
QubitCliffordGate <: AbstractCliffordGateImplementation of AbstractCliffordGate for qubits using the QuantumClifford package.
See also
MagicTensors.QubitCliffordGateSet — Type
QubitCliffordGateSet{K, S} <: AbstractCliffordGateSetImplementation of AbstractCliffordGateSet for K qubits using the QuantumClifford package. The symbol S specifies the gate set variant:
QubitCliffordGateSet{K, :empty}: The emptyK-qubit Clifford gates set.QubitCliffordGateSet{K, :all}: AllK-qubit Clifford gates without phases.QubitCliffordGateSet{K, :full}: AllK-qubit Clifford gates with4^Kphase variants.QubitCliffordGateSet{2, :entangle}: 19 two-qubit Clifford gates with entangling properties, excluding the identity.
See also
MagicTensors.QubitCliffordUnitary — Type
QubitCliffordUnitary <: AbstractCliffordUnitaryImplementation of AbstractCliffordUnitary for qubit systems.
See also
MagicTensors.QubitPauli — Type
QubitPauli <: AbstractPauliImplementation of AbstractPauli for qubit systems using the QuantumClifford package.
QubitPauli objects are immutable with only a single field pauli::QuantumClifford.PauliOperator.
Constructors
QubitPauli(pauli::QuantumClifford.PauliOperator): – return the QubitPauli for a givenQuantumClifford.PauliOperator.QubitPauli(n::Int): – return an identity operator onnqubits.@QubitPauli_str(s::AbstractString): – macro, using the same String to Pauli conversion as inQuantumClifford.
Examples
- Basic
QubitPauliconstructors and operations:
julia> QubitPauli(3)
+ ___
julia> QubitPauli"-iIZXY"
-i_ZXY
julia> QubitPauli"iXYZ" == QubitPauli"XYZ"
false
julia> QubitPauli"iXYZ" ≈ QubitPauli"XYZ"
true
julia> QubitPauli"-XYZ" == -QubitPauli"XYZ"
true
julia> embed(QubitPauli"XYZ",5,[3,5,2])
+ _ZX_Y
julia> nsites(QubitPauli"-iIXI")
3- Conversion between
QuantumClifford.PauliOperatorandQubitPauli:
julia> using QuantumClifford: PauliOperator
julia> QubitPauli(PauliOperator(Bool[0,0,1,1], Bool[0,1,0,1]))
+ _ZXY
julia> PauliOperator(QubitPauli"IXYZ")
+ _XYZSee also
MagicTensors.QubitPauliSum — Type
QubitPauliSum <: AbstractPauliSumImplementation of AbstractPauliSum for qubit systems using the QuantumClifford package.
Constructors
QubitPauliSum(n::Int): – return an empty (complex) sum for a given number of qubitsn.QubitPauliSum(pauli::QubitPauli): – return aQubitPauliSumwith only a single Pauli string.QubitPauliSum(paulis::Vector{<:QubitPauli}, coeffs::Vector{<:Number}): – return a the sum ofQubitPaulispauliwith coefficientscoeffs.
Examples
- Basic
QubitPauliSumconstructors and operations:
julia> QubitPauliSum(3)
QubitPauliSum{ComplexF64, Vector{UInt64}} on 3 sites, with 0 terms:
julia> QubitPauliSum(QubitPauli"XXI")
QubitPauliSum{ComplexF64, Vector{UInt64}} on 3 sites, with 1 terms:
(+1.000000e+00 +0.000000e+00im) + XX_
julia> x = QubitPauliSum([QubitPauli(3), QubitPauli"XXI"], [0.5, -0.5])
QubitPauliSum{ComplexF64, Vector{UInt64}} on 3 sites, with 2 terms:
(+5.000000e-01 +0.000000e+00im) + ___
(-5.000000e-01 +0.000000e+00im) + XX_
julia> embed(x,5,[1,3,5])
QubitPauliSum{ComplexF64, Vector{UInt64}} on 5 sites, with 2 terms:
(+5.000000e-01 +0.000000e+00im) + _____
(-5.000000e-01 +0.000000e+00im) + X_X__
julia> nsites(x)
3
julia> length(x)
2- Arithmetic
julia> x = 0.5 *(QubitPauli(3) + QubitPauli"XXI")
QubitPauliSum{ComplexF64, Vector{UInt64}} on 3 sites, with 2 terms:
(+5.000000e-01 +0.000000e+00im) + ___
(+5.000000e-01 +0.000000e+00im) + XX_
julia> push!(x, QubitPauli"IIZ", 0.1im)
QubitPauliSum{ComplexF64, Vector{UInt64}} on 3 sites, with 3 terms:
(+5.000000e-01 +0.000000e+00im) + ___
(+0.000000e+00 +1.000000e-01im) + __Z
(+5.000000e-01 +0.000000e+00im) + XX_
julia> x = x + 0.3*QubitPauli"IIZ"
QubitPauliSum{ComplexF64, Vector{UInt64}} on 3 sites, with 3 terms:
(+5.000000e-01 +0.000000e+00im) + ___
(+3.000000e-01 +1.000000e-01im) + __Z
(+5.000000e-01 +0.000000e+00im) + XX_
julia> 2*x-QubitPauli(3) ≈ (0.6+0.2im)*QubitPauli"IIZ" + QubitPauli"XXI"
true- Convert to
ITensorMPS.OpSum:
julia> using ITensorMPS: OpSum
julia> OpSum((0.6+0.2im)*QubitPauli"IIZ" + QubitPauli"XXI")
sum(
0.6 + 0.2im Z(3,)
1.0 X(1,) X(2,)
)See also
MagicTensors.SweepDisentangler — Type
SweepDisentangler <: AbstractStandAloneDisentanglerTODO
MagicTensors.TrivialDisentangler — Type
TrivialDisentanglerTODO
MagicTensors.apply! — Function
apply!TODO
MagicTensors.apply_and_disentangle! — Function
apply_and_disentangle!TODO
MagicTensors.apply_to_clifford! — Function
apply_to_clifford!TODO
MagicTensors.apply_to_clifford_dagger! — Function
apply_to_clifford_dagger!TODO
MagicTensors.apply_to_mps! — Function
apply_to_mps!TODO
MagicTensors.conjugate — Function
conjugate(P, C) -> QReturns the conjugation of an Pauli string or Pauli sum by a Clifford unitary.
Description
Computes Q = C P C†, where C is a Clifford unitary and P is a Pauli string or Pauli sum. The result Q is a Pauli string or Pauli sum of the same type as P.
Arguments
P::Union{AbstractPauli, AbstractPauliSum}: – A Pauli string or Pauli sum to be conjugated.C::AbstractCliffordUnitary: – A Clifford unitary to conjugate with.
Returns
Q::Union{AbstractPauli, AbstractPauliSum}: – The conjugated Pauli string or Pauli sumC P C†.
See also
MagicTensors.disentangle! — Function
disentangle!TODO
MagicTensors.dmrg! — Function
dmrg!TODO
MagicTensors.embed — Function
embedTODO
MagicTensors.entanglement_entropy — Function
entanglement_entropyTODO
MagicTensors.expectation — Function
expectationTODO
MagicTensors.get_clifford — Function
get_cliffordTODO
MagicTensors.get_clifford_copy — Function
get_clifford_copyTODO
MagicTensors.get_mps — Function
get_mpsTODO
MagicTensors.nsites — Function
nsites(obj) -> nReturns the number of qubit or qudit sites n in an object.
Description
Returns the number of qubits or qudits in an object obj.
Objects obj may be any of the following types: - AbstractCAMPS - AbstractCliffordGate - AbstractCliffordGateSet - AbstractCliffordUnitary - AbstractPauli - AbstractPauliSum - ITensorMPS.MPS
Arguments
obj: – Object acting on or representing a certain number of qubits or qudits.
Returns
n::Int: – Number of qubits or qudits in objectobj.
See also
MagicTensors.stabilizer_entropy — Function
stabilizer_entropyTODO
MagicTensors.transform! — Function
transform!TODO: write docstring.