quantumcomputingbook icon indicating copy to clipboard operation
quantumcomputingbook copied to clipboard

Flips the result measurement display

Open roosado opened this issue 4 years ago • 4 comments

When ran, Bob's received message was printing flipped (i.e. it printed "01" when it received "10"). The issue wasn't in the measurement, because when printing "res.measurements" it correctly assigned the values to the qubits from the message as expected.

This correction flips the bitstring display so it prints the message correctly.

The error might come from a change in how cirq saves measurements from simulators, but I'm not sure.

roosado avatar Jan 07 '21 18:01 roosado

Thanks @roosado - which Cirq version are you running which has the flipped measurement outcome?

rmlarose avatar Jan 11 '21 17:01 rmlarose

I see the same bitstring, but I'm not convinced its a problem with the bitstring function.

I'm using python 3.9.1 cirq 0.9.1

Here is the output with some extra prints:

cirq version: 0.9.1 Alice's sent msg is: 10

the superdense circuit 0: ───H───@───Z───@───H───M─── │ │ 1: ───────X───────X───M───────

Bob's meausurement values dict_values([array([[0]], dtype=int8), array([[1]], dtype=int8)])

Bob's recv: 01 bitstring([1,0]): 10

krehermann avatar Jan 13 '21 04:01 krehermann

@rmlarose Same as @krehermann - cirq 0.9.1

But yeah, the problem is not in the bitstring function, it's got to be the way cirq is saving the values.

roosado avatar Jan 14 '21 06:01 roosado

I'm not seeing the problem,however I am using an older versions:

circ - 8.2 python 3.8

i embellished the book sample to superdense encode an arbituary string such as "hello world"

output snippet: sender's sent message = 01

cirquit: 0: ───H───@───Z───@───H───M─── │ │ 1: ───────X───────X───M─────── recv'ers recv'd message = 01

stevescia avatar Jan 26 '21 03:01 stevescia