[BUG] qml.ctrl
does not modify parameter_frequencies
correctly
#4898
Labels
bug 🐛
Something isn't working
qml.ctrl
does not modify parameter_frequencies
correctly
#4898
Expected behavior
qml.ctrl(op)
can be differentiated with the parameter-shift rule ifop
can be differentiated with the parameter-shift rule.The differentiation yields the correct derivative.
Actual behavior
The differentiation of
qml.ctrl(op)
will be wrong whenever the generator of the original op is aSparseHamiltonian
and has more than 1 eigenvalue.Additional information
This is because
qml.eigvals
is used to compute theparameter_frequencies
ofqml.ctrl(op)
andqml.eigvals
has a kwargk
, which defaults to 1 and determines the number of eigenvalues that are being computed forSparseHamiltonian
inputs.Source code
Tracebacks
No response
System information
Existing GitHub issues
The text was updated successfully, but these errors were encountered: