Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VQE implementation with estimator primitive (Qiskit/qiskit#8702)
* Add minimally working VQE with estimator primitive implementation. No gradients, no tests etc. * Revert from dataclass results to original result classes. * Enforce positional and keyword VQE arguments. * Move aux op eval logic to function * Update docstring. * Remove max_evals_grouped. Force to set directly on optimizer. * Remove validate min import. * Make note that eval_observables will be used to eval aux ops. * Add initial vqe tests. * Have VQE inherit from VariationalAlgorithm. * Move energy evaluation to unnested function. * Construct h2_op using SparsePauliOp * Add gradient with primitives support. * Update docstrings * update broadcast handling * update eval_energy output for batching * add incomplete QNSPA test * fix batch evaluation of QNSPSA test * remove vqe callback * move estimator to first arg * remove usused imports * add minimum eigensolvers test init file * add aux ops tests and prepare for new eval_operators * no longer support account for Nones in aux_ops * correct typing for MinimumEigensolver * Compute default initial point using ansatz bounds. * Add NumPyMinimumEigensolverResult * Fix type hints * Fix type hints * Formatting * Do not store NumPyMES result inside the algo. * Provide default values for ansatz and estimator * Formatting * fix old and new batching * Add tests for NumpyMES and import in module. * Use lazy formatting in log messages * Use lazy formatting in log messages * Add back callback to VQE. * minor renaming * raise algorithm error if primitive jobs fail * Add return documentation * Improve var names and docstrings. * Apply suggestions from code review Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> Co-authored-by: dlasecki <dal@zurich.ibm.com> * minor formatting * minor formatting * Ensure evaluate_energy/gradient match Co-authored-by: Max Rossmannek <max.rossmannek@uzh.ch> * return bounds logic; fix some docstrings and minor refactor * Force keyword arguments in vqe. * Use estimate_observables function * break up numpy mes tests with subTest * formatting * remove redundant eval_aux_ops * add typehints to docstring attributes * remove usused imports * remove default ansatz * remove usused imports * update typehints * avoid changing the original ansatz * avoid changing the original ansatz * create separate function to build vqe result * Correct aux operator eignvalue type hint Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> * add variance to callback * use std_dev in callback rather than variance * formatting * return variance and shots in callback * return full metadata in callback * Move validation functions to algorithms/utils * correct the callback attribute documentation * correct the callback attribute typehint docstring * update VQE docstring * release note and pending-depreciate old algs * update vqe class docstring * Apply suggestions from code review Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> * Do not copy ansatz * Note pending depreciation of old algs * fix docstrings and imports * Fix issues with building docs * Include OptimizerResult in VQEResult * Remove trailing whitespace * Fix math notation in docstring * estimate_obervables to return metadata @ElePT +VQE * add example in release note * Update evaluate_observables docstring * Fix observables_evaluator tests. Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> * fix trotter_qrte tests and remove depreciation * formatting * remove unused import * Apply suggestions to docstring from code review Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> * Update VQE docstring * Remove printing Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> * Add parameters to estimate observables * Fix estimate obs. unit test * Update arg description * Update arg description * keep equation part of sentence * dict -> dict[str, Any] * Update qiskit/algorithms/optimizers/spsa.py Apply suggestion Imamichi-san * introduce FilterType and aux_operator_eigenvalues -> aux_operators_evaluated * Correct typehint Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com> * update vqe docstring and use old typing for type alias Co-authored-by: ElePT <57907331+ElePT@users.noreply.github.com> Co-authored-by: dlasecki <dal@zurich.ibm.com> Co-authored-by: Max Rossmannek <max.rossmannek@uzh.ch> Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Co-authored-by: ElePT <epenatap@gmail.com> Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
- Loading branch information