Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added V2 and ISA support #197

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
634dc69
Added TODO
tnemoz Aug 7, 2024
ecee0c6
Started to adapt to V2 primitives
tnemoz Aug 7, 2024
529c5da
Modified phase estimators to work with V2 primitives and ISA circuits
tnemoz Aug 9, 2024
e390037
Merge branch 'main' into main
woodsp-ibm Aug 9, 2024
da40425
Changed PassManager to more generic transpiler
tnemoz Aug 12, 2024
d83408c
Changed custom types to support Python 3.8
tnemoz Aug 12, 2024
0e6e6f0
Added transpiler to .pylintdict
tnemoz Aug 12, 2024
0e8ac74
Adapted Grover to V2 primitives
tnemoz Aug 12, 2024
3d79bb5
Changed custom types using __future__ annotations
tnemoz Aug 16, 2024
eae6cff
Adapated VQD to V2 primitives
tnemoz Aug 16, 2024
df69ea7
Adapted tests for Grover
tnemoz Aug 16, 2024
111188b
Fixed styling
tnemoz Aug 16, 2024
4b46931
Merge branch 'main' into main
tnemoz Aug 24, 2024
c03c3a1
Merge branch 'min_eigen' into dev
Aug 25, 2024
93af774
removed useless comments in vqe and changed SamplingVQE to match v2 p…
Aug 26, 2024
63332e9
changed AdaptVQE
Aug 26, 2024
1b58074
changed diagonal_estimators from v1 to v2 primitives
Aug 26, 2024
b48c66d
updated TODO
Aug 30, 2024
1cd76ff
changed qaoa to match v2 and isa
Aug 30, 2024
4f734d9
modified all associated tests for min_eigen classes
Aug 30, 2024
d7b671f
changed todo
Aug 30, 2024
d2bc2db
ComputeUncompute done
tnemoz Sep 2, 2024
cae37b2
QNSPSA done
tnemoz Sep 2, 2024
84128a8
Restored SPSA test to previous values
tnemoz Sep 10, 2024
b3c32a3
Refactored test for transpilers, make linter happy, test_vqd not passing
tnemoz Sep 10, 2024
dc075d0
Updated TODO
tnemoz Sep 10, 2024
0790c53
PVQD done
tnemoz Sep 10, 2024
7ff3ab6
Slight modifications of VQD, still isn't working
tnemoz Sep 18, 2024
bf6a931
Adapted PVQD to EstimatorV2
tnemoz Aug 16, 2024
dea4bd0
Adapted Trotter QRTE to EstimatorV2
tnemoz Aug 16, 2024
8d9a54c
Trotter QRTE
tnemoz Sep 18, 2024
8c87b8d
Time evolvers
tnemoz Dec 5, 2024
e3150cf
Merge branch 'main' into main
tnemoz Dec 5, 2024
3fcc265
Fixed linting and VQD test
tnemoz Dec 5, 2024
a1171dc
Updated TODO
tnemoz Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions qiskit_algorithms/custom_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

"""Types used by the qiskit-algorithms package."""

from typing import Any, Protocol, Union
from typing import Any, List, Protocol, Union

from qiskit import QuantumCircuit

_Circuits = Union[list[QuantumCircuit], QuantumCircuit]
_Circuits = Union[List[QuantumCircuit], QuantumCircuit]
Copy link
Member

@woodsp-ibm woodsp-ibm Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use list in 3.8 - which arguably is better and what we have tried to do elsewhere. You do need to add a future import to have that work from __future__ import annotations. You can see examples in this repo e.g. in this file which does that and uses it https://github.com/qiskit-community/qiskit-algorithms/blob/main/qiskit_algorithms/time_evolvers/pvqd/pvqd_result.py Though I am not sure here with custom types defs though as I see Union and elsewhere we try and use the | nowadays instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially went for

_Circuits = list[QuantumCircuit] | QuantumCircuit

but then make lint complained with:

************* Module qiskit_algorithms.custom_types
qiskit_algorithms/custom_types.py:21:12: E1131: unsupported operand type(s) for | (unsupported-binary-operation)

which is why I went for Union instead of |. Or is there a workaround I don't know of?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That future import is needed for | as well - but if you had that import then as I mentioned I was not not sure here as I recall having issues when defining types before using these newer aspects where we had to have them defined with the former Typing constructs. If you search in this repo you will find just a few Union hits where they are pretty much limited to being used in type defines like this - I also see List being used in the ones here so it may well be the same issue with that. I commented mostly as a saw the commit that changed things to fix it for lint in 3.8 from list to List that was all the change I did not see a from future import being removed which is needed to type things this newer way in 3.8.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One further comment around 3.8. Qiskit has already deprecated support for Python 3.8 and support will be removed in 1.3.0 which is due in Nov. Python 3.8 EOL is Oct this year so among the changes here it could be a choice to drop 3.8 support too along with these changes. To drop this would evidently also include dropping it from CI tests etc and bumping things to run at 3.9 min.

In talking about versions I will note 3.13 is planned to be available beginning of Oct. There is an issue on Qiskit Qiskit/qiskit#12903 to support this so again depending on timeline.... but hopefully that's just adding it as supported and to CI to test when dependencies are there and it just works!



class Transpiler(Protocol):
Expand Down
Loading