qulacs / qulacs-rtd

Qulacs documentation for readthedocs. Configured to support automatically generate C++/Python API, and internationalization.
MIT License
3 stars 3 forks source link

English VQE documentation return value of cost function change #28

Open L-git-tech opened 3 years ago

L-git-tech commented 3 years ago

In the documentation, subchapter "Define VQE cost function" (http://docs.qulacs.org/en/latest/apply/6.2_vqe.html#Define-VQE-cost-function) the return value of the cost function should be np.real(qulacs_hamiltonian.get_expectation_value(state)) instead of qulacs_hamiltonian.get_expectation_value(state). This is because of the scipy.optimize.minimize function in http://docs.qulacs.org/en/latest/apply/6.2_vqe.html#Run-VQE, which expects a cost function returning a float not a complex number.