diff options
Diffstat (limited to 'hw9/YaoQuantumComputing.jl')
-rw-r--r-- | hw9/YaoQuantumComputing.jl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/hw9/YaoQuantumComputing.jl b/hw9/YaoQuantumComputing.jl new file mode 100644 index 0000000..36c22d6 --- /dev/null +++ b/hw9/YaoQuantumComputing.jl @@ -0,0 +1,28 @@ +using Yao, YaoPlots + +let + circuit = chain(2, put(1=>X), put(2=>X)) + plot(circuit) +end + + +begin + bellcircuit = chain(2, put(1=>H), control(1, 2=>X)) + plot(bellcircuit) +end + + +q1 = ArrayReg(bit"00") #creating the system of two qubits with state |00> +println(state(q1)) +println(q1 |> r->measure(r, nshots=10)) + +a = (q1 |> bellcircuit) +println(state(a)) +println(a |> r->measure(r, nshots=10)) + + +reversebellcircuit = chain(2, control(1,2=>X), put(1=>H)) +plot(reversebellcircuit) + +b = (a |> reversebellcircuit) +println(state(b))
\ No newline at end of file |