0

If I build a state

from qutip import Bloch,basis
state=(basis(2,0)+(0+1j)*basis(2,1)).unit()

can I trasform it in a bloch-sphere vector?

In this form:

state -> vec=np.array
Rarblack
  • 4,559
  • 4
  • 22
  • 33
A.A.
  • 1
  • 3

1 Answers1

0

it's possible to convert a 2dvector in C(2) into a vector in R(3) living inside the bloch-sphere using this code:

from qutip.operators import sigmax, sigmay, sigmaz

def extract_vec(v):
    v=[v]
    vector=[]
    for i in v:
        vector.append([
            expect(sigmax(),i),
            expect(sigmay(),i),
            expect(sigmaz(),i)     
        ])
    return(vector)

3d_vec=extract_vec(state)
Andreas K.
  • 9,282
  • 3
  • 40
  • 45
A.A.
  • 1
  • 3