【问题标题】:on qutip is it possible to transform a state to vector?在 qutip 上是否可以将状态转换为向量?
【发布时间】:2019-04-01 06:17:51
【问题描述】:

如果我建立一个国家

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

我可以在 bloch-sphere 向量中对其进行转换吗?

以这种形式:

state -> vec=np.array

【问题讨论】:

    标签: python quantum-computing qutip


    【解决方案1】:

    可以使用以下代码将 C(2) 中的 2dvector 转换为 R(3) 中位于 bloch-sphere 内的向量:

    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)
    

    【讨论】:

    • expect() 函数是什么?另外,3d_vec 不是正确的 Python 语法...
    猜你喜欢
    • 1970-01-01
    • 2020-05-10
    • 1970-01-01
    • 2022-10-19
    • 2022-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    相关资源
    最近更新 更多