Issue when commuting moments #6659
Labels
good first issue
This issue can be resolved by someone who is not familiar with the codebase. A good starting issue.
kind/bug-report
Something doesn't seem to work.
triage/accepted
there is consensus amongst maintainers that this is a real bug or a reasonable feature to add
Description of the issue
Cirq gives the wrong result when determining whether moments commute if the individual operators within the moments do not commute, but the moment as a whole still commutes. For example, take a pair of single qubit Z gates and a two qubit RXX gate. While [Z, RXX] !=0 (for either single qubit Z), we do in fact have [Z * Z, RXX] = 0. However, when using cirq we have
Gives
False
.Looking through the source code this seems to be because the the
commutes()
function compares pairs of operators form each moment but doesn't consider the case when the moment as a whole commutes even when the individual operators do not.How to reproduce the issue
See above
Cirq version
You can get the cirq version by printing
cirq.__version__
. From the command line:1.5.0
The text was updated successfully, but these errors were encountered: