qiskit-community / qiskit-aqua

Quantum Algorithms & Applications (**DEPRECATED** since April 2021 - see readme for more info)
https://qiskit.org/aqua
Apache License 2.0
572 stars 376 forks source link

AQGD gradient computations wrong for circuits using one parameter in > 1 gate #588

Closed xmax1 closed 3 years ago

xmax1 commented 5 years ago

Informations

What is the current behavior?

Computes wrong gradient for qaoa. qiskit > aqua > components > optimizers > aqgd > deriv line 101 Computes the parameter shift rule for the params. Does not include the product rule for when one parameter is used for more than one gate.

Steps to reproduce the problem

Init qaoa circuit Compute gradient Compare with actual gradient (using, say, pennylane)

What is the expected behavior?

Uses product rule

Suggested solutions

Use the product rule

chunfuchen commented 5 years ago

@Nick-Singstock do you have any thought?

woodsp-ibm commented 3 years ago

@BryceFuller I believe the new gradient logic that has just been added has product rule support. Presumably this issue could be addressed by allowing AQGD to support a gradient function that was passed in rather than just ignore it as today. Any thoughts - would the gradient need to be typed checked here to ensure it was an analytic gradient? Is this something you might be able to take a look at?

pbark commented 3 years ago

Taging also @adekusar-drl to give his opinion on this.

woodsp-ibm commented 3 years ago

Closing as there is a issue now opened in Terra to fix this in conjunction with the gradient framework that did not exist at the time.