How to use the pyqpanda.Algorithm.fragments.parity_check_circuit function in pyqpanda

To help you get started, we’ve selected a few pyqpanda examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OriginQ / QPanda-2 / pyQPanda / pyqpanda / Algorithm / hamiltonian_simulation.py View on Github external
`QPanda Algorithm API`\n
    Simulating z-only term like H=coef * (Z0..Zn-1)\n
    U=exp(-iHt)\n
    \n
    list, float, float -> QCircuit

    Note: Z-Hamiltonian spreads over the qubit_list
    '''
    prog=QCircuit()

    # parity-check
    # RZ(theta)
    # parity-check

    if len(qubit_list) > 1:
        prog.insert(parity_check_circuit(qubit_list))\
            .insert(RZ(qubit_list[-1],coef*t))\
            .insert(parity_check_circuit(qubit_list))
    else:
        if len(qubit_list)!=0:
            prog.insert(RZ(qubit_list[0],coef*t))

    return prog
github OriginQ / QPanda-2 / pyQPanda / pyqpanda / Algorithm / hamiltonian_simulation.py View on Github external
U=exp(-iHt)\n
    \n
    list, float, float -> QCircuit

    Note: Z-Hamiltonian spreads over the qubit_list
    '''
    prog=QCircuit()

    # parity-check
    # RZ(theta)
    # parity-check

    if len(qubit_list) > 1:
        prog.insert(parity_check_circuit(qubit_list))\
            .insert(RZ(qubit_list[-1],coef*t))\
            .insert(parity_check_circuit(qubit_list))
    else:
        if len(qubit_list)!=0:
            prog.insert(RZ(qubit_list[0],coef*t))

    return prog