Yao tutorial Pluto notebook: manual cell execution anomaly
hros opened this issue · comments
I started going through Yao's tutorial notebooks, and I noticed something peculiar when running the application tutorial in Pluto:
If I rerun the cell with the command state(a)
(by pressing Shift+Enter) the result changes to (approximately) |00>
instead of (|00>+|11>)/\sqrt 2
I know that Pluto is reactive, and usually there should not be any reason to rerun a cell, but... it still seems strange (naturally, this doesn't happen in the REPL)
Other cells in this notebook seem to be OK with reexecution by Shift+Enter. Except for the other state
cell, which is state(q1)
which also causes the output to change to approximately |00>
instead of precisely |00>
.
If I change the value of q1
, it causes the output of reexecution of state(a)
to change to that value. It seems that the somehow q1
is being parsed instead of q1 |> bellcircuit
FYI, the best place to get started is: https://arxiv.org/abs/1912.10877
We really need to polish the online documentations of Yao. The pluto checks your variable dependency and re-evaluate cells automatically, it is not very compatible with inplace operations because the change of variables is implicit.
e.g. instead of using inplace apply q1 |> bellcircuit
, use q2 = apply(q1, bellcircuit)
will make pluto update correctly.
We are sorry that Yao's |>
does not follow the standard convension. It is a legacy issue which is hard to change now.
@hros Thanks for reporting!
I do have an update, but I need more time to get it together.
(Its long overdue at this point....)