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 permute to re-order the tensor (Kronecker) product #95

Closed
ytdHuang opened this issue May 2, 2024 · 5 comments · Fixed by #152
Closed

Support permute to re-order the tensor (Kronecker) product #95

ytdHuang opened this issue May 2, 2024 · 5 comments · Fixed by #152
Assignees
Labels
enhancement New feature or request UnitaryHack2024 UnitaryHack 2024

Comments

@ytdHuang
Copy link
Member

ytdHuang commented May 2, 2024

Support the function permute in QuTiP, something like:

function permute(A::QuantumObject, order::Vector{Int}) ... end

a = Qobj(rand(2, 2))
b = Qobj(rand(3, 3))
c = Qobj(rand(4, 4))
d = Qobj(rand(5, 5))
abcd = tensor(a, b, c, d)

permute(abcd, [4, 1, 3, 2]) == tensor(d, a, c, b) # true

Should support for the following types of quantum object:

@ytdHuang ytdHuang added enhancement New feature or request UnitaryHack2024 UnitaryHack 2024 labels May 3, 2024
@aarontrowbridge
Copy link
Contributor

the tensor or kron function, seems to be only defined for Kets, Bras, and Operators, is it still necessary to write methods for the super operators

@albertomercurio
Copy link
Member

I can’t figure out what a tensor product between two superoperators should make, physically. So, I think that the definition of tensor product on the superoperators is meaningless

@aarontrowbridge
Copy link
Contributor

It is defined in the qutip permute for these types but i'm not sure how to think about them either atm.

@ytdHuang
Copy link
Member Author

ytdHuang commented May 31, 2024

@albertomercurio @aarontrowbridge

There are some rare situations which we want the SuperOperator to be in block matrix form (easier to analyze the dynamics in some specific topics).

Consider a Operator with sub-systems $A$ and $B$ ($\mathcal{H}_A \otimes \mathcal{H}_B$). The Hilbert space of it's corresponding SuperOperator could be written as:

$$\mathcal{H}_A \otimes \mathcal{H}_B \otimes \mathcal{H}_{A'} \otimes \mathcal{H}_{B'}$$

What I have in my mind is some functions that allow me to obtain the SuperOperator with the following Hilbert space order:

$$\mathcal{H}_A \otimes \mathcal{H}_{A'} \otimes \mathcal{H}_B \otimes \mathcal{H}_{B'}$$

But this could actually be done by transferring the SuperOperator back to Operator form, apply the permute, and then transfer it back to SuperOperator type:

A = Qobj(rand(NA, NA))
B = Qobj(rand(NB, NB))
AB = tensor(A, B)
S = spre(AB) # super operator

op1 = Qobj(S, type = Operator, dims = [NA, NB, NA, NB])
op2 = permute(op1, [1, 3, 2, 4])
S_new = Qobj(op2, type = SuperOperator, dims = [NA, NB])

So, yes !
I think for current stage, we can just focus on permute for Ket, Bra, and Operator types of QuantumObject.

@aarontrowbridge
Copy link
Contributor

@ytdHuang thanks for the feedback! I'm in the process of making all of the changes you suggested. I'm in the process of groking what's going on in the ptrace function as it relates to permutations, it is definitely a more elegant approach than mine!

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