Quantum Logic Gates Solutions

Solutions for the exercises in Try Your Hand.

  1. The code for the quantum circuit is:

     qreg q[5];
     creg c[5];
     
     measure q[0] -> c[0];
     measure q[2] -> c[2];
    1. The concatenated string of measured states is 00000.

    2. Output on a simulator will look like this:

      images/quantum_logic_gates/Measuring_Two_Qubits_on_a_Simulator_Output.png

      The output on a simulator is exact: only the 00000 state is seen.

    3. Output on a real quantum computer will look something like the output shown.

      images/quantum_logic_gates/Measuring_Qubits_0_and_2_on_a_Real_Computer_Output.png

      We see that the 00000 state is observed most often. But other states ...

Get Quantum Computing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.