Questions Measuring Density Matrices In-Place (#532) #533
-
Hi everyone! I noticed that commit #532 was recently merged, introducing the ability to measure density matrices in place. Thanks to those involved in developing it, appreciate it greatly. This feature is incredibly relevant for my current work, so I cloned the repository and set it up in my local environment. However, I’ve encountered some issues while testing, and I wanted to confirm whether I’m using the functionality correctly or if something might still be incomplete in the implementation. Here are two examples I tried (taken from the tests) : Example 1I initialized a density matrix and attempted to measure it: reg = uniform_state(5)
rho = density_matrix(reg, (1, 2, 3))
res = measure!(ResetTo(bit"10"), rho, (1, 2)) This produced the following error: MethodError: no method matching focus!(::DensityMatrix{2, ComplexF64, Matrix{ComplexF64}}, ::Tuple{Int64, Int64})
Closest candidates are:
focus!(::AbstractArrayReg{D}, ::Any) where D
@ YaoArrayRegister ~/.julia/packages/YaoArrayRegister/f7qQa/src/focus.jl:84 Example 2 r = density_matrix(ghz_state(3))
collapseto!(r, (1, 2) => (0, 0))
res = measure(r; nshots=1000) This resulted in: MethodError: no method matching collapseto!(::DensityMatrix{2, ComplexF64, Matrix{ComplexF64}}, ::Pair{Tuple{Int64, Int64}, Tuple{Int64, Int64}}) I verified that the new functions introduced by commit #532 are present in my local Yao files, so it seems like the issue might not be due to an outdated repository. Questions: Thanks in advance for your guidance and support! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Since this feature is not registered yet. As a temperary fix, please dev all relevant packages. e.g. The following commands fixes your issue (@v1.11) pkg> activate --temp
Activating new project at `/var/folders/nn/smw2hcnx18z1l6blf_p59x740000gn/T/jl_M9Ipkf`
(jl_M9Ipkf) pkg> dev YaoArrayRegister YaoBlocks Yao |
Beta Was this translation helpful? Give feedback.
Since this feature is not registered yet. As a temperary fix, please dev all relevant packages. e.g. The following commands fixes your issue