Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
CI is failing here with the latest mypy (1.6.0). The issue seems to be around override in initial_point setter/getter.
In looking the base class defines the type as an optional numpy array. Yet we change things up to Sequence[float] in derived classes and then have to ignore the arg to minimize/optimize as that takes a POINT (union of numpy array or float). Given the initial point needs to line up with what is passed to optimizer, and scipy mimimize states it takes a numpy array (although internally it does as asarray() on whats passed) I have changed the type hints all over to np.ndarray from Sequence. QAOA initial_point was already a numpy array and that had an ignore in order to call the parent SamplingVQE that takes a Sequence.
As such I felt this was clearer/cleaner. People pass numpy arrays, or lists which will work.
For VQD what we have as initial_point is more initial_points which is somewhat at odds with it being a variational algo as that defines just an initial point really. I did not alter anything - I think this has been observed before, and arguably things ought to be improved at some point. And I will point out that type difference in the derived class, while mypy 1.6.0 does not object, mypy 1.,5..1 does which is presumably why those ignores were there elsewhere too.
Now I could have just left it ndarray but since the text talks about list of points I felt it was better to be explicit here and that things are different.
Since its only a change to typehints I did not do a reno. Users code, if it worked before should continue to work.
Details and comments