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

Unnormalized basis used in Chi representation #2259

Open
Rumoa opened this issue Nov 6, 2023 · 0 comments
Open

Unnormalized basis used in Chi representation #2259

Rumoa opened this issue Nov 6, 2023 · 0 comments

Comments

@Rumoa
Copy link

Rumoa commented Nov 6, 2023

Bug Description

The Chi representation of channels is introduced in the documentation using an orthonormal basis, which happens to be the {Eye(2), Pauli matrices} / sqrt(2) for the case of a qubit.
However, the implementation in the code uses an unnormalized one, yielding wrong results.

In the file superops_reps.py, the variable _SINGLE_QUBIT_PAULI_BASIS is defined as:

_SINGLE_QUBIT_PAULI_BASIS = (
    identity(2).to(_data.CSR),
    sigmax().to(_data.CSR),
    sigmay().to(_data.CSR),
    sigmaz().to(_data.CSR),
)

Code to Reproduce the Bug

import numpy as np
import qutip as qu

#Let's compute the chi matrix for  F(rho) = -i[H, rho] for one qubit 
#We define the channel F(rho) = A_1 rho B^dag_1 + A_2 rho B^dag_2
#where 
#A_1 = -iH,   B^dag_1 = Id(2) 
#A_2 = Id(2), B^dag_2 = iH

#With an example Hamiltonian

delta = 0.127
Omega = 0.5
H = qu.Qobj(np.array([[delta, Omega/2], [Omega/2, 0]]))

print(H)

#We define the Pauli basis as G =  (Id(2), sigmax(2), sigmay(2), sigmaz(2))/np.sqrt(2)

G = np.array([qu.identity(2), qu.sigmax(), qu.sigmay(), qu.sigmaz()])/np.sqrt(2)



#The chi matrix is computed as: chi[i][j] = sum_k Tr(G[i]@A[k]) Tr(G[j]@B^dag[k])

chi = np.zeros([4, 4], dtype=np.complex64)
for i in range(4):
    for j in range(4):
        chi[i,j] = np.trace(G[i]@A[0])*np.trace(G[j]@Bdag[0]) + np.trace(G[i]@A[1])*np.trace(G[j]@Bdag[1])
 
print(chi)

#If we compare with the method from qutip, we see that the latter is off by a factor of 2

print(qu.to_chi(qu.liouvillian(H)))

Code Output

Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
Qobj data =
[[0.127 0.25 ]
 [0.25  0.   ]]
[[0.+0.j    0.+0.5j   0.+0.j    0.+0.127j]
 [0.-0.5j   0.+0.j    0.+0.j    0.+0.j   ]
 [0.+0.j    0.+0.j    0.+0.j    0.+0.j   ]
 [0.-0.127j 0.+0.j    0.+0.j    0.+0.j   ]]
Quantum object: dims = [[[2], [2]], [[2], [2]]], shape = (4, 4), type = super, isherm = True, superrep = chi
Qobj data =
[[0.+0.j    0.+1.j    0.+0.j    0.+0.254j]
 [0.-1.j    0.+0.j    0.+0.j    0.+0.j   ]
 [0.+0.j    0.+0.j    0.+0.j    0.+0.j   ]
 [0.-0.254j 0.+0.j    0.+0.j    0.+0.j   ]]

Expected Behaviour

The result in the Chi representation is off by a factor of 2

Your Environment

QuTiP Version:      4.7.3
Numpy Version:      1.26.0
Scipy Version:      1.11.3
Cython Version:     None
Matplotlib Version: None
Python Version:     3.11.6
Number of CPUs:     12
BLAS Info:          Generic
OPENMP Installed:   False
INTEL MKL Ext:      False
Platform Info:      Linux (x86_64)

Additional Context

I don't know if I am missing something here with the dimensions of the objects.

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

No branches or pull requests

1 participant