Quirk
                                
                                 Quirk copied to clipboard
                                
                                    Quirk copied to clipboard
                            
                            
                            
                        Incorrect simulation result
The chance display at the bottom-right of this circuit looks to be broken.
One way to see this is by noticing that the even-parity bitstrings have probability of 27.3+17.1+26.5+6.5=77.4%, which is inconsistent with the 50% individual-qubit probability.
Or alternatively, here is some cirq code to compare against
circuit = cirq.Circuit()
q = cirq.LineQubit.range(15)
circuit += cirq.H.on_each(q[0:3])
for bits in itertools.product([0,1], repeat=3):
    circuit += (cirq.Y(q[3]) ** (0.795 if bits[0] else 0.205)).controlled_by(*q[0:3], control_values=bits)
    circuit += (cirq.Y(q[4]) ** (0.795 if bits[1] else 0.205)).controlled_by(*q[0:3], control_values=bits)
    circuit += (cirq.Y(q[5]) ** (0.795 if bits[2] else 0.205)).controlled_by(*q[0:3], control_values=bits)
for i in range(3, 6):
    circuit += cirq.CX(q[i], q[i+3])
for bits in itertools.product([0,1], repeat=3):
    circuit += (cirq.Y(q[9]) ** (0.795 if bits[0] else 0.205)).controlled_by(*q[3:6], control_values=bits)
    circuit += (cirq.Y(q[10]) ** (0.795 if bits[1] else 0.205)).controlled_by(*q[3:6], control_values=bits)
    circuit += (cirq.Y(q[11]) ** (0.795 if bits[2] else 0.205)).controlled_by(*q[3:6], control_values=bits)
for i in range(9, 12):
    circuit += cirq.CX(q[i], q[i+3])
circuit += cirq.measure(q[6:9] + q[12:15])
result = cirq.Simulator().run(circuit, repetitions=100000)
fig, ax = plt.subplots(figsize=(25, 5))
_ = cirq.plot_state_histogram(result, ax)  # gives a uniform probability distribution over 000...111 
Thanks for the report.
Displays breaking on the bottom qubits is an issue I see sometimes on certain computers but I have no idea what causes it. My best guess is the GPU rounding a lookup coordinate. I haven't had the time to look into it.
On Fri, May 10, 2024, 12:38 p.m. Pranav Gokhale @.***> wrote:
One way to see this is by noticing that the even-parity bitstrings have probability of 27.3+17.1+26.5+6.5=77.4%, which is inconsistent with the 50% individual-qubit probability. image.png (view on web) https://github.com/Strilanc/Quirk/assets/3976048/1a1835d2-a4cd-46e8-b1db-9dc3952c6d85
Or alternatively, here is some cirq code to compare against
circuit = cirq.Circuit() q = cirq.LineQubit.range(15)
circuit += cirq.H.on_each(q[0:3])
for bits in itertools.product([0,1], repeat=3): circuit += (cirq.Y(q[3]) ** (0.795 if bits[0] else 0.205)).controlled_by(*q[0:3], control_values=bits) circuit += (cirq.Y(q[4]) ** (0.795 if bits[1] else 0.205)).controlled_by(*q[0:3], control_values=bits) circuit += (cirq.Y(q[5]) ** (0.795 if bits[2] else 0.205)).controlled_by(*q[0:3], control_values=bits)
for i in range(3, 6): circuit += cirq.CX(q[i], q[i+3])
for bits in itertools.product([0,1], repeat=3): circuit += (cirq.Y(q[9]) ** (0.795 if bits[0] else 0.205)).controlled_by(*q[3:6], control_values=bits) circuit += (cirq.Y(q[10]) ** (0.795 if bits[1] else 0.205)).controlled_by(*q[3:6], control_values=bits) circuit += (cirq.Y(q[11]) ** (0.795 if bits[2] else 0.205)).controlled_by(*q[3:6], control_values=bits)
for i in range(9, 12): circuit += cirq.CX(q[i], q[i+3])
circuit += cirq.measure(q[6:9] + q[12:15])
result = cirq.Simulator().run(circuit, repetitions=100000) fig, ax = plt.subplots(figsize=(25, 5)) _ = cirq.plot_state_histogram(result, ax) # gives a uniform probability distribution over 000...111
— Reply to this email directly, view it on GitHub https://github.com/Strilanc/Quirk/issues/509, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATQRMSVVWHTEXGZWMV63TZBUO2DAVCNFSM6AAAAABHREX7UCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4TAMZQGQ2DSOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>