Commit Graph

8364 Commits

Author SHA1 Message Date
Luciano Bello f1fa4f2f82
Introduction of ExperimentalWarning (#11326)
* initial commit for experimental warning

* Remove previous implementation

* Add `ExperimentalWarning`

* Expand warning on use

Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

* Fix overlong line

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Co-authored-by: Jake Lishman <jake@binhbar.com>
2024-01-31 12:16:46 +00:00
Jake Lishman 47dc6f2896
Remove `Unroller` entry-point registration (#11684)
The `Unroller` pass and its associated plugin was removed in gh-11581,
but this registration was overlooked (not surprisingly - it's very easy
to miss!).  This is causing the test suite to log warnings at the moment
during plugin evaluation.
2024-01-31 04:11:07 +00:00
Eric Arellano 9670d85a23
Remove qiskit.org deploy (#11650) 2024-01-31 01:12:29 +00:00
Matthew Treinish 3b82feadaf
Add version flag to qpy dump (#11644)
* Add version flag to qpy dump

This commit adds a new keyword argument to the qpy.dump() function which
is used to specify a compatibility version of QPY which is the latest
version for the 0.45 and 0.46 version. This basically adds a compatibility
mode for generating QPY files that returns a fixed QPY version that
enables the 0.45 and 0.46 release to load the QPY files generated with
the 1.0 release. The default output doesn't change and dump() will
always return the latest QPY format version by default as this is the
version that gets all the bugfixes and is kept up to date with the
QuantumCircuit class.

As of this commit the compatibility version and the latest version are
the same, both at version 10. However, this flag is being added so that
the interface exists for when we inevitably need to update the QPY
version field for any release in the 1.x major version series. There are
potential PRs in the 1.0 release series that will bump the latest QPY
version to 11 which will change this and those PRs will need to factor
this in when they change the format.

* Export current and compatibility version from qiskit.qpy

* Update test to use QPY_COMPATIBILITY_VERSION

Co-authored-by: Will Shanks <willshanks@us.ibm.com>

* Revise support policy to be a range not just min/max versions

* Add attribute documentation

* Remove hardcoded reference to current QPY_VERSION

---------

Co-authored-by: Will Shanks <willshanks@us.ibm.com>
2024-01-31 00:36:10 +00:00
Kevin J. Sung 82f15d778a
fix typo (#11679)
* fix typo

* another typo
2024-01-30 23:16:33 +00:00
Elena Peña Tapia 3773444813
Rename `BasicAer` to `BasicProvider` and refactor interface to follow `BackendV2` (#11422)
* Rename `BasicAer` to `BasicProvider`, rename `QasmSimulatorPy` to `BasicSimulator`, remove statevector and unitary simulators.
Replace uses of `BasicAer` with `BasicProvider`, `QasmSimulatorPy` with `BasicSimulator`, `UnitarySimulatorPy` with `quantum_info.Operator` and `StatevectorSimulatorPy` with `quantum_info.Statevector`.

* Migrate `BasicSimulator` interface from `BackendV1` to `BackendV2` (with some extra methods for backward compat.).
Refactor class, rename some internal methods to avoid non-qasm related  use of "qasm", add typehints to module to
improve clarity, update existing typehints. Update tests to expect `BackendV2`.

* Update missing references in qiskit/examples and tests

* Update missing docstrings

* Add future import

* Add type

* Fix lint

* Avoid rebuilding target/configuration when calling property

* Update configuration

* Return methods to original order

* Restore template matching

* Add support for target.num_qubits=None in transpiler pipeline. Set num_qubits in BasicSimulator to None to avoid circuits being transpiled to the simulator's max number of qubits, thus blowing up the size of the computed statevector.

Apply suggestions from Julien's code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Small refactorings: apply Julien's suggestions, single out unitary gate basis gate, remove properties and status (but keep configuration, as it is required by assemble), change test case (it was based on backendV1).

* Fix style

* Add release note

* Apply inline suggestions from Julien's code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Add suggestion from Julien's code review

* Fix lint

* Fix docs, test

* (Desperate) attempt to fix docs

* Third attempt to fix docs

* Remove execute from basic simulator tests

* Fix conflicts

* Merge remove-execute, fix conflicts

* Update example docstring

* Apply suggestions from Matt's code review

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Remove BasicProvider global instance

* Apply remaining review comments

* Fix tests

Fix forgotten examples

* Update reno

* Fix examples

* Update np random generator

* Use basic simulator instead of basicaer in GenericBackendV2

* Apply code review suggestions

* Remove unused import

* Update releasenotes/notes/refactor-basicaer-to-basicprovider-e27aff9c8e81d26e.yaml

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update refactor-basicaer-to-basicprovider-e27aff9c8e81d26e.yaml

* Update refactor-basicaer-to-basicprovider-e27aff9c8e81d26e.yaml

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-30 22:53:27 +00:00
Alexander Ivrii 738d3e4012
Token swapper permutation synthesis plugin (#10657)
* trying to implement permutation synthesis plugin based on token swapper

* improving plugin and tests

* pylint fixes

* exposing seed and parallel_threshold

* release notes

* clarification comment

* improved support for disconnected coupling maps

* unused import

* fix arxiv reference

* minor fix

* fix merge

* more merge fixes

* fixing imports

* updating toml file

* additional fixes

* better way to find the position in the circuit

* bump rustworkx version to 0.14.0

* doc and autosummary improvements

* Update plugin docs configuration

* Remove autosummary for available plugins list

This commit removes the autosummary directives for building the
documentation for the plugin classes. In the interest of time and
combining it with the existing aqc docs we'll do this in a follow up
for 1.0.0 after 1.0.0rc1 has been tagged.

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-30 21:31:13 +00:00
Alexander Ivrii d033e8a418
New OptimizeAnnotated transpiler pass (#11476)
* First installment to transpiler pass that optimizes annotated operations on a quantum circuit

* supporting control flow

* lint fixes

* release notes

* suggestions from code review

* option to override recursion

* fast return and style

* fast return only when no need to recurse

* adding test for recurse=False

* docs and reno improvements
2024-01-30 19:09:33 +00:00
Naoki Kanazawa 506098965c
Remove deprecated functions in pulse qobj converter (#11410)
* Removed deprecated functions in pulse qobj converter

* Minor reno suggestion

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
2024-01-30 18:14:58 +00:00
Henry Zou cfb13c98b5
Remove deprecated feature in 0.45 in unroller (#11581)
* Removed unroller

* Additional removals where unroller appears

* Fix lint and remove unroller test

* Fixed test_controlled_gate

* Fix test_preset_passmanagers

* Fixed lint

* Fixed test_circuit_methods

* Fixed lint

* Fixed lint again

* Fixed test_circuit_methods again

* Fixed test_pass_manager_drawer

* Undo change in requirements.txt

* Fix test_controlled_gate

* Updated release note

* Fix test_circuit_methods

* Update releasenotes/notes/remove-deprecated-unroller-4693330708c681e0.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Reverted change to requirements

* Added seperate function for equality check to test_controlled_gate

* Fixed requirements.txt

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
2024-01-30 17:37:42 +00:00
Ikko Hamamura 8002a3ed34
Add reference implementation of EstimatorV2 (#11227)
* Add EstimatorV2

* Update qiskit/primitives/base/base_estimator.py

* Use PositiveInt for shots

* improve type hint

* Update qiskit/primitives/containers/data_bin.py

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>

* remove _run and make run abstractmethod

* Apply suggestions from code review

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* fix from review comments

* move test/python/primitives/containers

* Apply suggestions from code review

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>

* update docs

* rename task to pubs

* Pubs -> Pub

* make pydantic optional

* Apply suggestions from code review

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* Apply suggestions from code review

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* fix lint

* type hint

* fix type hint for python 3.8

* improve BindingsArray

* fix docs warning

* Remove `slots=True` in dataclass usage.

This argument was introduced in Python 3.10, so we cannot use it yet.
We don't expect that this has any performance impacts, it is just being
used here to make it more difficult to mutate.

* update from review comments

* Update qiskit/primitives/containers/estimator_pub.py

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Update qiskit/primitives/base/base_estimator.py

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* Apply suggestions from code review

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>

* lint

* Add BaseEstimatorV2 class

Taken from 11227, but modified to
- remove options from BaseEstimatorV2
- add precision attribute to BaseEstimatorV2 and EstimatorPub
- remove BasePrimitiveV2 and BasePub

Co-Authored-By: Ikko Hamamura <ikkoham@users.noreply.github.com>
Co-Authored-By: Ian Hincks <2229105+ihincks@users.noreply.github.com>

* Fix removal of BasePub

* Remove precision from EstimatorPub

* Add BaseEstimator._make_data_bin() static method

* Apply suggestions from code review

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* Apply suggestions from code review

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* linting

* Move precision to EstimatorPub and Estimator.run

* Update EstimatorV2 run return type, fix some typos

* Fix some minor problems

* add tests

* update

* Apply suggestions from code review

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* Update qiskit/primitives/statevector_estimator.py

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* revert BasePrimitiveV1

* update

* rm base_pub.py

* options do not have precision

* remove Options

* refactoring

* Update qiskit/primitives/statevector_estimator.py

* add seed

* Update qiskit/primitives/statevector_estimator.py

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>

* clean

* validate non hermitian

* Update qiskit/primitives/statevector_estimator.py

Co-authored-by: Ian Hincks <ian.hincks@gmail.com>

* black

---------

Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Co-authored-by: Ian Hincks <ian.hincks@gmail.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
Co-authored-by: Ian Hincks <ian.hincks@ibm.com>
Co-authored-by: Ian Hincks <2229105+ihincks@users.noreply.github.com>
2024-01-30 17:08:19 +00:00
Matthew Treinish 9c58064b6a
Fix split barriers leaking during disjoint layout processing (#11655)
* Fix split barriers leaking during disjoint layout processing

This commit fixes an issue in the disjoint layout processing caused by a
shared reference from the input dag to a layout pass to the internal
transformations the layout processing performs. As part of the disjoint
layout processing the input dag needs to be split into smaller dags
for each connected component in the circuit. To enable this any barriers
present in the circuit need to be split up prior to analyzing the
connected components in the dag. A multiqubit barrier doesn't represent
a real connectivity requirement so they need to be split prior to
analysis to ensure they don't factor into the connected component
computation. To faciliate not losing the semantic meaning of the barrier
for the layout analysis of each connected component, the barrier split is
done by first taking an n-qubit barrier and converting it into n parallel
1q barriers with a uuid label applied to it. Then after we split the
circuit into the separate connected components the uuid is used to
identify any components of the same barrier and combine them together.

There were two issues with this approach the first is that the splitting
of the barriers was done on the input dag without copying first. This
causes the input dag to be modified and because in most cases it's a
shared instance which would leak out the barrier splitting if the input
dag was returned verbatim from the pass, which in most cases it would
be. This issue is fixed by ensuring that we re-combine any split
barriers after we've split the dag into it's connected components.
The second issue is the uuid label assignment would overwrite any
existing labels on barriers. While setting labels on barriers is
uncommon for users to do (but still completely valid) this is causing a
bigger issues since #10323 because the transpiler is assigning labels to
barriers it creates internally so they can be removed before the circuit
is returned. This is also fixed in this commit by appending a uuid to
the existing label instead of overwriting it, so we're able to restore
the original label when we recombine barriers.

Fixes #11649

* Always use string uuid

* Add release note
2024-01-30 09:03:05 +00:00
Ian Hincks bcc1307033
Fix `make_data_bin()` to allow no fields (#11668)
* Fix make_data_bin() to allow no fields

* Remove failing test

This test conflicts with the changes made in the previous commit.

* Add a warning to StatevectorSampler when there are no measurements

* fix linting

* change the name of the test from code review
2024-01-30 05:47:34 +00:00
MozammilQ b4582a9705
Add fake generic and modify tests (#10266)
* Added a FakeGeneric BackendV2 backend, this is just a bare minimum working code

* All FakeBackends (like FakeMelbourne, FakeBoeblingen ,etc) is replaced with FakeGeneric

* relocated FakeGeneric in fake_provider directory; replaced if-elif with instruction_dict in fake_generic.py; added support of grid type of coupling map; using lower number of qubits, passed all tests of test_transpiler except one method ( test_parallel_dispatch_lazy_cal_loading )

* added tests for FakeGeneric

* This commit just reformats test_transpiler.py fake_generic.py and test_fake_generic.py

* Update qiskit/providers/fake_provider/fake_generic.py

Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com>

* Update qiskit/providers/fake_provider/fake_generic.py

Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com>

* Update test/python/providers/fake_provider/test_fake_generic.py

Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com>

* Update test/python/providers/fake_provider/test_fake_generic.py

Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com>

* Fix some tests

* Add calibration schedules, fix transpiler tests

* Fix lint

* Refactor, add pulse functionality

* Latest updates to FakeGeneric

* Fix some unit tests

* Fix some unit tests

* Fix tests, lint, refactor

* Remove unused inputs

* Make calibrations optional

* Attempt to speed up test: only add calibrations if option enabled

* Revert some tests to V1

* Refactor FakeGeneric

* Update unit test

* Rename supported instructions to operations, fix tests

Fix test seed

Fix unit test, lint

* Restore vf2postlayout test to V1

Fx vf2 test

* Add pulse test to validate pulse capabilities of new fake backend

Update fake generic

* Update docs, fix lint

* Avoid set for basis gates to allow reproducibility in the error/duration value generation

* Update calibrations

* Fix transpiler test

* Add run test to confirm noise defaults

* Add CZ to basis gates, dtm, update backend names, fix docs

* Remove GenericTarget, add default for basis_gates, remove supported_operations.

* Apply review comments, modify calibrate_instructions to avoid public calibration method.

* New name proposal

* Fix lint and test

* Fix comment

* Apply Kevin's suggestions to extract defaults from class

* Make defaults private

* Fix lint

* Revert previous 3 comments.

* Privatize GenericFakeBackend

* Remove from docs

* Revert privatization

* Apply review comments

* Add reno

* Fix lint

* Apply suggestions from Matt's code review

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Apply comments from code review

* Fix lint

* Rename to GenericBackendV2 and adjust docs.

* Fix lint

* Apply comments from code review

* It's not 2023 anymore

* Fix conflict

* Fix test conflict.

---------

Co-authored-by: atharva-satpute <55058959+atharva-satpute@users.noreply.github.com>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Co-authored-by: Elena Peña Tapia <epenatap@gmail.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Kevin Hartman <kevin@hart.mn>
2024-01-29 21:36:15 +00:00
Jake Lishman 052d889a7e
Revert memory-owning `expr.Var` nodes (#11667)
This commit is a roll-up reversion of the following commits (PR):

* commit a79e879664 (#10977)
* commit ba161e9294 (#10974)
* commit 50e8137467 (#10944)

This is being done to clear the 1.0 branch of memory-owning `expr.Var`
variables and `Store` instructions.  It should be re-applied once 1.0 is
released.

This wasn't done by individual `revert` operations, because there were
also significant structural changes introduced in those PRs that were
very valid and should be maintained.  Cross-references to `Var` nodes
from other functions have been removed for now.

Making `Var` and `types.Type` hashable is maintained, as is the
`Var.standalone` function, in order to prepare the ground for the
inclusion of proper `Var` nodes in a minor release.
2024-01-29 19:48:57 +00:00
John Lapeyre 11a826b9da
Reimplement two_qubit_decompose.num_basis_gates in rust (#11019)
* Use newer rust

* Adding weyl chamber code in rust

* Finish num_basis_gates in rust, but calculated values wrong

* Fix bugs in weyl_coordinates

* Upgrade faer from 0.12 to 0.13

* This will allow copyless convert of numpy complex matrix to faer
* abs2 disappeared probably an error, so we work around here.

* Use copyless conversion of complex matrix from numpy to faer

* Fix thinko bugs so that existing tests pass

* Add comment

* Remove allocation

* Replace loop with iterator

* Silence clippy complaints

* refactor

* Run rustfmt

* Slight refactor and format

* Reorganize new code in crate accelerate

* Moved `eigenvalues` into module `utils`.
* Access num_basis_gates via module two_qubit_decompose

* Remove some allocations

* Run rustfmt

* Raise faer version to 0.13.5, lower rustc to 1.67.0

faer 0.13.5 introduces a specific MSRV

* Fix some conflicts with main branch

* Fix more conflicts

* More conflicts

* More conflicts

* Update crates/accelerate/src/two_qubit_decompose.rs

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Apply suggestions from code review

Apply several suggested edits made in review

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Increase faer version and remove some cruft

* We introduced to_num_complex, but this required upgrading faer. We chose 0.15
* Upgrade our code, in turn, for the upgrade to faer 0.15
* Remove a function exported via pyo3 that was only used for testing
* Remove `def old_num_basis_gate`

* Make __num_basis_gates more idiomatic

* Explain use of `min_by` when `max_by` is expected

* Replace myabs2 with faer_abs2

We recently increased the version of the faer dependency.
The newer version has an abs2 in the api named `faer_abs2`.

So we can delete `myabs2`.

* Use alternative mod implementation following review requests

* Make pyo3 function eigenvalues return ndarray rather than list

Following review suggestion.

* Bump faer version to latest 0.16

This was previously at 0.15 for accidental reasons.

* Use rem_euclid for remainder

* Fix black complaint

* Fix pylint complaints

* Apply suggestions from code review

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Remove nalgebra feature from faer

* Use constants for fractions of pi

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-29 19:04:15 +00:00
dependabot[bot] df68feceb4
Bump indexmap from 2.1.0 to 2.2.1 (#11663)
* Bump indexmap from 2.1.0 to 2.2.1

Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.1.0 to 2.2.1.
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.1.0...2.2.1)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update other dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
2024-01-29 17:03:04 +00:00
Caleb Smith 5ebf7f1251
Add a kwarg for num_processes in the transpiler (#11554)
* Modify transpiler to parse all parameters before starting to run circuits. Create new function to run circuits and pass it to parallel map.

* input num_processes argument and allow None values

* Revert Changes to resolve conficts

* Allow value none for num_processes

* fix import for merged changes from main

* add reno and Tests

* remove unused import

* pass num_processes argument through the pass manager instead of through the transpiler. updated documentation
2024-01-29 15:13:26 +00:00
TsafrirA 042a1a12da
Remove optional `sympy` imports (#11662)
* remove optional sympy

* remove optional sympy

* remove optional sympy

* black,lint
2024-01-29 15:04:26 +00:00
Jason Ricciardi fefa722ae9
Remove visualization code deprecated in 0.22 (released on October 13, 2022) (#10989)
* Update _utils.py

Remove deprecated code:

qiskit/visualization/circuit/_utils.py:200
qiskit/visualization/circuit/_utils.py:288

* Update counts_visualization.py

There is code released 9 months ago that needs to be removed.

qiskit/visualization/counts_visualization.py:60

Include an example with an alternative for user to migrate to the new code, as this change might break users code.

* black

* Run tox

* Update qiskit/visualization/counts_visualization.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit/visualization/counts_visualization.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit/visualization/counts_visualization.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Cut down line length for lint

* Run tox

* Add release notes

* Update releasenotes/notes/remove-visualization-code-deprecated-in-0.22-7bc99235f5912424.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

---------

Co-authored-by: Luciano Bello <luciano@debian.org>
Co-authored-by: Hunter Kemeny <43501602+hunterkemeny@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
2024-01-29 15:01:35 +00:00
Jake Lishman d8e8369199
Ignore Pandas import warning in Seaborn (#11665)
* Ignore Pandas import warning in Seaborn

As of Pandas 2.2.0, a `DeprecationWarning` is raised during `import
pandas` if Pyarrow is not installed.  We only use Pandas transitively
through seaborn, so it's not our responsibility to verify the
compatibility; we assume Seaborn will handle things correctly if any
changes are needed around the time of Pandas 3.0.

This warning does not fail the CI test suite because `seaborn` (and thus
`pandas`) gets imported during test collection, _before_ our warning
filters kick in to turn deprecation warnings into errors.  The suite
does fail during the image tests of the `main` branch, though, because
there `seaborn` doesn't get checked until the tests actually run (that
suite assumes that the image-test requirements are present). We don't
see the same CI failure in PR because we use Python 3.8 there, which
Pandas 2.2 doesn't support, but we use Python 3.9 on `main` deliberately
to increase our coverage for things like this.

* Fix regex for Pandas newlines
2024-01-29 14:55:49 +00:00
Kevin J. Sung 8f0646aa38
export high_level_synthesis_plugin_names (#11549) 2024-01-29 14:17:06 +00:00
Matthew Treinish 8af340c7dc
Fix SetLayout to error with invalid int list input (#11653)
* Fix SetLayout to error with invalid int list input

This commit fixes an issue in the SetLayout transpiler pass when an
integer list is specified nothing was checking that the integer list
contained unique entries. Previously if a list containing duplciate
entries was passed in this would result in an invalid Layout object
being set on the property set. This would cause a cryptic error message
by later transpiler passes that would try and use that invalid Layout.
This commit fixes this by detecting if there are duplicate entries in
the int list and raising an exception directly.

* Use new exception class in test
2024-01-29 13:26:09 +00:00
Jake Lishman c9f1e7557b
Use explicit `IndexMap::swap_remove` in Sabre (#11664)
`indexmap` are moving to deprecate the `remove` function to push people
to be explicit about whether they want `swap_remove` or `shift_remove`
in IndexMap 2.2.0.  Sabre doesn't care about the order provided it's
deterministic and reproducible, so we just use the more efficient swap.
2024-01-29 13:16:31 +00:00
Shelly Garion 53581108fd
Remove qiskit.quantum_info.synthesis for Qiskit 1.0 release (#11592)
* remove deprecated code in clifford_decompose and cnotdihedral_decompose

* move tests from test/python/quantum_info to test/python/synthesis

* move the Quaternion class from quantum_info/synthesis to quantum_info

* deprecate cnot_rxx_decompose, and move to an internal code in the equivalence_library

* deprecate cnot_rxx_decompose

* move qsd from qiskit/quantum_info/synthesis to qiskit/synthesis/unitary

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle cyclic imports in qsd

* minor

* update qsd docs

* move one_qubit_decompose from qiskit/quantum_info/synthesis to qiskit/synthesis/one_qubit

* move xx_decompose from qiskit/quantum_info/synthesis to qiskit/synthesis/two_qubits

* handle cyclic imports

* move two-qubit synthesis code from qiskit/quantum_info/synthesis to qiskit/synthesis/two_qubits

* update qsd docs

* minor

* add release notes

* updates following review

* add disable cyclic import to rv.py

* add deprecation warning in qiskit/quantum_info/__init__.py

* fix links

* improve qsd docs following review

* remove qiskit.quantum_info.synthesis

* add release notes

* update qsd docs

* update release notes

* update release notes
2024-01-29 11:01:41 +00:00
Ali Javadi-Abhari bc26434ad3
update github issue template (#11661) 2024-01-29 09:38:32 +00:00
Will Shanks f783fe80b2
Add uuid property to Parameter (#11647)
* Add uuid property to Parameter

This change adds a public, read-only uuid property to Parameter which
can be used in advanced use cases for getting the uuid value to pass to
the Parameter constructor.

* Add intersphinx reference to UUID

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Reference uuid instead of _uuid

* Add Parameter equality test

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-26 23:04:13 +00:00
Alexander Ivrii f35d157460
Supporting floating-point exponents in ``Operator.power`` (#11534)
* changing Operator and Gate power methods to use scipy.fractional_matrix_power

* release notes

* using schur-based implementation from gate.py; updating release notes; test
2024-01-26 21:11:02 +00:00
Ian Hincks ce02f068ae
Add BindingsArray as allowed input type to BindingsArray.coerce() (#11645) 2024-01-26 06:36:55 +00:00
Jake Lishman ec859e174c
Invalidate `QuantumCircuit.parameters` cache on global-phase modification (#11641)
Previously, replacing a parametric `global_phase` with a non-parametric
global phase would modify the `ParameterTable` without invalidating the
`parameters` cache that the circuit kept.
2024-01-25 18:23:38 +00:00
Alexander Ivrii 8c29cee6bd
Extend `CommutativeInverseCancellation` to cancel pairs of gates up-to-phase (#11248)
* pass, tests, reno

* using assertAlmostEqual for checking floating-point calculations

* renaming

* improving description

* simplifying code based on review

* renaming; changing order of arguments; propagating max_qubits to commutativity checker; docs improvements

* doc-string improvements
2024-01-25 16:42:49 +00:00
Shelly Garion 1c20b84204
Remove qiskit.transpiler.synthesis for Qiskit 1.0 release (#11570)
* deprecate transpiler/synthesis/graysynth.py

* style

* style

* move aqc_plugin to qiskit/transpiler/passes/synthesis

* remove code from qiskit/transpiler/synthesis/aqc/aqc_plugin.py

* copy qiskit/transpiler/synthesis/aqc to qiskit/synthesis/unitary

* move tests from test/python/transpiler/aqc to test/python/synthesis/aqc

* update imports in aqc_plugin

* add deprecation warning to AQC module

* handle cyclic imports

* handle cyclic imports

* update link in docs

* update init in qiskit/transpiler/synthesis/aqc

* style

* temporary remove deprecation warning test

* remove files from qiskit/transpiler/synthesis/aqc

* update link in test

* add release notes

* update docs

* update docs/apidocs/synthesis_aqc.rst

* add deprecations to qiskit/transpiler/synthesis/__init__.py

* fix link

* remove qiskit/transpiler/synthesis

* add release notes

* improve docs

* add import aqc to qiskit.synthesis

* fix lint errors
2024-01-25 12:30:14 +00:00
Matthew Treinish 3364ba5023
Remove qiskit-experiments from asv benchmarks (#11225)
The qiskit-experiments package was used in two places in qiskit's asv
benchmarks, the state tomography benchmark and the randomized
benchmarking circuit compilation benchmark. However, qiskit-experiments
is a downstream dependency of qiskit and trying to leverage it as
benchmark load generation is problematic because it introduces a
bidirectional dependency. It turns out these benchmarks don't really
need to use qiskit-experiments, the state tomography benchmarks aren't
really qiskit benchmarks directly. They include post-processing runtime
from qiskit-experiments and they're a much better benchmark for
qiskit-experiments rather than qiskit. The randomized benchmarking
circuit compilation benchmark is only using qiskit-experiments as a
randomized benchmarking circuit generator and we can replace it with
just manual circuit generation.  This commit makes these changes and
removes qiskit-experiments from the asv configuration.
2024-01-24 19:08:05 +00:00
Luciano Bello 1d45d472fc
New URLs in project.urls (#11550)
* change metadata

* Update pyproject.toml

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-24 17:32:27 +00:00
Luciano Bello 1a027ac3a8
Remove execute() function (#11565)
* port 11044

* reno

* upgrade reno

* docs

* adapt test

* Update examples/python/using_qiskit_terra_level_0.py

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* example

* docs qiskit.execute_function.execute

* docs adapting

* doc index

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
2024-01-24 11:33:53 +00:00
Kaushik Chintam c63bda7dd2
Typo Fixed on #11611 QuantumCircuit initialize() links to StatePreparation and Initialize need fixing (#11631) 2024-01-24 09:40:20 +00:00
Henry Zou b5c4da338d
Remove deprecated features in 0.45 in quantumcircuit (#11577)
* Removed header from quantumcircuit

* Removed extension_lib from quantumcircuit

* Removed i from quantumcircuit

* Removed fredkin from quantumcircuit

* Removed cnot from quantumcircuit

* Removed toffoli from quantumcircuit

* Removed mct from quantumcircuit

* Removed diagonal from quantumcircuit

* Removed iso from quantumcircuit

* Update for removing iso

* Removed Hailtonian from quantumcircuit

* Removed uc from quantumcircuit

* Removed ucrx from quantumcircuit

* Removed ucry from quantumcircuit

* Removed ucrz from quantumcircuit

* Removed squ from quantumcircuit

* Removed snapshot from quantumcircuit

* Removed circuit method deprecations

* Added release notes

* Removed squ in extensions

* Fixed circuit method tests

* Fixed lint

* Update releasenotes/notes/remove-deprecated-quantumcircuit-a8c69a8e0b480e17.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Removed squ test

* Update releasenotes/notes/remove-deprecated-quantumcircuit-a8c69a8e0b480e17.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
2024-01-24 09:38:56 +00:00
Ian Hincks 76872657d1
Change `BaseEstimator/SamplerV2` to be abstract. (#11630) 2024-01-24 03:17:28 +00:00
dependabot[bot] 6bfeb508e6
Bump rustworkx-core from 0.13.2 to 0.14.0 (#11628)
* Bump rustworkx-core from 0.13.2 to 0.14.0

Bumps [rustworkx-core](https://github.com/Qiskit/rustworkx) from 0.13.2 to 0.14.0.
- [Release notes](https://github.com/Qiskit/rustworkx/releases)
- [Commits](https://github.com/Qiskit/rustworkx/compare/0.13.2...0.14.0)

---
updated-dependencies:
- dependency-name: rustworkx-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix token_swapper usage

In rustworkx-core 0.14.0 a breaking API change was documented in the
return signature [1] to now return a Result<Vec<(NodeIndex, NodeIndex)>>
instead of a Vec<(NodeIndex, NodeIndex)> to account for new error
handling. This commit updates the usage of the token swapper function in
sabre swap to handle this API change.

[1] https://www.rustworkx.org/release_notes.html#upgrade-notes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-23 20:58:30 +00:00
Matthew Treinish 944a21dcd4
Build release wheels for tier 1 platforms with PGO (#11502)
* Build release wheels for tier 1 platforms with PGO

This commit adds the infrastructure to build the wheels we publish to
PyPI at release time with PGO. Profile guided optimization (PGO) is a
compiler technique that uses collected data about a typical execution
to inform optimizations the compiler can make about building the output
binary. For more details on PGO you can refer to the Rust [1] and Clang
[2] documention on the topic.

To start the only data collected is from running the qiskit
unittests. This should give us some broad coverage as we'll exercise
everything as we do in the unittests. This also means as we grow our
Rust usage in Qiskit we'll continue to cover that code in the unittests
and ensure we have coverage in PGO too. However, longer term we'll
potentially want to look at dedicated PGO scripts that exercise Qiskit
at larger scale than what we can do in the unittests.

[1] https://doc.rust-lang.org/rustc/profile-guided-optimization.html
[2] https://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization

* Add comment about per job overrides

* Make merged path configurable

* Update pyproject.toml

* Update tools/build_pgo.sh
2024-01-23 20:08:04 +00:00
Jake Lishman 077760e55f
Fix `tox` configuration for optional packages pre-1.0 (#11621)
A recurring problem for us: the dependency on ourselves from Aer,
coupled with `tox` installing dependencies before building the package,
means that tox environments containing the optionals first pull in
`qiskit-terra`, then attempt to upgrade in situ to Qiskit 1.0, resulting
in a broken environment.

This modifies the `tox` configuration to install the optionals in a
pre-commands step instead as part of dependency management.  This will
cause those two environments to become more liable to get out-of-sync if
the dependencies change, but that's nothing a `tox -r` wouldn't fix, and
we don't change the optional dependencies often.
2024-01-23 19:30:26 +00:00
Matthew Treinish 6c3f047d94
Optimize standard gate library equality (#11370)
* Optimize standard gate library equality

This commit updates the standard library gate classes' to define an
__eq__ methods to optimize the runtime performance. Their parent class
`Instruction`'s __eq__ is optimized for generality to compare equality
between any gate instruction object. But this generality has a runtime
cost which is unnecessary for the standard library gates which it
equality is much simpler. This commit adds the faster path equality
check for the standard gate library classes which will improve the
performance of anything doing a lot gate equality.

* Use consistent tolerance with Instruction.__eq__

* Add U gate

* Unify parameter value comparisons

* Add missing control state check on CSXGate

* Fix issues with migration to common parameter handling

* Remove unused import
2024-01-23 19:26:11 +00:00
Ian Hincks b25d5b42f0
Fix `BindingsArray` and `ObservablesArray` `reshape` to behave like NumPy (#11608)
* Fix BindingsArray.reshape and ObservablesArray.reshape to behave like NumPy

* improve reshaping tests to be more  comprehensive

* Fix bug with non-empty parameters when no kwals present

* Remove as_array() method

This method doesn't really serve an obvious purpose.
It would make more sence to have an nd-enumerate-like method to loop over parameter value sets instead.
2024-01-23 18:09:39 +00:00
Shelly Garion 8887f44362
Deprecate qiskit/quantum_info/synthesis and move to qiskit/synthesis (#11460)
* remove deprecated code in clifford_decompose and cnotdihedral_decompose

* move tests from test/python/quantum_info to test/python/synthesis

* move the Quaternion class from quantum_info/synthesis to quantum_info

* deprecate cnot_rxx_decompose, and move to an internal code in the equivalence_library

* deprecate cnot_rxx_decompose

* move qsd from qiskit/quantum_info/synthesis to qiskit/synthesis/unitary

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle lint and docs errors in qsd

* handle cyclic imports in qsd

* minor

* update qsd docs

* move one_qubit_decompose from qiskit/quantum_info/synthesis to qiskit/synthesis/one_qubit

* move xx_decompose from qiskit/quantum_info/synthesis to qiskit/synthesis/two_qubits

* handle cyclic imports

* move two-qubit synthesis code from qiskit/quantum_info/synthesis to qiskit/synthesis/two_qubits

* update qsd docs

* minor

* add release notes

* updates following review

* add disable cyclic import to rv.py

* add deprecation warning in qiskit/quantum_info/__init__.py

* fix links

* improve qsd docs following review

* update qsd after review

* change pending deprecatrion to deprecation in ion_decompose

* update release notes following review

* update pending deprecation to deprecation

* add test for a deprecation

* add more tests for deprecations

* add another test for deprecation

* handle lint errors

* minor fix following review

* remove test for _cnot_rxx_decompose() private method
2024-01-23 17:30:32 +00:00
Naoki Kanazawa 9d43757bcd
Backend converter bugfix (edge case) (#11609)
* Bug fix backend converter

* Add upgrade note
2024-01-23 17:20:06 +00:00
Luciano Bello 9b5c9c6cba
[1.0] upgrade to symengine>=0.11 (#11315)
* update symengine>=0.11

* revert changes in the test

* reno

* test

* revert

* test

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-23 15:32:03 +00:00
FabianBrings b5aaffbf2d
Remove psutil as a dependency (#11336)
* initial commit

* fixed missing import

* set sabreswap test trials to 2

* added check to determin number of cpus

* formatting error

* unittest excetion for hardware detection

* formatting error

* Fix handling of non-linux default CPU usage

* Update release note

* Expand testing

* Remove unused import

* Update mock to work on non-linux platforms

* Fix lint

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
2024-01-23 14:47:11 +00:00
Jake Lishman fdc18d4ddf
Fix lurking `qiskit.tools` usage (#11625)
* Fix lurking `qiskit.tools` usage

A few places in docstrings where we'd left in references to
`qiskit.tools`.  At least one of these was executed as part of the
documentation build, so was causing failures that weren't being caught
because `tox` is currently building an invalid environment for the docs
for Qiskit 1.0.

* Remove other old import paths

Co-authored-by: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com>

---------

Co-authored-by: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com>
2024-01-23 13:58:58 +00:00
Shelly Garion 937ca5b313
Deprecate qiskit/transpiler/synthesis and move to qiskit/synthesis (#11426)
* deprecate transpiler/synthesis/graysynth.py

* style

* style

* move aqc_plugin to qiskit/transpiler/passes/synthesis

* remove code from qiskit/transpiler/synthesis/aqc/aqc_plugin.py

* copy qiskit/transpiler/synthesis/aqc to qiskit/synthesis/unitary

* move tests from test/python/transpiler/aqc to test/python/synthesis/aqc

* update imports in aqc_plugin

* add deprecation warning to AQC module

* handle cyclic imports

* handle cyclic imports

* update link in docs

* update init in qiskit/transpiler/synthesis/aqc

* style

* temporary remove deprecation warning test

* remove files from qiskit/transpiler/synthesis/aqc

* update link in test

* add release notes

* update docs

* update docs/apidocs/synthesis_aqc.rst

* add deprecations to qiskit/transpiler/synthesis/__init__.py

* fix link

* improve docs following review

* update docs

* add aqc to synthesis docs after review

* update qiskit/transpiler/synthesis/aqc/__init__.py after review

* update pending deprecation to deprecation in release notes

* handle cyclic imports

* update qiskit/synthesis docs following docs error

* another attempt to add AQC to synthesis docs

* another attempt to add AQC to the docs

* Revert "another attempt to add AQC to the docs"

This reverts commit 25f93cae91.

* Revert "another attempt to add AQC to synthesis docs"

This reverts commit 9e87164e1f.

* add a deprecation test for AQC

* minor
2024-01-23 08:07:39 +00:00
Kevin J. Sung 30bf727eb9
Fix incorrect TeX (#11599)
* fix tex

* use aligned instead of align*

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
2024-01-22 16:31:40 +00:00