Open glanzz opened 2 months ago
It seems that the resulting probabilities can become slightly less than zero due to imprecision in floating-point calculations (but this is just my guess). cirq/sim/density_matrix_utils.py
, line 86, in sample_density_matrix
. For example, I have encountered probs = [ 7.5000006e-01 -8.4293717e-08 -2.1073429e-08 2.5000003e-01]
Discussed during bit.ly/cirq-cynq today (2024-10-16): although the original example came from a QASM circuit definition, the problem itself is not related to QASM.
Description of the issue Running a circuit imported from QASM is failing when run on DensityMatrixSimulator How to reproduce the issue
mycircuit.qasm
Cirq version You can get the cirq version by printing
cirq.__version__
. From the command line: