Skip to content
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

Support type = Composed quantum objects #271

Open
ytdHuang opened this issue Oct 21, 2024 · 0 comments
Open

Support type = Composed quantum objects #271

ytdHuang opened this issue Oct 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ytdHuang
Copy link
Member

ytdHuang commented Oct 21, 2024

Problem Description

In QuTiP, the dims describes the Hilbert space information separately for left and right basis of the Operator, where QuantumToolbox.jl does not.

Here, I suggest a new type ComposedQuantumObject (not necessary to be this name), where the definition is as follows

struct ComposedQuantumObject{NL<:Int,NR<:Int} <: QuantumObjectType 
    Ldims::SVector{NL,Int}
    Rdims::SVector{NR,Int}
end
Base.show(io::IO, ::ComposedQuantumObject) = print(io, "Composed")
Composed(Ldims::SVector{N,Int}, Rdims::SVector{N,Int}) where {N<:Int} = ComposedQuantumObject(Ldims, Rdims)

This allows us to support some usage for special purpose.

Proposed Solution

Let me explain it by the following example, partial trace (although we already have ptrace, but I just want to show how I expect type = Composed would work) :

# suppose we have two subsystems A and B
NA = 4
NB = 2
IB = qeye(NB)
rhoAB = rand_dm((NA, NB))
basis_list = [ tensor(basis(NA, i), IB) for i in 0:(NA-1)]

The partial trace can actually be obtained as

$$\rho_B = \textrm{Tr}_A [\rho_{AB}] = \sum_{i = 0}^{N_A - 1} \langle i |_A \otimes \mathbb{1}_B \cdot \rho_{AB} \cdot | i \rangle_A \otimes \mathbb{1}_B.$$

That is,

rhoB = Qobj(zeros(ComplexF64, NB, NB))
for bl in basis_list
    for br in basis_list
        rhoB += bl' * rhoAB * br
    end
end

rhoB  ptrace(rhoAB, 2)

The main thing is to support some basic functions like

  • kron for two different Qobj type
  • adjoint of Composed
  • * between Operator and Composed -> Composed
  • * between Composed and Composed -> Operator

Alternate Solutions

No response

Additional Context

No response

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

No branches or pull requests

1 participant