Binding parameters in qiskit

169 views Asked by At

when I want to bind parameters in circuit below, it gives error: CircuitError: 'Cannot bind parameters (theta, phi, landa, gama) not present in the circuit.'

theta_val=[rand_list]
phi_val=[rand_list]   
landa_val=[rand_list]
gama_val=[rand_list]  

gate = 0
for i in range(layer):
    for j, (control, target) in enumerate(cnot_pairs):
        # bind the initial parameter values
        bound_circuit =[circuit.bind_parameters(
    {theta: theta_val, phi: phi_val, landa: landa_val, gama: gama_val}) 
     for (theta_val, phi_val, landa_val, gama_val) in zip(theta_val, phi_val, landa_val, gama_val)]
        bound_circuit.cu(theta, phi, landa, gama, qreg_q[control], qreg_q[target])
        gate += 1

circuit.draw(output='mpl')

i want to bind these parameters and use to optimize the circuit.

0

There are 0 answers