Cirq v0.4.0
Themes:
- Making the API more pythonic and more consistent (a.k.a. breaking changes and refactoring)
- Faster simulation
Notable new functionality:
cirq.Rx
,cirq.Ry
, andcirq.Rz
cirq.XX
,cirq.YY
,cirq.ZZ
, andcirq.MS
(Mølmer–Sørensen gate)cirq.Simulator
cirq.SupportsApplyUnitary
protocol for specifying fast simulation methodscirq.Circuit.reachable_frontier_from
andcirq.Circuit.findall_operations_between
cirq.decompose
sorted(qubits)
is now equivalent tocirq.QubitOrder.DEFAULT.order_for(qubits)
cirq.experiments.generate_supremacy_circuit_[...]
dtype
parameters to control precision-vs-speed of simulationscirq.TrialResult
helper methods (dirac_notation
/bloch_vector
/density_matrix
)cirq.TOFFOLI
andcirq.CCZ
can now be raised to powers
Notable breaking changes:
- Most gate classes have been standardized to take an
exponent
argument and have a name of the formNamePowGate
. For example,RotXGate
is nowXPowGate
and no longer takes rads, degs, or half_turns. - The xmon gate set has been merged into the common gate set.
- Capability marker classes have been replaced by magic method protocols. For example, gates now just implement a
_unitary_
method instead of inheriting fromKnownMatrix
. cirq.Extensions
andcirq.PotentialImplementation
are gone.- Several decomposition classes and methods have been moved from
cirq.google.*
tocirq.*
. For example,cirq.google.EjectFullW
is nowcirq.EjectPhasedPaulis
. - Moved classes and methods related to line placement into
cirq.google
.
Notable bug fixes:
- Two qubit gate decomposition no longer produces a glut of single qubit gates.
- Circuit diagrams stay aligned when given multi-line entries, and now include "same moment" indicators.
- Fixed false-positives and false-negatives in
cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent
. - Fixed many
repr
methods returning code that assumedfrom cirq import *
instead ofimport cirq
. - Example code now runs in both python 2 and python 3 without transpilation.
Notable dev changes:
- Test files now
import cirq
instead of specific modules. - Better testing and packaging scripts.
- No longer using different package versions for python 2 and python 3
cirq.value_equality
decorator.- New
cirq.testing
methods and classes.
Additions to contrib:
cirq.contrib.acquaintance
: utilities for defining permutation gatescirq.contrib.paulistring
: utilities for optimizing non-Clifford operations separated by Clifford operationscirq.contrib.tpu
: utilities for converting circuits into a form executable on cloud TPUs (requirestensorflow
)