QuantumBFS / Yao.jl

Extensible, Efficient Quantum Algorithm Design for Humans.
https://yaoquantum.org
Other
910 stars 118 forks source link

dispatch(Ry(0), :random) is not working correctly #480

Open simonschnake opened 9 months ago

simonschnake commented 9 months ago

Dear all,

dispatch(Ry(0), :random)

is setting the angle theta in the range of [0, 1], which is probably not wanted.

Thank you Simon

GiggleLiu commented 9 months ago

Hi, thanks for the issue. The following patch would immediately fix the issue:

julia> Yao.render_params(r::RotationGate, ::Val{:random}) = (rand()*2π,)

Do you think we should merge it to Yao so that it can be the default behavior? I am a bit worried that users would think this behavior can be not very predictable. For example, the time evolution block still generate random t in range [0, 1] for no reason.