qiskit/releasenotes/notes/0.19
Matthew Treinish 05cbc445af
Fix QPY support for control flow instructions (#7584)
* Fix QPY support for control flow instructions

This commit fixes support for using qpy serialization with circuits that
contained control flow instructions. Previously, if you attempted to
serialize a circuit that contained control flow instructions it would
error as qpy didn't support embedding the circuit blocks as parameters
for the instructions. This has been fixed and other missing pieces for
fully reconstructing circuits with control flow were added. This
requires bumping the version string to v4 because to accurately
reconstruct control flow circuits we needed to be able to represent
registers that were only partially present in a circuit fully. V4 also
adds a representation for ranges which didn't exist in earlier versions.

Fixes #7583

* Fix handling of standalone register bits in circuit

This commit fixes the failing tests by correcting the handling of
standalone register bits that are part of a circuit (without their
register). Previosuly, if the circuit was solely composed of register
bits but the circuit didn't contain that register, qpy deserialization
would incorrectly add the register to the circuit. This corrects this by
having the deserialization function treat a register that's not in
circuit in the same manner as if it were an out of order register and
add each bit one at a time.

* Add test for for loop with iterator

* Add backwards compat tests for control flow

* Finish release notes

* Fix docs build

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Add handling for ContinueLoopOp too

* Cleanup note about register index array type change

* Use unique doc reference names for qpy module

* Update qpy version 3 ref in release note

* Switch tuple to support any qpy type instead of just ints

This commit changes the tuple formatting to work with any parameter type
that qpy currently supports, not just ints which is what for loop
currently uses a tuple for. This should provide some future proofing as
it enables tuples of other types, which is being considered in the
future, to work without modification.

* Update another broken sphinx ref

* Fix last dangling broken sphinx ref

* Fix yet another dangling sphinx ref

* Fix failing test

* Set fixed Python hash seed in qpy compat tests

This commit updates the qpy compat test runner script to set a fixed
hash seed. The control flow builders internally use sets which means
that to get consistent ordering between python processes we need to
ensure the hash seeds are the same. Without this the argument order
might differ between creating the circuit for qpy serialization and
reconstructing the circuit in another process by deserializing that
qpy data. Setting a fixed hash seed between processes ensures this type
of failure won't happen as the set order will be consistent between
multiple runs of Python.

* Update qiskit/circuit/qpy_serialization.py

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Fix docstring for TUPLE payload

This commit fixes an oversight in earlier commits where the
documentation for the TUPLE payload wasn't actually finished wasn't
really coherent. This commit finishes the documentation to explain how a
tuple is serialized in qpy.

* Add test case using nested tuples

* Directly construct WhileLoopOp in qpy compat tests

In an earlier commit we set a fixed (but still randomly generated) python
hash seed to force multiple invocations of python to use the same hash
seed. This was done in order to fix a non-deterministic failure we were
seeing with the while loop circuit. The while loop context builder uses
a set internally and is sensitive to argument ordering. However, just
hash seed randomization doesn't fix the issue in practice because the
difference isn't between set order strictly, but also that set order
matches the circuit insertion order for what gets written in QPY. To
address this and make the tests work stably this commit switches away
from using the builder interface and instead manually constructs the
while loop and appends it to the circuit with a fixed argument order.
This should hopefully make the compat tests run consistently and fix the
occasional failures we're seeing in CI.

* Fix lint

* Add test case for serializing an empty tuple instruction parameter

* Avoid builder interface for qpy compat tests

Just as was changed for the while loop generator function in the qpy
compat tests this commit updates the other control flow example circuits
to not use the builder interface. The same non-determinism in the
ordering of arguments applies to all the control flow instructions. So
to avoid spurious failures we should explicitly set a arg order and not
use the builder interface.

Co-authored-by: Jake Lishman <jake@binhbar.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-02 02:11:53 +00:00
..
0.19-prelude-65c295aa9497ed48.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
7156-df1a60c608b93184.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
7274-6f57628a7995a461.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
QuantumCircuit.decompose-takes-which-gate-to-decompose-d857da5d0c41fb66.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
SPSA-termination-callback-a1ec14892f553982.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-backend-v2-ce84c976fb13b038.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-circuit-calibrations-to-diassambler-2e68437a815cc729.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-contains_instruction-pass-dcad5f1978ee1e24.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-detach-prefix-088e96b88ba29927.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-gate-error-objective-00a96f75055d1526.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-getters-and-setters-for-vqe-edc753591b368980.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-group-qubit-wise-commuting-pauli-list-7b96834068a36928.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-hexagonal-lattice-couplingmap-d3b65b146b6cd1d1.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-new-fake-backends-3376682dc5c63557.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-opflow-is-hermitian-method-6a461549e3c6b32c.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-passmanager-config-from-backend-af5dd7d99ec053ef.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-pulse-gate-pass-dc347177ed541bcc.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-qubit-subset-to-bip-mapper-e1c6234d04484d58.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-sparsepauliop-fast-path-228065a05fca4387.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-sparsepauliop-sum-d55fc817c9fded82.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
add-support-to-disable-amplitude-limit-in-parametric-pulses-ef88b77db8c1b06c.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
added-multiformat-support-b5d3c7c7c1536951.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
added-snapshot-tests-for-backend-mapping-functions-5961300e09f05be0.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
approxiamte-quantum-compiler-3c74652d4c5e9fa6.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
bugfix-6918-4b3cc4056df39e48.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
bump-retworkx-0.10.1-1fcf4fc746bd754a.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
calibration_results-ac2f9f75479e8d64.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
circuit-size-depth-filter-function-2177a8a71588f915.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
collect-block-pass-b15031aa9749d735.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
control-flow-builder-interface-63910843f8bea5e0.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
dag_node_to_op_in_out_node-af2cf9c3e7686285.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
deprecate-mcmt-label-12865e041ce67658.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
deprecate-subgraph-coupling_map-93af284f5410e4b0.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
deprecation-cleanup-3d3e203e2d6e6f31.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
draw-statevector-in-ket-notation-0726959d1f6ea3ce.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
echo-rzx-weyl-decomposition-ef72345a58bea9e0.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
ensure-qnspsa-batching-e48f7ec72412c071.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
execute-fix-108e835dc4f4593d.yaml Fixed Code Error in Release Notes 0.34.1(Issue #7521) (#7522) 2022-01-12 14:11:44 +00:00
expr_free_symbols_deprecation-72e4db5c178efcff.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
feature-rzx-decomposition-c3b5a36b88303c1f.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
feature_optimize_1q_commutation-28530970f58fb21e.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-ax-figwidth-scaling-mpl-drawer-dc480ccf82dc1007.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-bit-failures-circuit-drawers-cc502c9cb7f90e2b.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-c3sxgate-7138e004a2b05ca8.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-circuit-conversion-loose-qubits-8d190426e4e892f1.yaml Fix circuit instruction conversion with loose bits (#7365) 2021-12-07 12:30:21 -05:00
fix-configurable-fake-backend-6a07ca5a6159baf5.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-control-flow-builder-parameter-copy-b1f6efcc6bc283e7.yaml Fix copying control-flow bodies in builder interface (#7368) 2021-12-07 21:20:47 +00:00
fix-decompose-empty-gate-71455847dcaaea26.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-display-measure-condition-139ddbb8c7ae4071.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-hoare-optimizer-0ef5ac330fc80cc4.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-infinite-job-submissions-d6f6a583535ca798.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-instruction-c_if-3334bc8bcc38a327.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-latex-drawer-bit-cond-d629c04a08e81d6d.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-matplotlib-3.5-40f6d1a109ae06fe.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-mpl-drawer-bit-condition-90c4dac2defdd8c6.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-nlocal-add_layer-c3cb0b5a49c2b04e.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-pickle-support-instmap-9f90cbcb4078f988.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-pulse-parameter-formatter-c9ff103f1a7181e0.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-qaoa-construct-da37faf75f29fc35.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-qasm-invalid-names-04a935a3a14e045c.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-registerless-one-bit-displays-4deb8f7cecf3f602.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-registerless-qasm-output-7a497dd8e9a0706b.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-scheduling-circuits-with-clbits-operations-e5d8bfa90e9a3ae1.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-text-drawer-bit-cond-a3b02f0b0b6e3ec2.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix-transpile-empty-list-c93a41d4145a01c3.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
fix_pwchebysev_constant_fx-93e8a3d2880f68ac.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
full_prec_sympy-aeee8210091ef20f.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
gates-in-basis-pass-337f6637e61919db.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
heavy-hex-heavy-square-coupling-map-29f459b93cd18518.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
hhl-negative-eigenvalues-ef11d231181e8043.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
hhl_qi_fix-d0ada86abaa2dba5.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
ignis-mitigators-70492690cbcf99ca.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
listops-coeffs-1e04a34b46b2fd23.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
make-statevector-subscriptable-and-add-inner-product_method-a0337393d9a5b666.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
measure_all-add_bits-8525317935197b90.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
modify-copy-instruction-in-qasm-abd5c9767f2a7f38.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
more-forgiving-numeric-conversions-in-ParameterExpression-6cd7316c32c67c55.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
mpl-bump-33a1240266e66508.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
optimizer-minimize-5a5a1e9d67db441a.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
pauli-evolution-gate-ad767a3e43714fa7.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
pauli-op-permute-fix-d244a1145093369d.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
plot_coupling_map-new-function-deb973b1bf0ad92f.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
qaoa-parameters-49e4524ed2d3e875.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
qasm3-limitations-ebfdedab3f4ab6e1.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
qasm3_dumps-7475de655e1acb24.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
qdrift-as-product-formula-044a37a106a45a47.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
qiskit.util-louder-deprecation-135d9e9ead7ab396.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
qpy-v2-f1c380b40936cccf.yaml Fix QPY support for control flow instructions (#7584) 2022-02-02 02:11:53 +00:00
quantumcircuit-consolidate-bit_indices-c4ee90e831f1aed2.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
quantumcircuit-dynamic-instructions-a69db25665739004.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
random-shift-38532a7321cd8313.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
readout-mitigation-classes-2ef175e232d791ae.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
refactor-grover-isgoodstate-check-54fdb61f899e5158.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
remove-deprecated-ops-2fbd27abaee98c68.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
remove-deprecated-pulse-code-57ec531224e45b5f.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
remove-final-measure-rewrite-37d26dbba7385ebc.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
remove-manual-warning-filters-028646b73bb86860.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
remove-schemas-ca9f3f2e0f08bca8.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
replace-block-with-op-e0d387f6d860d586.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
retworkx-substitute_node_with_dag-speedup-d7d1f0d33716131d.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
sabre-opt-lvl3-default-550924470d683112.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
sparse-pauli-internal-8226b4f57a61b982.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
squ-gate-name-785b7896300a92ef.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
support-dict-for-aux-operators-c3c9ad380c208afd.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
symengine-bump-20dedd5204870e7a.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
taper_empty_operator_fix-53ce20e5d2b68fd6.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
target-in-transpiler-c0a97bd33ad9417d.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
two-step-transpile-f20d709a7a0c42dd.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
unitary-synthesis-plugin-a5ec21a1906149fa.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
user-config-mpl-style-a9ae4eb7ce072fcd.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00
vf2layout-4cea88087c355769.yaml Prepare release notes for Qiskit Terra 0.19 (#7329) 2021-12-06 18:19:30 +00:00