-
Notifications
You must be signed in to change notification settings - Fork 68
Added V2 and ISA support #197
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
Draft
tnemoz
wants to merge
92
commits into
qiskit-community:main
Choose a base branch
from
LenaPer:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,856
−2,291
Draft
Changes from 4 commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
634dc69
Added TODO
tnemoz ecee0c6
Started to adapt to V2 primitives
tnemoz 529c5da
Modified phase estimators to work with V2 primitives and ISA circuits
tnemoz e390037
Merge branch 'main' into main
woodsp-ibm da40425
Changed PassManager to more generic transpiler
tnemoz d83408c
Changed custom types to support Python 3.8
tnemoz 0e6e6f0
Added transpiler to .pylintdict
tnemoz 0e8ac74
Adapted Grover to V2 primitives
tnemoz 3d79bb5
Changed custom types using __future__ annotations
tnemoz eae6cff
Adapated VQD to V2 primitives
tnemoz df69ea7
Adapted tests for Grover
tnemoz 111188b
Fixed styling
tnemoz 4b46931
Merge branch 'main' into main
tnemoz c03c3a1
Merge branch 'min_eigen' into dev
93af774
removed useless comments in vqe and changed SamplingVQE to match v2 p…
63332e9
changed AdaptVQE
1b58074
changed diagonal_estimators from v1 to v2 primitives
b48c66d
updated TODO
1cd76ff
changed qaoa to match v2 and isa
4f734d9
modified all associated tests for min_eigen classes
d7b671f
changed todo
d2bc2db
ComputeUncompute done
tnemoz cae37b2
QNSPSA done
tnemoz 84128a8
Restored SPSA test to previous values
tnemoz b3c32a3
Refactored test for transpilers, make linter happy, test_vqd not passing
tnemoz dc075d0
Updated TODO
tnemoz 0790c53
PVQD done
tnemoz 7ff3ab6
Slight modifications of VQD, still isn't working
tnemoz bf6a931
Adapted PVQD to EstimatorV2
tnemoz dea4bd0
Adapted Trotter QRTE to EstimatorV2
tnemoz 8d9a54c
Trotter QRTE
tnemoz 8c87b8d
Time evolvers
tnemoz e3150cf
Merge branch 'main' into main
tnemoz 3fcc265
Fixed linting and VQD test
tnemoz a1171dc
Updated TODO
tnemoz 82f7ced
Merge branch 'main' into main
woodsp-ibm d45c9ad
started mlae.py, not finished
cefd334
finished mlae file
4b95ced
updated todo andneed to continue fae and addtranspilation to mlae and…
9eab51a
modified gradient base
3af5a57
started changes into gradients
fb4dcc6
finished finite-diff gradient
950b24e
Updated gradients test
tnemoz 6fbd45e
updated reverse gradients
af1c097
updated lin_comb files, missing transpilation added to the TODO list …
c5a46b3
updated spsa estimator gradient
b4fcadb
finished spsa sampler
8fa65ce
finished lin comb
004e28c
started changes for tests
48e63f9
Amplitude estimators, tests failing but no errors
tnemoz b63a36e
Almost done, weird bug on transpiler test on mlae
tnemoz 4299816
Amplitude estimatorsd done
tnemoz 2c21f99
Updated TODO
tnemoz 73fbb5d
Estimator gradients working
tnemoz 2e78525
QGT working
tnemoz ee0597e
QFI working
tnemoz 0610b7c
Sampler gradients working
tnemoz c9f823d
Started working on _DiagonalEstimator
tnemoz 188c5ae
Continued working on _DiagonalEstimator
tnemoz dd53643
Continued working on _DiagonalEstimator #2, _call method todo
tnemoz d0e7203
Continued working on _DiagonalEstimator #3, test sampling_vqe todo
tnemoz cf84ba6
_DiagonalEstimator supposedly done, test with QNSPSA fails for now
tnemoz 25f1c55
_DiagonalEstimator done
tnemoz 941043b
SamplingVQE done
tnemoz 207f365
Working QAOA
tnemoz 822e204
Removed TODO and added more shots for the QAOA test
tnemoz 757a277
Changed initial point in QAOA test to be able to seed
tnemoz 6f39d76
Updated VQE tutorials
tnemoz fb47a1b
VQE working
tnemoz 8c402ad
Most tutorials updated. QAOA to be checked, tweedldum to be removed f…
tnemoz bf2d326
Replaced test for transpiler
tnemoz aff31d8
Added pVQD to docs
tnemoz 4ff895f
All tests passing
tnemoz 75cc776
Removed aliases
tnemoz 64b8352
Fixed time evolvers
tnemoz 303bcb4
Added future imports annotations for Python 3.9
tnemoz 47c22fb
Added copyrights
tnemoz d89db0b
Linting done, spelling to fix
tnemoz 6d8a705
Spell checked
tnemoz e6db4f2
Rollback RealAmplitudes and EfficientSU2
tnemoz 9ab842c
Additional copyrights and linting
tnemoz fb9c417
Removed strict=True in zip
tnemoz fc17c5d
Lowered precision of VQD test
tnemoz ba0c35d
Correct wrong import and line too long
tnemoz e33745b
Added tweedledum to dictionnary and added missing copyright
tnemoz 515bc54
Corrected spelling in optional
tnemoz bceaf06
Seeded StatevectorSampler in gradients test
tnemoz 924d2f3
black formatting
tnemoz f4dd0e6
Added _circuit_key
tnemoz 3ec9df7
lback formatting circuit_key
tnemoz 8d83580
Accessed _op_start_times private attribute
tnemoz 077052d
Removed last instance of Estimator and changed ClassicalRegister impo…
tnemoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This code is part of a Qiskit project. | ||
# | ||
# (C) Copyright IBM 2024. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
"""Types used by the qiskit-algorithms package.""" | ||
|
||
from typing import Any, List, Protocol, Union | ||
|
||
from qiskit import QuantumCircuit | ||
|
||
_Circuits = Union[List[QuantumCircuit], QuantumCircuit] | ||
|
||
|
||
class Transpiler(Protocol): | ||
"""A Generic type to represent a transpiler.""" | ||
|
||
def run(self, circuits: _Circuits, **options: Any) -> _Circuits: | ||
"""Transpile a circuit or a list of quantum circuits.""" | ||
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 workfrom __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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially went for
but then
make lint
complained with:which is why I went for
Union
instead of|
. Or is there a workaround I don't know of?There was a problem hiding this comment.
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.There was a problem hiding this comment.
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!