Skip to content

Commit

Permalink
New Qiskit device prototype (#513)
Browse files Browse the repository at this point in the history
* New Qiskit device prototype (#350)

* initial prototype device

* add use_primitives kwarg

* reorganize circuit conversion part 1

* move circuit translation out of device

* estimator execution

* some small improvements for codefactor

* allow circuits with mixed MP types

* move translation functions

* add support for broadcast_expand and session

* add kwargs for options

* tidy up options and session

* warn if using non-primitive measurements

* remove context manager for device session

* refactor handling of Options and kwargs

* cleaning up

* fix 'c register already exists' hardware error

* change Options update interface

* don't allow options to override shots

* don't use classical reg in estimator circuits

* update docstring

* add conversion tests

* add observable conversion test

* fix bug in PauliOps converter

* add more conversion test functions

* remove Adjoint from supported ops and tidy up

* tests and little fixes

* add tests and black formatting

* fix wire order bug for Estimator returns

* add tests

* remove error if device doesn't initialize

* try to get CI to run

* more CI stuff

* try a thing

* black formatting

* fix typo

* add missing skip-if-no-account

* update converter tests

* add mockers to allow tests to run in CI

* temporarily comment out integration tests

* get service from backend

* add mock service to mock backend

* mock calls to Session in unit testing

* uncomment the other tests again

* black formatting

* newer black formatting

* add mocked tests for main execute method

* add MockSession to mocked execution tests

* pylint

* add backend to MockSession calls

* mock tests for _execute methods

* black formatting

* mock transpile for execute_runtime_service

* add name to MockedBackend

* Apply suggestions from code review

Co-authored-by: Matthew Silverman <[email protected]>
Co-authored-by: Astral Cai <[email protected]>

* Add barrier to ops list

* apply suggestion from code review

Co-authored-by: Astral Cai <[email protected]>

* revert adding barrier for now

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Matthew Silverman <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Matthew Silverman <[email protected]>

* Small performance change

* Revert

* pin qiskit for now

* Pin qiskit-ibm-runtime

* Move function in init to update_kwargs

* Delete print statement lol

* fix for shot information

* name property change

* fixes

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Matthew Silverman <[email protected]>

* Edited docstrings

* Function signature

* Shots are now with context manager

* black reformat

* black reformat

* test changes

* tests

* fixed conflicts

* Change mp_to_pauli to accept mps that affect more than 1 qubit

* Revert to fix CI tests

* black reformat

* Update setup.py

Co-authored-by: lillian542 <[email protected]>

* Update requirements-ci.txt

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/converter.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/converter.py

Co-authored-by: lillian542 <[email protected]>

* tests

* Fixed a test

* maybe this works?

* placeholder settings

* fixed CI tests, bandaid fix

* gitignore for 1.0 qiskit versioning

* delete venv1

* tests, shots information, shot vector case, ibm_run_time compatibility

* woops

* docstring for operation_to_qiskit

* black

* appease codecov

* mock test

* Deleted comment

* remove some notebooks

* Update .gitignore

Co-authored-by: Astral Cai <[email protected]>

* tests and docstrings

---------

Co-authored-by: Matthew Silverman <[email protected]>
Co-authored-by: Astral Cai <[email protected]>
Co-authored-by: Austin Huang <[email protected]>
Co-authored-by: Austin Huang <[email protected]>
Co-authored-by: Astral Cai <[email protected]>

* Add compile_backend kwarg (#398)

Adds the compile_backend kwarg to the Qiskit device. It is useful when you want to do circuit transpilation when using the old Qiskit API (e.g. use_primitives = False). 

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

---------

Co-authored-by: Austin Huang <[email protected]>
Co-authored-by: Austin Huang <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Support both V1 and V2 (#399)

* add name to MockedBackend

* support both V1 and V2 syntax for retrieving backend name and num_qubits

* test relevant methods with both V1 and V2 MockBackends

* tests updated for old device api as per other PR

* tests

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Apply suggestions from code review

Co-authored-by: Utkarsh <[email protected]>

* merge conf

---------

Co-authored-by: Austin Huang <[email protected]>
Co-authored-by: Austin Huang <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Scalar tests passing

* Change mp_to_pauli to be more general

* Hamiltonian testing

* tests

* Revert "tests"

This reverts commit 4f21e7ddf354cc36efee55c5d50e4f978c3d2729.

* Revert "Hamiltonian testing"

This reverts commit 17c3e674235709a7c5e1baf037ebf37b42f3efbf.

* Revert "Change mp_to_pauli to be more general"

This reverts commit a1ff60638f19d302a802f46a4d586a616e0be95c.

* revert

* Install PL dev intead of PL stable on CI (#516) (#518)

* install PL dev intead of PL stable on CI

* trigger ci

* also a couple of other places

Co-authored-by: lillian542 <[email protected]>

* Delete ds store

* import change

* black

* some changes

* linters

* black

* pylinting

* black

* small change

* change conftest

* black linter

* fix

* Generalize mp_to_pauli so that it can work with any observable that has a Pauli Rep (#517)

* tests

* converter

* fixes to tests

* refactor

* delete print

* black

* pylint changes

* deleted tests/pylintrc

* one additional test

* black

* tests

* redo commits

* clean up

* black

* formatting

* black

* Update pennylane_qiskit/converter.py

Co-authored-by: Utkarsh <[email protected]>

* rewrite tests to all manual cases

* [skip-ci] black

* single qubit operations

* value error for no pauli rep

* list comprehension

* removed one list comprehension

* ehh honestly this is fine too

* delete some useless lines

* [skip-ci] refactor

* [skip ci] accidentally deleted something...?

* Update tests/test_converter.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/converter.py

Co-authored-by: lillian542 <[email protected]>

* remove parametrize

* [skip ci] black

* [skip ci] docstring

* [skip ci] added assert statement

* [skip-ci] linear comb changes

* additional more complicated integration tests

* undo some formatting

* formats

* integration tests

* tests

* deleted unsupported observables

* remove sparsehamiltonian for now

* rollback pylint

* revert observable stopping condition

* black

* just a commit

* black

* fm

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* linter errors

* linter

* linter

* linters

* try finally block better?

* revert

* let's just do this...

* trailing whitespace

* linter

* black

* formats

* black

* black

* clean up commits

* reformatting fixed

* clean up commit

---------

Co-authored-by: Utkarsh <[email protected]>
Co-authored-by: lillian542 <[email protected]>

* Use old _execute_runtime_service for observables that are not compatible with SPO representation (#525)

* Functionality

* syntax error

* additional test

* additional test cases

* edit comment

* comment

* additional comments

* added a warning

* added a warning

* delete print statement

* warning test

* delete a test

* black

* Minor adjustment to sort observables. Modified tests to accomodate. Doc strings edit

* Modified tests and warning

* edit

* fixes

* moved test to mocked

* mockedbackend update

* black

* changes

* test

* uncomment

* docstring

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* black

* fix

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Move off of "ibmq_qasm_simulator" and towards using AerSimulator for qiskit tests (#521)

* import aersimulator

* commit

* black

* added functionality for local simulators when use_primitves = False

* [skip ci] changes to AerSim

* removal of ibm service

* tests

* woops

* temp fixes

* unfinished changes

* ignore tests due to version errors

* ignore tests due to version errors

* black

* cleanup

* delete comment

* revert a change

* replaced a test case

* shouldn't need to skip if no acc anymore

* added comments

* delete comment

* minor refactor

* Added additional comments

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* [skip ci] delete comment

* add comment

---------

Co-authored-by: Utkarsh <[email protected]>

* Update reqs to 1.0 (#536)

* removed legacy ci

* Delete .github/workflows/tests.yml

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* removed devices

* pylint

* pylint

* docs fix

* setup.py changes

* delete

* revert

* reqs change

* setup

* change to reqs to match ci

* removed a test

* pylint

* put ibmq.rst back

* delete ibmq

* remove ibmq

* deletion

* codecov

* lint

* changes to tests

* Revert "Remove devices that will not be supported in the new release" (#544)

* changelogs

* Remove basicaer (#546)

* removed legacy ci

* Delete .github/workflows/tests.yml

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* removed devices

* pylint

* pylint

* docs fix

* setup.py changes

* delete

* revert

* reqs change

* setup

* change to reqs to match ci

* removed a test

* pylint

* put ibmq.rst back

* delete ibmq

* remove ibmq

* deletion

* codecov

* lint

* changes to tests

* Revert "Remove devices that will not be supported in the new release" (#544)

* docs

* remove basicaer

* reqs to build docs

* docs

* pylint

* tests fix

* path change

* Changelog and doc

* changelogs

* Update CHANGELOG.md

* deleted a test file

* removed error

* basic sim pylint

* Update CHANGELOG.md

Co-authored-by: lillian542 <[email protected]>

* remove ifelse block

* pylint

---------

Co-authored-by: lillian542 <[email protected]>

* Remove use primitives and everything that depends on it (#538)

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Remove ibmq devices (#550)

* Removing ibmq devices from the docs and relevant files

* missed something in docs

* Changelog updates

* Update CHANGELOG.md

Co-authored-by: Utkarsh <[email protected]>

---------

Co-authored-by: Utkarsh <[email protected]>

* Migrate to v2 primitives (#539)

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* change to v2 prims, del Options

* del Options

* temp changes to options

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* deleted options for now

* small changes

* access sampler results

* Sampler tests and functionality

* estimator multi measurement works

* estimator now gives variances

* comments

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* [skip ci] format is correct, checks probs as well

* [skip ci] docstring

* docstrings

* un did confusing change that didnt do anything

* rerun ci

* Syntax changes due to version change

* Delete for codecov

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* finishing touches

* comments

* [skip ci] formatting

* [skip ci] refactor

* deleting unused tests

* line change

* pylint

* yay

* docstring

* refactoring of estimator and sampler

* process_estimator_job tests

* comment for clarity

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* pylint

* Process kwargs (#547)

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* change to v2 prims, del Options

* del Options

* temp changes to options

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* deleted options for now

* small changes

* access sampler results

* Sampler tests and functionality

* estimator multi measurement works

* estimator now gives variances

* comments

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* [skip ci] format is correct, checks probs as well

* [skip ci] docstring

* docstrings

* We delete the Options Handling class because there are no more Options() to handle. Additionally, process_kwargs is left as a stub as a temporary measure while we figure out what to do with kwargs

* changed warnings due to difference in UI for setting shots between Qiskit and Pennylane. Tracking shots has also been updated due to estimatorV2 syntax change

* un did confusing change that didnt do anything

* rerun ci

* Syntax changes due to version change

* Delete for codecov

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* finishing touches

* comments

* [skip ci] formatting

* [skip ci] refactor

* due to the fact that shots are not tracked in the estimator's metadata anymore, variances are calculated a different way using the precision instead

* black

* lint

* docstring changes

* backend options?

* deleting unused tests

* line change

* [skip ci] changed test to be more readable

* New tests for options functionality and edge case

* pylint

* We make sure that transpilation options are not passed to the primitive and that no errors are raised as a result

* Due to changing the signature of get_transpile_args(), we need to fix one of the tests

* warning message for default_shots was unclear. changed to be more clear

* add more comments

* yay

* docstring

* Testing to ensure that options and kwargs combine properly

* edit tests for pylint

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* edit test regex matching due to changes earlier

* refactoring of estimator and sampler

* generate samples tested

* process_estimator_job tests

* comment for clarity

* pylint

* pylint

* [skip ci] minor formatting

* Fix unintended additonal dimensionality and added test for res != 1 testcase

* fix to transpiles

* comments to explain some stuff

* merge conflicts

* docstring

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* clean up

* refactor

* pylint

* formatting of docstring

* revert to tuple(res)

* [skip ci] fix to dimensions of sampler

* docstrings

* some docstrings changes

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* black

* linter

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Docstrings for converter functions and new qiskit device (#552)

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* change to v2 prims, del Options

* del Options

* temp changes to options

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* deleted options for now

* small changes

* access sampler results

* Sampler tests and functionality

* estimator multi measurement works

* estimator now gives variances

* comments

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* [skip ci] format is correct, checks probs as well

* [skip ci] docstring

* docstrings

* We delete the Options Handling class because there are no more Options() to handle. Additionally, process_kwargs is left as a stub as a temporary measure while we figure out what to do with kwargs

* changed warnings due to difference in UI for setting shots between Qiskit and Pennylane. Tracking shots has also been updated due to estimatorV2 syntax change

* un did confusing change that didnt do anything

* rerun ci

* Syntax changes due to version change

* Delete for codecov

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* finishing touches

* comments

* [skip ci] formatting

* [skip ci] refactor

* due to the fact that shots are not tracked in the estimator's metadata anymore, variances are calculated a different way using the precision instead

* black

* lint

* docstring changes

* backend options?

* deleting unused tests

* line change

* [skip ci] changed test to be more readable

* New tests for options functionality and edge case

* pylint

* We make sure that transpilation options are not passed to the primitive and that no errors are raised as a result

* Due to changing the signature of get_transpile_args(), we need to fix one of the tests

* warning message for default_shots was unclear. changed to be more clear

* add more comments

* yay

* docstring

* Testing to ensure that options and kwargs combine properly

* edit tests for pylint

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* edit test regex matching due to changes earlier

* refactoring of estimator and sampler

* generate samples tested

* process_estimator_job tests

* comment for clarity

* pylint

* pylint

* [skip ci] minor formatting

* [skip ci] docstrings for converter functions

* Fix unintended additonal dimensionality and added test for res != 1 testcase

* fix to transpiles

* comments to explain some stuff

* merge conflicts

* [skip ci] examples of QiskitDevice2 added to docstring

* docstring changes

* docstring

* more docstrings

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* clean up

* refactor

* pylint

* formatting of docstring

* docstrings

* docstrings

* formatting

* changes

* some examples

* Update pennylane_qiskit/converter.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* examples and links

* change inheritance for remote device

* build docs

* better docs

* fix docs a little

* remove redundant docstrings

* revert

* import fix

* build sphinx

* revert change to QiskitDev2

* Update pennylane_qiskit/remote.py

Co-authored-by: Utkarsh <[email protected]>

* reformat to within 100 chars

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Diagonalize gates (#558)

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* change to v2 prims, del Options

* del Options

* temp changes to options

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* deleted options for now

* small changes

* access sampler results

* Sampler tests and functionality

* estimator multi measurement works

* estimator now gives variances

* comments

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* [skip ci] format is correct, checks probs as well

* [skip ci] docstring

* docstrings

* We delete the Options Handling class because there are no more Options() to handle. Additionally, process_kwargs is left as a stub as a temporary measure while we figure out what to do with kwargs

* changed warnings due to difference in UI for setting shots between Qiskit and Pennylane. Tracking shots has also been updated due to estimatorV2 syntax change

* un did confusing change that didnt do anything

* rerun ci

* Syntax changes due to version change

* Delete for codecov

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* finishing touches

* comments

* [skip ci] formatting

* [skip ci] refactor

* due to the fact that shots are not tracked in the estimator's metadata anymore, variances are calculated a different way using the precision instead

* black

* lint

* docstring changes

* backend options?

* deleting unused tests

* line change

* [skip ci] changed test to be more readable

* New tests for options functionality and edge case

* pylint

* We make sure that transpilation options are not passed to the primitive and that no errors are raised as a result

* Due to changing the signature of get_transpile_args(), we need to fix one of the tests

* warning message for default_shots was unclear. changed to be more clear

* add more comments

* yay

* docstring

* Testing to ensure that options and kwargs combine properly

* edit tests for pylint

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* edit test regex matching due to changes earlier

* refactoring of estimator and sampler

* generate samples tested

* process_estimator_job tests

* comment for clarity

* pylint

* pylint

* [skip ci] minor formatting

* Fix unintended additonal dimensionality and added test for res != 1 testcase

* fix to transpiles

* comments to explain some stuff

* merge conflicts

* docstring

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* clean up

* refactor

* pylint

* formatting of docstring

* revert to tuple(res)

* [skip ci] fix to dimensions of sampler

* docstrings

* some docstrings changes

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* black

* [skip ci] import split_non_commuting

* diagonalize tests for Hadamard

* changed stopping condition to reflect reality of what's supported and added tests and changed tests to fit new stopping condition

* [skip ci] added comment about qml.var not providing matching answers

* some tests

* [skip ci] linter

* interesting changes

* linter

* split non commuting test cases

* sprod

* sampler tested as well

* linter

* black

* docstrings and comments

* docstrings and comments black

* comment regarding magic number

* todo

* add np

* more concise way of testing

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* fix black

* diagonalize for edge case

* linter

* pylint

* clean up

* fix docstring

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Qiskit session (#551)

* functionality implemented

* minor adjustments to tests

* [skip-ci] Qiskit Sessions now test many warnings since you can set session options on device initialization and when using the session manager. We use the options in the device for things that are generally not updateable for the device e.g. backends; we use session options for everything else

* [skip-ci] tests that we are passing on kwargs to Qiskit's session constructor, and verifying that an error is raised due to such behavior

* [skip ci] pylint

* small comments

* Generalization of the session options

* delicious docstrings

* [skip ci] tests and clarification

* [skip ci] better session options

* comments for clarity

* changes to the tests & the warning message

* docstrings

* type error changes

* docstrings

* add qiskit_session to docs

* a little more consistency in comments

* for docs

* fix ci

* black

* revert

* revert

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Qiskit Session update

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* docstring update

---------

Co-authored-by: Utkarsh <[email protected]>
Co-authored-by: lillian542 <[email protected]>

* Tests with fakehardware (#553)

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* change to v2 prims, del Options

* del Options

* temp changes to options

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* deleted options for now

* small changes

* access sampler results

* Sampler tests and functionality

* estimator multi measurement works

* estimator now gives variances

* comments

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* [skip ci] format is correct, checks probs as well

* [skip ci] docstring

* docstrings

* We delete the Options Handling class because there are no more Options() to handle. Additionally, process_kwargs is left as a stub as a temporary measure while we figure out what to do with kwargs

* changed warnings due to difference in UI for setting shots between Qiskit and Pennylane. Tracking shots has also been updated due to estimatorV2 syntax change

* un did confusing change that didnt do anything

* rerun ci

* Syntax changes due to version change

* Delete for codecov

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* finishing touches

* comments

* [skip ci] formatting

* [skip ci] refactor

* due to the fact that shots are not tracked in the estimator's metadata anymore, variances are calculated a different way using the precision instead

* black

* lint

* docstring changes

* backend options?

* deleting unused tests

* line change

* [skip ci] changed test to be more readable

* New tests for options functionality and edge case

* pylint

* We make sure that transpilation options are not passed to the primitive and that no errors are raised as a result

* Due to changing the signature of get_transpile_args(), we need to fix one of the tests

* warning message for default_shots was unclear. changed to be more clear

* add more comments

* yay

* docstring

* Testing to ensure that options and kwargs combine properly

* edit tests for pylint

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* edit test regex matching due to changes earlier

* refactoring of estimator and sampler

* generate samples tested

* process_estimator_job tests

* comment for clarity

* pylint

* pylint

* [skip ci] minor formatting

* Fix unintended additonal dimensionality and added test for res != 1 testcase

* fix to transpiles

* comments to explain some stuff

* merge conflicts

* docstring

* [skip ci] some tests with fakehardware

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* clean up

* refactor

* pylint

* formatting of docstring

* revert to tuple(res)

* [skip ci] fix to dimensions of sampler

* docstrings

* some docstrings changes

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* black

* [skip ci] import split_non_commuting

* diagonalize tests for Hadamard

* changed stopping condition to reflect reality of what's supported and added tests and changed tests to fit new stopping condition

* [skip ci] added comment about qml.var not providing matching answers

* some tests

* [skip ci] linter

* interesting changes

* linter

* split non commuting test cases

* sprod

* sampler tested as well

* linter

* black

* docstrings and comments

* docstrings and comments black

* comment regarding magic number

* todo

* add np

* more concise way of testing

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* fix black

* diagonalize for edge case

* linter

* pylint

* clean up

* fix docstring

* flaky

* flaky and fake

* rename bakcend to aer_backend

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* fix merge conf

* fix setup.py

* reqs.txt

* changelog changes

* Use new qiskit device as the base for remote (#566)

* import changes

* Added TODOs for tests

* changes

* this should pass

* pylint

* circular import

* observables update

* remerge

* import from qiskitdevice2

* Delete unnecessary tests and mocks

* black/pylint

* Add tests back in for codecov.

* refactor tests

* delete legacy device only functionality

* change around imports

* add assertion

* fix

* fix

* fix setup

* clean up

* fix reqs.txt

* fix

* changelog changed

* maybe this works?

* a docstring?

* a docstring?

* reverts

* does this break

* revert

* fix

* fix

* attempt a doc fix

* Update tests/test_integration.py

Co-authored-by: Utkarsh <[email protected]>

* some docstrings

---------

Co-authored-by: obliviateandsurrender <[email protected]>

* Plugin page update (#563)

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* change to v2 prims, del Options

* del Options

* temp changes to options

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* deleted options for now

* small changes

* access sampler results

* Sampler tests and functionality

* estimator multi measurement works

* estimator now gives variances

* comments

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* [skip ci] format is correct, checks probs as well

* [skip ci] docstring

* docstrings

* We delete the Options Handling class because there are no more Options() to handle. Additionally, process_kwargs is left as a stub as a temporary measure while we figure out what to do with kwargs

* changed warnings due to difference in UI for setting shots between Qiskit and Pennylane. Tracking shots has also been updated due to estimatorV2 syntax change

* un did confusing change that didnt do anything

* rerun ci

* Syntax changes due to version change

* Delete for codecov

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* finishing touches

* comments

* [skip ci] formatting

* [skip ci] refactor

* due to the fact that shots are not tracked in the estimator's metadata anymore, variances are calculated a different way using the precision instead

* black

* lint

* docstring changes

* backend options?

* deleting unused tests

* line change

* [skip ci] changed test to be more readable

* New tests for options functionality and edge case

* pylint

* We make sure that transpilation options are not passed to the primitive and that no errors are raised as a result

* Due to changing the signature of get_transpile_args(), we need to fix one of the tests

* warning message for default_shots was unclear. changed to be more clear

* add more comments

* yay

* docstring

* Testing to ensure that options and kwargs combine properly

* edit tests for pylint

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* edit test regex matching due to changes earlier

* refactoring of estimator and sampler

* generate samples tested

* process_estimator_job tests

* comment for clarity

* pylint

* pylint

* [skip ci] minor formatting

* [skip ci] docstrings for converter functions

* Fix unintended additonal dimensionality and added test for res != 1 testcase

* fix to transpiles

* comments to explain some stuff

* merge conflicts

* [skip ci] examples of QiskitDevice2 added to docstring

* docstring changes

* docstring

* more docstrings

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* clean up

* refactor

* pylint

* formatting of docstring

* docstrings

* docstrings

* formatting

* changes

* some examples

* Update pennylane_qiskit/converter.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* examples and links

* change inheritance for remote device

* build docs

* better docs

* fix docs a little

* remove redundant docstrings

* revert

* import fix

* prelim changes to aer

* changes to build sphinx

* revert change

* delete section on ibmq devices

* add examples for remote.rst

* plugin updates to the remote device and basicsim

* doc fixes for sphinx build

* docs

* small fi

* fix weird spacing

* [skip ci] small fix

* [skip ci] error in codeblock

* delete extra the

* [skip ci] changelog

* merge confs

* formatting

* black

* Update doc/devices/remote.rst

Co-authored-by: Utkarsh <[email protected]>

* Update doc/devices/remote.rst

Co-authored-by: Utkarsh <[email protected]>

* Update doc/devices/remote.rst

Co-authored-by: Utkarsh <[email protected]>

* Update doc/devices/remote.rst

Co-authored-by: Utkarsh <[email protected]>

* Update doc/devices/remote.rst

Co-authored-by: Utkarsh <[email protected]>

* address comments

* undo

* readme

* plugin page fixes

* fixed documentation

* fix

* Update doc/index.rst

Co-authored-by: lillian542 <[email protected]>

* doc changes

* typo

* weird change didn't go through

* change to doc

* small change

* Update doc/devices/remote.rst

Co-authored-by: Utkarsh <[email protected]>

* Update doc/devices/remote.rst

Co-authored-by: Utkarsh <[email protected]>

* change name of iqp token

* small fix

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Tracker functionality (#533)

* is this all?

* doc strings

* tests for tracker

* trackers

* trackers

* fixed tests

* removed legacy ci

* Delete .github/workflows/tests.yml

* Deleted use_primitives from tests

* remove use_primitive kwarg and things that depend on it

* fix tests and split_exec

* fixed test

* pylint

* change to v2 prims, del Options

* del Options

* temp changes to options

* naming and 0.46 test

* rename

* update qiskit device

* dep warnings

* pylint

* changes to tests

* deleted options for now

* small changes

* access sampler results

* Sampler tests and functionality

* estimator multi measurement works

* estimator now gives variances

* comments

* removed backend.run() and _execute_runtime

* remove additional stuff

* linter

* docstring changes

* skip additional test

* [skip ci] format is correct, checks probs as well

* [skip ci] docstring

* docstrings

* We delete the Options Handling class because there are no more Options() to handle. Additionally, process_kwargs is left as a stub as a temporary measure while we figure out what to do with kwargs

* changed warnings due to difference in UI for setting shots between Qiskit and Pennylane. Tracking shots has also been updated due to estimatorV2 syntax change

* un did confusing change that didnt do anything

* rerun ci

* Syntax changes due to version change

* Delete for codecov

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* docstrings

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* finishing touches

* comments

* [skip ci] formatting

* [skip ci] refactor

* due to the fact that shots are not tracked in the estimator's metadata anymore, variances are calculated a different way using the precision instead

* black

* lint

* docstring changes

* backend options?

* deleting unused tests

* line change

* [skip ci] changed test to be more readable

* New tests for options functionality and edge case

* pylint

* We make sure that transpilation options are not passed to the primitive and that no errors are raised as a result

* Due to changing the signature of get_transpile_args(), we need to fix one of the tests

* warning message for default_shots was unclear. changed to be more clear

* add more comments

* yay

* docstring

* Testing to ensure that options and kwargs combine properly

* edit tests for pylint

* woops

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* Update pennylane_qiskit/qiskit_device2.py

Co-authored-by: Utkarsh <[email protected]>

* edit test regex matching due to changes earlier

* print out some stuff for tests

* refactoring of estimator and sampler

* generate samples tested

* process_estimator_job tests

* comment for clarity

* pylint

* pylint

* [skip ci] temp

* [skip ci] There is a bug due to the post processing of results that is causing some of the assertion statements to fail. We can ignore these assertions for now and address how to rework reorder_fn to avoid this bug

* [skip ci]

* [skip ci] minor formatting

* Fix unintended additonal dimensionality and added test for res != 1 testcase

* fix to transpiles

* comments to explain some stuff

* merge conflicts

* pylint

* formatting

* tracker comments

* black

* comments about the tracker

* bet

* fix to imports

* black

* temp

* baller implementation

* increase shot number to reduce error

* edit function

* black

* better tests

* refactor

* black

* delete print statement

* refactor

* Delete unneeded import

* fix assertion

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* Update tests/test_base_device.py

Co-authored-by: lillian542 <[email protected]>

* new tests

* removed simulations keyword

* some xfails pending discussion

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Utkarsh <[email protected]>

* Update CHANGELOG.md

Co-authored-by: lillian542 <[email protected]>

* CHANGELOG

---------

Co-authored-by: lillian542 <[email protected]>
Co-authored-by: Matthew Silverman <[email protected]>
Co-authored-by: Astral Cai <[email protected]>
Co-authored-by: Astral Cai <[email protected]>
Co-authored-by: Utkarsh <[email protected]>
  • Loading branch information
6 people authored Jul 25, 2024
1 parent a5f0f5a commit 4cb1847
Show file tree
Hide file tree
Showing 36 changed files with 3,630 additions and 2,318 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ibmq_tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: IBMQ integration tests
name: IBMQ integration tests with Qiskit 1.0
on:
schedule:
- cron: '0 0 * * 0,4' # At 00:00 on Sunday and Thursday.
- cron: '1 0 * * 0,4' # At 01:00 on Sunday and Thursday.
workflow_dispatch:

jobs:
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-ci-legacy.txt
pip install -r requirements-ci.txt
pip install wheel pytest pytest-cov pytest-mock flaky --upgrade
pip freeze
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/ibmq_tests_1.yml

This file was deleted.

17 changes: 6 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Tests for 1.0
on:
push:
branches:
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/PennyLaneAI/pennylane.git
pip install -r requirements-ci-legacy.txt
pip install -r requirements-ci.txt
pip install wheel pytest pytest-cov pytest-mock flaky --upgrade
pip freeze
Expand All @@ -39,12 +39,9 @@ jobs:
pip install git+https://github.com/PennyLaneAI/pennylane-qiskit.git@${{ github.ref }}
pip freeze
- name: Run tests
# Skip IBMQ and Runtime tests as they depend on IBMQ's availability and
# easily result in timeouts
- name: Run standard Qiskit plugin tests
# Run the standard tests with the most recent version of Qiskit
run: python -m pytest tests -k 'not test_ibmq.py and not test_runtime.py' --cov=pennylane_qiskit --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native
env:
IBMQX_TOKEN: ${{ secrets.IBMQX_TOKEN_TEST }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down Expand Up @@ -72,19 +69,17 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/PennyLaneAI/pennylane.git
pip install -r requirements-ci-legacy.txt
pip install -r requirements-ci.txt
pip install wheel pytest pytest-cov pytest-mock pytest-benchmark flaky --upgrade
pip freeze
- name: Install Plugin
run: |
python setup.py bdist_wheel
pip install dist/PennyLane*.whl
pip freeze
- name: Run tests
run: |
pl-device-test --device=qiskit.basicaer --tb=short --skip-ops --shots=20000 --device-kwargs backend=qasm_simulator
pl-device-test --device=qiskit.basicsim --tb=short --skip-ops --shots=20000 --device-kwargs backend=basic_simulator
pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=20000 --device-kwargs backend=qasm_simulator
pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=statevector_simulator
pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=unitary_simulator
Expand Down
91 changes: 0 additions & 91 deletions .github/workflows/tests_qiskit_1.yml

This file was deleted.

29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,40 @@

### New features since last release

* Qiskit Sessions can now be used for the ``qiskit.remote`` device with the ``qiskit_session`` context
manager.
[(#551)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/551)

### Improvements 🛠

* Qiskit Runtime Primitives are supported by the ``qiskit.remote`` device. Circuits ran using the ``qiskit.remote``
device will automatically call the SamplerV2 and EstimatorV2 primitives appropriately. Additionally, runtime options can be passed as keyword arguments directly to the ``qiskit.remote`` device.
[(#513)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/513)

### Breaking changes 💔

* Support has been removed for Qiskit versions below 0.46. The minimum required version for Qiskit is now 1.0.
If you want to continue to use older versions of Qiskit with the plugin, please use version 0.36 of
the Pennylane-Qiskit plugin.
[(#536)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/536)

* The test suite no longer runs for Qiskit versions below 0.46.
[(#536)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/536)

* The ``qiskit.basicaer`` device has been removed because it is not supported for versions of Qiskit above 0.46.
[(#546)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/546)

* The IBM quantum devices, ``qiskit.ibmq``, ``qiskit.ibmq.circuit_runner`` and ``qiskit.ibmq.sampler``, have been removed due to deprecations of the IBMProvider and the cloud simulator "ibmq_qasm_simulator".
[(#550)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/550)

### Deprecations 👋

### Documentation 📝

* The Pennylane-Qiskit plugin page has been updated to reflect the changes in both the plugin's
capabilities and Qiskit.
[#563](https://github.com/PennyLaneAI/pennylane-qiskit/pull/563)

### Bug fixes 🐛

### Contributors ✍️
Expand All @@ -30,8 +56,9 @@ This release contains contributions from (in alphabetical order):
### Contributors ✍️

This release contains contributions from (in alphabetical order):

Utkarsh Azad
Lillian M. A. Frederiksen
Austin Huang
Mashhood Khan

---
Expand Down
20 changes: 5 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,11 @@ To test that the PennyLane-Qiskit plugin is working correctly you can run
in the source folder.

.. note::

Tests on the `IBMQ device <https://pennylaneqiskit.readthedocs.io/en/latest/devices/ibmq.html>`_ can
only be run if a ``ibmqx_token`` for the
`IBM Q experience <https://quantum-computing.ibm.com/>`_ is
configured in the `PennyLane configuration file
<https://pennylane.readthedocs.io/en/latest/introduction/configuration.html>`_, if the token is
exported in your environment under the name ``IBMQX_TOKEN``, or if you have previously saved your
account credentials using the
`new IBMProvider <https://qiskit.org/ecosystem/ibm-provider/stubs/qiskit_ibm_provider.IBMProvider.html>`_

If this is the case, running ``make test`` also executes tests on the ``ibmq`` device.
By default, tests on the ``ibmq`` device run with ``ibmq_qasm_simulator`` backend. At
the time of writing this means that the test are "free".
Please verify that this is also the case for your account.
.. warning::

When installing the Pennylane-Qiskit plugin, we recommend starting with a clean environment.
This is especially pertinent when upgrading from a pre-1.0 version of Qiskit, as described
in `Qiskit's migration guide <https://docs.quantum.ibm.com/api/migration-guides/qiskit-1.0-installation>`_.

.. installation-end-inclusion-marker-do-not-remove
Expand Down
43 changes: 24 additions & 19 deletions doc/devices/aer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,19 @@ parameters would look like:
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(wires=1))
You can then execute the circuit like any other function to get the quantum mechanical expectation value.
You can then execute the circuit like any other function to get the expectation value of a Pauli
operator.

.. code-block:: python
circuit(0.2, 0.1, 0.3)
Backends
~~~~~~~~
Backend Methods and Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The default backend is the ``AerSimulator``. However, multiple other backends are also available.
To get a current overview what backends are available you can query

.. code-block:: python
dev.capabilities()['backend']
or, alternatively,

.. code-block:: python
from qiskit_aer import Aer
Expand All @@ -58,18 +53,28 @@ You can change a ``'qiskit.aer'`` device's backend with the ``backend`` argument

.. code-block:: python
dev = qml.device('qiskit.aer', wires=2, backend='aer_simulator_statevector')
from qiskit_aer import UnitarySimulator
dev = qml.device('qiskit.aer', wires=2, backend=UnitarySimulator())
Backend Methods and Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. note::

Occassionally, you may see others pass in a string as a backend. For example:

.. code-block:: python
dev = qml.device('qiskit.aer', wires=2, backend='unitary_simulator')
At the time of writing, this is still functional for the Aer devices. However, this will soon be
deprecated and may not function as intended. To ensure accurate results, we recommend passing in
a backend instance.

This ``AerSimulator`` backend has several available methods, which
The ``AerSimulator`` backend has several available methods, which
can be passed via the ``method`` keyword argument. For example
``'automatic'``, ``'statevector'``, and ``'unitary'``.

.. code-block:: python
dev = qml.device("qiskit.aer", wires=2, method="automatic")
dev = qml.device("qiskit.aer", wires=2, backend=AerSimulator(), method="automatic")
Each of these methods can take different *run options*, for example to specify the numerical
precision of the simulation.
Expand All @@ -81,7 +86,7 @@ The options are set via additional keyword arguments:
dev = qml.device(
'qiskit.aer',
wires=2,
backend='unitary_simulator',
backend=AerSimulator(),
validation_threshold=1e-6
)
Expand All @@ -96,9 +101,9 @@ documentation <https://qiskit.org/ecosystem/aer/stubs/qiskit_aer.AerSimulator.ht
Noise models
~~~~~~~~~~~~

One great feature of the ``'qiskit.aer'`` device is the ability to simulate noise. There are different noise models,
which you can instantiate and apply to the device as follows
(adapting `this <https://qiskit.org/documentation/apidoc/aer_noise.html>`_ qiskit tutorial):
One great feature of the ``'qiskit.aer'`` device is the ability to simulate noise. There are
different noise models, which you can instantiate and apply to the device as follows (adapted
from a `Qiskit tutorial <https://qiskit.github.io/qiskit-aer/tutorials/4_custom_gate_noise.html>`_.):

.. code-block:: python
Expand Down Expand Up @@ -136,4 +141,4 @@ which you can instantiate and apply to the device as follows
print(circuit(0.2, 0.1, 0.3))
Please refer to the Qiskit documentation for more information on
`noise models <https://qiskit.org/documentation/tutorials/simulators/3_building_noise_models.html>`_.
`noise models <https://qiskit.github.io/qiskit-aer/tutorials/3_building_noise_models.html>`_.
Loading

0 comments on commit 4cb1847

Please sign in to comment.