Open mrossinek opened 1 year ago
The Estimation logic - and possible elsewhere - has code that is no longer used. While deprecated code for QI/opflow was removed there are some util like functions taking types that would have been an outcome - this code is now untested.
Also Grover has some issue around using the circuit passed a as grover operator - it allows QuatumCircuit but then treats it as GroverOperator where it unconditionally accesses an attribute that has which is not present on a QuantumCircuit. Update: I raised #76 for this.
This was just from starting to look at mypy in AA and AE folders.
I suppose a good strategy at finding which of the code is unused would be to look at the coverage reports. Obviously not all uncovered lines can be removed but it might be a good starting point :+1:
Yes, particularly around the algos AE, Grover and Phase Estimation that were modified to add Sampler logic paths to the existing code and whether more could/should have been removed when QI paths were removed that was part of common utilities.
What should we add?
While working on #73, @ElePT and I have identified the following inconsistencies and/or problems around the type hints which should be investigated further. Rather than holding up that PR unnecessarily, we decided to gather these here. That way, they can be investigated one-by-one.
Note: some of these may very likely require code changes to resolve inconsistencies in the interfaces.
np.ndarray
vsSequence[float]
. It is a known issue that tomypy
the numpy arrays do not satisfy theSequence
type. This leads to many type ignore statements right now which can hopefully be improved upon.Sequence[float]
, sometimes itsSequence[Sequence[float]]
, and oftentimes internally it ends up asnp.ndarray
causing many type ignore commentsinitial_point
attributes is very inconsistent across its various occurrences.Minimizer
interface does not appear to be supported properly byVQD
andPVQD
(for example) since they do not provide the requiredjac
argumentListOrDict
type is causing quite some oddities. This has multiple cases:metadata
(e.g.variance
) types and implementations are inconsistent with the variance sometimes wrapped in dictionaries and sometimes provided as a single numberaux_operators
and/orobservables
we had to add many type ignores which would need to be re-evaluated (possibly linked to the previous point)EsimationProblem
have very poor typing around the following points:post_processing
functioncircuit_results