cirq.testing.assert_has_consistent_apply_unitary_for_various_exponents¶
-
cirq.testing.assert_has_consistent_apply_unitary_for_various_exponents(val: Any, *, exponents=(0, 1, -1, 0.5, 0.25, -0.5, 0.1, cirq.Symbol('s')), qubit_count: Optional[int] = None) → None[source]¶ Tests whether a value’s apply_unitary is correct.
Contrasts the effects of the value’s_apply_unitary_with thematrix returned by the value’s_unitary_method. Attempts this afterattempting to raise the value to several exponents.Parameters: - val – The value under test. Should have a __pow__ method.
- exponents – The exponents to try. Defaults to a variety of special and arbitrary angles, as well as a parameterized angle (a symbol). If the value’s __pow__ returns NotImplemented for any of these, they are skipped.
- qubit_count – A minimum qubit count for the test system. This argument isn’t needed if the gate has a unitary matrix or implements cirq.SingleQubitGate/cirq.TwoQubitGate/cirq.ThreeQubitGate; it will be inferred.