Fix primitives metadata (#9285)

* Fix bug metadata

Co-authored-by: Julian Schuhmacher <jsc@zurich.ibm.com>

* Add reno

* Re-trigger CI

* Fix typo

Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>

Co-authored-by: Julian Schuhmacher <jsc@zurich.ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
This commit is contained in:
ElePT 2022-12-20 19:58:55 +01:00 committed by GitHub
parent 9733fc0ca9
commit 1caf0306e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -109,7 +109,7 @@ class Estimator(BaseEstimator):
rng = np.random.default_rng(seed)
# Initialize metadata
metadata: list[dict[str, Any]] = [{}] * len(circuits)
metadata: list[dict[str, Any]] = [{} for _ in range(len(circuits))]
bound_circuits = []
for i, value in zip(circuits, parameter_values):

View File

@ -101,7 +101,7 @@ class Sampler(BaseSampler):
rng = np.random.default_rng(seed)
# Initialize metadata
metadata: list[dict[str, Any]] = [{}] * len(circuits)
metadata: list[dict[str, Any]] = [{} for _ in range(len(circuits))]
bound_circuits = []
qargs_list = []

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixed a bug in the primitives' metadata, where the list made copies by reference and
all elements were updated with the same value at every iteration.