• Koseipanorama_fish_eye
    8 posts
    3 years

    I am trying to construct a parametrized circuit in qiskit, or a parametrized QAOA, which means I need to define a list of parameters. Currently I need to construct it one by one using

    theta = Parameter('θ')
    

    Is there a more efficient way that I can create n number of parameters?

  • BrownBpanorama_fish_eye
    4 posts
    3 years

    You can use ParameterVector to create a list of parameters.

    from qiskit.circuit import ParameterVector, QuantumCircuit
    theta = ParameterVector('θ', 4)
    qc = QuantumCircuit(4)
    for i in range(4):
        qc.rx(theta[i],i)
    qc.draw()
    

    image.png

    Then bind the values:

    qc = qc.bind_parameters({theta: [2,3,4,5]})
    qc.draw()
    

    image.png

    image.png

    PNG, 14.1 KB, uploaded by BrownB 3 years ago.

    image.png

    PNG, 15.5 KB, uploaded by BrownB 3 years ago.

  • arrow_forward

    Thread has been moved from Quantum Computing Software.

There are no more posts in this thread.

first_page
chevron_left
chevron_right
last_page