You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Variational Quantum Deflation algorithm has an attribute self._callback which is never used in vqd.solve().
Inspired by the code for the VQE algorithm, the callback should be called in the energy_evaluation() call.
It also seems interesting that the callback also informs the user of the current step (VQD runs k steps of VQE).
Currently, the test test_callback checks the equality of empty lists
history = {'eval_count': [], 'parameters': [], 'mean': [], 'std': []}
The change would consist in adding the following lines during the call of the energy_evaluation(). These lines were taken from the VQE algorithm.
if self._callback is not None:
variance = np.real(expectation.compute_variance(sampled_expect_op))
estimator_error = np.sqrt(variance / self.quantum_instance.run_config.shots)
for i, param_set in enumerate(parameter_sets):
self._eval_count += 1
self._callback(self._eval_count, param_set, means[i], estimator_error[i], step)
else:
self._eval_count += len(means)
What should we add?
The Variational Quantum Deflation algorithm has an attribute
self._callback
which is never used invqd.solve()
.Inspired by the code for the VQE algorithm, the callback should be called in the
energy_evaluation()
call.It also seems interesting that the callback also informs the user of the current step (VQD runs k steps of VQE).
Currently, the test
test_callback
checks the equality of empty listsThe change would consist in adding the following lines during the call of the
energy_evaluation()
. These lines were taken from the VQE algorithm.Giving
The text was updated successfully, but these errors were encountered: