Full API

Index:

Docstrings:

MagicTensors.AbstractCAMPSType
AbstractCAMPS

Interface 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...): – applies args..., with kwargs... to the MPS part of the CAMPS.
  • apply_to_clifford!(x, args...; kwargs...: – applies args..., with kwargs... to the Clifford part C of the CAMPS.
  • apply_to_clifford_dagger!(x, args...; kwargs...: – applies args..., with kwargs... to the daggered Clifford part C† of the CAMPS.
  • get_clifford(x): – returns (by reference) the Clifford unitary C, which should be of the type <:AbstractCliffordUnitary.
  • get_clifford_copy(x): – returns a copy of the Clifford unitary C, which should be of the type <:AbstractCliffordUnitary.
  • get_mps(x): – returns (by reference) the matrix product state part of the CAMPS as an ITensorMPS.MPS object.

References

  1. TODO

See also

source
MagicTensors.AbstractCliffordGateType
AbstractCliffordGate

Abstract 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: – returns true if the gates x and y are identical, false otherwise.
  • Base.Matrix(x) -> M: – returns the gate x in the form of an explicit complex matrix M.
  • apply!(C, x, sites) -> C': – applies gate x to C at sites sites in-place, i.e. it replaces C → x C.
  • nsites(x) -> n: – returns the number n of qubits on which the gate x acts.

Notes

Types that implement this interface should be immutable.

See also

source
MagicTensors.AbstractCliffordGateSetType
AbstractCliffordGateSet

Abstract 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 the ith Clifford gate gᵢ in the set x.
  • Base.length(x) -> K: – returns the number of gates K in the set x.
  • Base.one(x) -> I: – return the identity gate w.r.t. set x; the identity I need not be in x.
  • nsites(x) -> n: – returns the number of sites n on which the gates in the set act.

See also

source
MagicTensors.AbstractCliffordUnitaryType
AbstractCliffordUnitary

Abstract 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, where ConcreteCliffordUnitary<:AbstractCliffordUnitary.
  • Base.(==)(x,y) -> x==y: – returns true if the Pauli strings x and y are identical, false otherwise.
  • Base.:*(C, D) -> C D: – returns the product C D of Clifford unitaries C and D.
  • Base.inv(C) -> C⁻¹: – returns the inverse of C.
  • apply!(D, C): – applies C to D in-place, i.e. subsitutes D → C D.
  • conjugate(P, C) -> Q: – returns a Pauli Q = C P C† with the same type as P.
  • nsites(C) -> n: – returns the number of sites n.

See also

source
MagicTensors.AbstractLocalDisentanglerType
AbstractLocalDisentangler <: AbstractDisentangler

TODO

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 of camps between site bond and bond +1 by finding a transformation using the de method. Also, move the mps orthogonality center to site bond+1 when r==true and to bond otherwise.
source
MagicTensors.AbstractPauliType
AbstractPauli

Abstract 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 string x on n sites.
  • Base.(==)(x,y) -> x==y: – returns true if the Pauli strings x and y are identical, false otherwise.
  • Base.≈(x,y) -> x≈y: – returns true if the Pauli strings x and y are the same, ignoring their phases, false otherwise.
  • Base.-(x) -> -x: – returns the Pauli string -x.
  • embed(x, m, sites) -> y: – returns an Pauli string on m≥n sites, where the Pauli on site i in x is put to site site[i] in y.
  • nsites(x) -> n: – returns the number of sites n the Pauli string acts on.

Additional methods

  • Base.:*(x, y) -> x*y: – returns the product of two Pauli strings.

See also

source
MagicTensors.AbstractPauliSumType
AbstractPauliSum

Abstract 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 on n sites.
  • Base.length(x) -> K: – returns the number of Pauli strings K in the sum.
  • Base.push!(x, P, α): – adds a Pauli string P with the given coefficient α to the sum.
  • Base.isapprox(x,y; kwargs...) -> x≈y: – returns true if the Pauli strings x and y are approximately equal (with kwargs... piped into the scalar isapprox function); false otherwise.
  • Base.(==)(x,y) -> x==y: – returns true if the Pauli sums x and y are equal, false otherwise.
  • embed(x, m, sites) -> y: – returns an Pauli sum on m≥n sites, where each Pauli on site i in x is put to site site[i] in y.
  • nsites(x) -> n: – returns the number n of 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 indices sites.

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, and x/α, where x and y may also be plain QubitPauli objects.
  • 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): – returns true if the Pauli sum is Hermitian, and false otherwise.

See also

source
MagicTensors.AbstractStandAloneDisentanglerType
AbstractStandAloneDisentangler <: AbstractDisentangler

TODO

Required methods

Implementations ConcreteStandAloneDisentangler<:AbstractStandAloneDisentangler must support:

  • disentangle!(de::ConcreteStandAloneDisentangler, camps::AbstractCAMPS) -> num, gain, info: – Lower the entanglement in the MPS part of camps by finding a transformation using the de method.
source
MagicTensors.QubitCliffordGateSetType
QubitCliffordGateSet{K, S} <: AbstractCliffordGateSet

Implementation of AbstractCliffordGateSet for K qubits using the QuantumClifford package. The symbol S specifies the gate set variant:

  • QubitCliffordGateSet{K, :empty}: The empty K-qubit Clifford gates set.
  • QubitCliffordGateSet{K, :all}: All K-qubit Clifford gates without phases.
  • QubitCliffordGateSet{K, :full}: All K-qubit Clifford gates with 4^K phase variants.
  • QubitCliffordGateSet{2, :entangle}: 19 two-qubit Clifford gates with entangling properties, excluding the identity.

See also

source
MagicTensors.QubitPauliType
QubitPauli <: AbstractPauli

Implementation 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 given QuantumClifford.PauliOperator.
  • QubitPauli(n::Int): – return an identity operator on n qubits.
  • @QubitPauli_str(s::AbstractString): – macro, using the same String to Pauli conversion as in QuantumClifford.

Examples

  • Basic QubitPauli constructors 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.PauliOperator and QubitPauli:
julia> using QuantumClifford: PauliOperator

julia> QubitPauli(PauliOperator(Bool[0,0,1,1], Bool[0,1,0,1]))
+ _ZXY

julia> PauliOperator(QubitPauli"IXYZ")
+ _XYZ

See also

source
MagicTensors.QubitPauliSumType
QubitPauliSum <: AbstractPauliSum

Implementation of AbstractPauliSum for qubit systems using the QuantumClifford package.

Constructors

  • QubitPauliSum(n::Int): – return an empty (complex) sum for a given number of qubits n.
  • QubitPauliSum(pauli::QubitPauli): – return a QubitPauliSum with only a single Pauli string.
  • QubitPauliSum(paulis::Vector{<:QubitPauli}, coeffs::Vector{<:Number}): – return a the sum of QubitPaulis pauli with coefficients coeffs.

Examples

  • Basic QubitPauliSum constructors 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

source
MagicTensors.conjugateFunction
conjugate(P, C) -> Q

Returns 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 sum C P C†.

See also

source
MagicTensors.nsitesFunction
nsites(obj) -> n

Returns 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 object obj.

See also

source