Open erlebach opened 1 year ago
I answered my own question. I read that |> is equivalent to apply!
, which overwrites the qbit that went through the circuit. So my question is: what was the rationale for overloading the pipe operator |>
? I thought this operator was equivalent to |
in the bash shell, it is very useful for clearer mathematical expressions. Overwriting it to mean apply!
seems to complicate matters. Why not overload it to mean apply
?
In an actual quantum computer, are there situations where the input qbit to a unitary transformation actually changes as the output is computed? I was not aware of that fact.
Thanks!
Gordon
Hi thanks for the issue. It's been my greatest gripe since the beginning of this overload. Mainly because it cannot represent the in place behavior of apply!
. But this is the only available pipe operator at the moment in Julia.
in quantum physics because there is non-cloning algorithm, a register is alway mutated in-place physically. Thus in practice we find this is quite convenient.
There has been proposal on supporting !>
as a pipe operator that denotes in-place function more explicitly which is something we can consider in the future.
I have created a simple circuit with a single qbit, and defined a simple function creating a qbit. Applying the circuit to this qbit several times in a row changes the state of the input qbit. I demonstrate this below:
Each time I apply the circuit to
bb
, the quantum bit flips. That would imply that the input qbitbb
changes. The output of the code above, typed into REPL, is:Why should it change? I do not understand. Thank you for any insight!