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.
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