QuantumToolbox.jl icon indicating copy to clipboard operation
QuantumToolbox.jl copied to clipboard

Support different representations for `SuperOperator`

Open ytdHuang opened this issue 7 months ago • 0 comments

In QuTiP, the superoperators have different representations:

  • general representation
  • Choi representation
  • Kraus representation
  • Stinespring representation
  • Chi representation

Maybe we can make a new abstract type AbstractSuperRepresentation, and re-define the superoperator:

abstract type AbstractSuperRepresentation end

struct GeneralSuperRepresentation <: AbstractSuperRepresentation end
struct ChoiSuperRepresentation <: AbstractSuperRepresentation end
struct KrausSuperRepresentation <: AbstractSuperRepresentation end
struct StinespringSuperRepresentation <: AbstractSuperRepresentation end
struct ChiSuperRepresentation <: AbstractSuperRepresentation end

struct SuperOperatorQuantumObject <: QuantumObjectType
    superrep::AbstractSuperRepresentation
end

# default representation
SuperOperatorQuantumObject() = SuperOperatorQuantumObject(GeneralSuperRepresentation())

const SuperOperator = SuperOperatorQuantumObject()
const ChoiSuperOperator = SuperOperatorQuantumObject(ChoiSuperRepresentation())
const KrausSuperOperator = SuperOperatorQuantumObject(KrausSuperRepresentation())
const StinespringSuperOperator = SuperOperatorQuantumObject(StinespringSuperRepresentation())
const ChiSuperOperator = SuperOperatorQuantumObject(ChiSuperRepresentation())

When the users apply the basic operations (:+, :-, :*) between GeneralSuperRepresentation and other representation, it should work. However, if the users apply them on different representations, it should print a warning message just like qutip.

function Base.:(==)(S1::SuperOperatorQuantumObject, S2::SuperOperatorQuantumObject)
    if (S1 != S2)
        if !(S1 == SuperOperator || S2 == SuperOperator)
            # print warning
        end
    end
    return true
end

Also need to define some new functions same as qutip:

  • superrep(Q) (return superrep of Qobj)
  • to_super(Q)
  • to_choi(Q)
  • to_kraus(Q)
  • to_stinespring(Q)
  • to_chi(Q)
  • iscp(Q)
  • istp(Q)
  • ishp(Q)
  • iscptp(Q)

ytdHuang avatar Jun 28 '24 05:06 ytdHuang