Tomography.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:QGL 作者: BBN-Q 项目源码 文件源码
def create_tomo_blocks(qubits, numPulses, alignment='parallel'):
    '''
    Helper function to create the tomography pulse block in either parallel or serial.
    '''
    #Tomography pulse sets
    if numPulses == 4:
        tomoSet = [Id, X90, Y90, X]
    elif numPulses == 6:
        tomoSet = [Id, X90, X90m, Y90, Y90m, X]
    else:
        raise ValueError("Only able to handle numPulses=4 or 6")

    #Create all combinations of pulses for the number of qubits
    if alignment == 'parallel':
        return [reduce(operator.mul, [p(q) for p, q in zip(pulseSet, qubits)])
                for pulseSet in product(tomoSet, repeat=len(qubits))]
    elif alignment == 'serial':
        return [[p(q) for p, q in zip(pulseSet, qubits)]
                for pulseSet in product(tomoSet, repeat=len(qubits))]
    else:
        raise ValueError("Alignment must be either serial or parallel")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号