New answers tagged

1

XXPow isn't a tensor product of Rx gates. It raises the matrix resulting from such a tensor product to a power, but the result is not expressible as a tensor product anymore. If you want to decompose into CNOT gates, the key thing you need to know is that you can change the observable being exponentiated by conjugating it with Clifford operations. For ...


1

why does cirq constrain simulate_expectation_values method only for observables being Pauli Strings It's certainly not a necessary constraint. But a reason a library would do Pauli products first is that they are simple, pretty flexible, and widely used. For example, they're easy to measure on hardware (only single qubit operations needed) and they're the ...


2

$Z_{q0} Z_{q1}$ is an observable; a thing that you can measure. If I tell you to measure $Z_{q0}$, I am telling you to measure qubit $q0$ in the computational basis (i.e. in the usual way, i.e. whether the qubit is $|0\rangle$ or $|1\rangle$). If I tell you to measure $X_{q0}$, I am telling you to measure qubit $q0$ in the X basis (i.e. whether the qubit is $...


0

This is a pretty technical internal detail of how cirq works. Basically what's going on is that cirq's continuous integration system verifies test coverage. If you contribute to cirq and you touch a line of code, there's supposed to be at least one test that runs that line (or else an # coverage: ignore annotation on the line). The "only touched lines ...


2

Instead of accessing results._final_simulator_state.density_matrix, which has a leading underscore implying you shouldn't be using it or relying on it to stay stable, use results.final_density_matrix. Making that substitution seems to result in the code working. Separately, I think the fact that what you did doesn't work is a bug. It seems that the method ...


Top 50 recent answers are included