diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index c49d3d6591..8cefd26473 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -4,9 +4,12 @@ ### Breaking changes +* `dynamic_one_shot` uses shot-vectors in the auxiliary tape to tell the device how many times to repeat the tape. Lightning-Qubit is updated accordingly. + [(#724)](https://github.com/PennyLaneAI/pennylane-lightning/pull/724) + * `dynamic_one_shot` deals with post-selection during the post-processing phase, so Lightning-Qubit does not return `None`-valued measurements for mismatching samples anymore. [(#720)](https://github.com/PennyLaneAI/pennylane-lightning/pull/720) - + ### Improvements * Update C++ and Python GitHub actions names to include the matrix info. @@ -17,12 +20,12 @@ * The various OpenMP configurations of Lightning-Qubit are tested in parallel on different Github Actions runners. [(#712)](https://github.com/PennyLaneAI/pennylane-lightning/pull/712) - + * Update Linux wheels to use `manylinux_2_28` images. [(#667)](https://github.com/PennyLaneAI/pennylane-lightning/pull/667) * Add support for `qml.expval` and `qml.var` in the `lightning.tensor` device for the `quimb` interface and the MPS method. - [(#686)](https://github.com/PennyLaneAI/pennylane-lightning/pull/686) + [(#686)](https://github.com/PennyLaneAI/pennylane-lightning/pull/686) * Changed the name of `lightning.tensor` to `default.tensor` with the `quimb` backend. [(#719)](https://github.com/PennyLaneAI/pennylane-lightning/pull/719) diff --git a/.github/workflows/tests_lgpu_python.yml b/.github/workflows/tests_lgpu_python.yml index d6a3bc0fc2..680df88ed4 100644 --- a/.github/workflows/tests_lgpu_python.yml +++ b/.github/workflows/tests_lgpu_python.yml @@ -13,7 +13,7 @@ on: release: pull_request: paths-ignore: - - .github + - .github/** - '!.github/workflows/tests_lgpu_python.yml' - pennylane_lightning/core/_version.py - pennylane_lightning/core/src/simulators/lightning_kokkos/** diff --git a/.github/workflows/tests_lgpumpi_python.yml b/.github/workflows/tests_lgpumpi_python.yml index 3b3cecdec9..ff6c24f8df 100644 --- a/.github/workflows/tests_lgpumpi_python.yml +++ b/.github/workflows/tests_lgpumpi_python.yml @@ -16,7 +16,7 @@ on: - main pull_request: paths-ignore: - - .github + - .github/** - '!.github/workflows/tests_lgpumpi_python.yml' - pennylane_lightning/core/_version.py - pennylane_lightning/core/src/simulators/lightning_kokkos/** diff --git a/.github/workflows/tests_lkcpu_python.yml b/.github/workflows/tests_lkcpu_python.yml index 3ecec03276..3c9b0fc194 100644 --- a/.github/workflows/tests_lkcpu_python.yml +++ b/.github/workflows/tests_lkcpu_python.yml @@ -12,7 +12,7 @@ on: description: The version of PennyLane to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master) pull_request: paths-ignore: - - .github + - .github/** - '!.github/workflows/tests_lkcpu_python.yml' - pennylane_lightning/core/_version.py - pennylane_lightning/core/src/simulators/lightning_gpu/** diff --git a/.github/workflows/tests_lkcuda_python.yml b/.github/workflows/tests_lkcuda_python.yml index 52884ff9b9..264de1e51e 100644 --- a/.github/workflows/tests_lkcuda_python.yml +++ b/.github/workflows/tests_lkcuda_python.yml @@ -12,7 +12,7 @@ on: description: The version of PennyLane to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master) pull_request: paths-ignore: - - .github + - .github/** - '!.github/workflows/tests_lkcuda_python.yml' - pennylane_lightning/core/_version.py - pennylane_lightning/core/src/simulators/lightning_gpu/** diff --git a/.github/workflows/tests_lqcpu_python.yml b/.github/workflows/tests_lqcpu_python.yml index 01e2f77670..ebc7c35fd7 100644 --- a/.github/workflows/tests_lqcpu_python.yml +++ b/.github/workflows/tests_lqcpu_python.yml @@ -12,7 +12,7 @@ on: description: The version of PennyLane to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master) pull_request: paths-ignore: - - .github + - .github/** - '!.github/workflows/tests_lqcpu_python.yml' - pennylane_lightning/core/_version.py - pennylane_lightning/core/src/simulators/lightning_gpu/** diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index b1bdc4a571..2f920cb939 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.37.0-dev7" +__version__ = "0.37.0-dev8" diff --git a/pennylane_lightning/lightning_qubit/lightning_qubit.py b/pennylane_lightning/lightning_qubit/lightning_qubit.py index 7d626ad89f..fff9d8acaf 100644 --- a/pennylane_lightning/lightning_qubit/lightning_qubit.py +++ b/pennylane_lightning/lightning_qubit/lightning_qubit.py @@ -78,11 +78,23 @@ def simulate(circuit: QuantumScript, state: LightningStateVector, mcmc: dict = N state.reset_state() has_mcm = any(isinstance(op, MidMeasureMP) for op in circuit.operations) if circuit.shots and has_mcm: - mid_measurements = {} - final_state = state.get_final_state(circuit, mid_measurements=mid_measurements) - return LightningMeasurements(final_state, **mcmc).measure_final_state( - circuit, mid_measurements=mid_measurements + results = [] + aux_circ = qml.tape.QuantumScript( + circuit.operations, + circuit.measurements, + shots=[1], + trainable_params=circuit.trainable_params, ) + for _ in range(circuit.shots.total_shots): + state.reset_state() + mid_measurements = {} + final_state = state.get_final_state(aux_circ, mid_measurements=mid_measurements) + results.append( + LightningMeasurements(final_state, **mcmc).measure_final_state( + aux_circ, mid_measurements=mid_measurements + ) + ) + return tuple(results) final_state = state.get_final_state(circuit) return LightningMeasurements(final_state, **mcmc).measure_final_state(circuit)