cirq.Simulator
final_state_vector is not normalized #6402
Closed
Description
Description of the issue
The final state vector of cirq.Simulator.simulate
may acccumulate enough numerical error that it may not have unit norm. similar to #5916
How to reproduce the issue
q0 = cirq.LineQubit(0)
circuit = cirq.Circuit(
cirq.S(q0),
cirq.H(q0),
cirq.S(q0),
cirq.Y(q0),
cirq.S(q0),
cirq.H(q0),
cirq.S(q0),
cirq.measure(q0),
)
state_vector_simulator = cirq.Simulator()
state_vector_simulator.simulate(circuit).final_state_vector
array([0.+0.j , 0.+0.99999994j], dtype=complex64)
Cirq version
1.2.0