Skip to content

Support different representations for SuperOperator #181

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

Open
ytdHuang opened this issue Jun 28, 2024 · 3 comments
Open

Support different representations for SuperOperator #181

ytdHuang opened this issue Jun 28, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ytdHuang
Copy link
Member

ytdHuang commented Jun 28, 2024

In QuTiP, the superoperators have different representations:

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

Note that Kraus and Stinespring representations are just a list of Operators.

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 ChiSuperRepresentation <: AbstractSuperRepresentation end

struct SuperOperatorQuantumObject{T<:AbstractSuperRepresentation} <: QuantumObjectType
    superrep::T
end

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

const SuperOperator = SuperOperatorQuantumObject()
const ChoiSuperOperator = SuperOperatorQuantumObject(ChoiSuperRepresentation())
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.:(==)(::SuperOperatorQuantumObject{T1}, ::SuperOperatorQuantumObject{T2}) where {T1<:AbstractSuperRepresentation,T2<:AbstractSuperRepresentation}
    (T1 != T2) && @warn "warning message"
    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 ytdHuang added enhancement New feature or request good first issue Good for newcomers labels Jun 28, 2024
@ytdHuang ytdHuang changed the title Implement different superoperator representations Support different representations for SuperOperator Jun 28, 2024
@ANUKOOL324
Copy link

allow me to look on this issue @ytdHuang

@ytdHuang
Copy link
Member Author

ytdHuang commented May 14, 2025

@ANUKOOL324
Sure, but this issue was posted a long time before.

We now have modified the structure of QuantumObjectType, please refer to this source file.

Basically, we have already defined an

abstract SuperOperatorType <: QuantumObjectType

for different representation, and we currently only have

struct SuperOperator <: SuperOperatorType end

to represent the general superoperator representation.

I think you can start from defining

struct ChoiSuperOperator <: SuperOperatorType end
struct ChiSuperOperator <: SuperOperatorType end

@ytdHuang
Copy link
Member Author

issue #270 is also the same topic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants