Skip to content

Strange behavior of 1-qbit circuit #437

@erlebach

Description

@erlebach

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:

using cuYao, Plots

X1 = chain(1, put(1 => X))
bb = ArrayReg(bit"1")
state(bb  |> X1) 
state(bb |> X1)

Each time I apply the circuit to bb, the quantum bit flips. That would imply that the input qbit bb changes. The output of the code above, typed into REPL, is:

julia> state(bb |> X1)
2×1 Matrix{ComplexF64}:
 1.0 + 0.0im
 0.0 + 0.0im

julia> state(bb |> X1)
2×1 Matrix{ComplexF64}:
 0.0 + 0.0im
 1.0 + 0.0im

Why should it change? I do not understand. Thank you for any insight!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions