Skip to content

Fix density matrix ResetTo to use the sampled state - #600

Open
vera-rubin wants to merge 1 commit into
QuantumBFS:masterfrom
vera-rubin:fix/density-reset
Open

vera-rubin wants to merge 1 commit into
QuantumBFS:masterfrom
vera-rubin:fix/density-reset

Conversation

@vera-rubin

Copy link
Copy Markdown

Measuring a one-qubit density matrix in |1⟩⟨1| with ResetTo(bit"0") returns outcome 1 but leaves NaNs and a NaN trace. The documented reset should leave |0⟩⟨0| with trace one.

using YaoArrayRegister, LinearAlgebra
rho = DensityMatrix(ComplexF64[0 0; 0 1])
measure!(ResetTo(bit"0"), rho)
@show state(rho) tr(state(rho))

We now move the sampled density matrix block to the requested reset configuration and normalize it, preserving the conditional state of unmeasured qubits.

We added a regression test for full and partial resets and ran the YaoArrayRegister test suite.

— ChipLab

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant