Cirq v0.6.0
Major usability changes:
- Pandas.
cirq.TrialResult
now has adata
property that returns results as apandas.DataFrame
, providing access to all of pandas' convenience methods for working with data. - Qudit support. Added
cirq.Qid.dimension
andcirq.Operation._qid_shape_
, as well as validation and simulator support. - Packaging. Package variant
cirq[contrib]
with requirements forcirq.contrib
. Unstable packagecirq-unstable
tracking master. - Serialization.
cirq.to_json
andcirq.from_json
methods can serialize (..almost) any cirq object. - Deterministic randomness. Almost all methods with random behavior now take a seed or
numpy.Random
instance. - Dropped support for python 2.7 and python 3.5.
New protocols:
cirq.equal_up_to_global_phase
/_equal_up_to_global_phase_
cirq.qid_shape
/_qid_shape_
cirq.num_qubits
/_num_qubits_
New top level objects:
cirq.reset
/cirq.ResetChannel
cirq.WaitGate
cirq.FSimGate
cirq.GlobalPhasedOperation
(the first operation with no qubits)cirq.ThreeQubitDiagonalGate
cirq.DensePauliString
cirq.MutableDensePauliString
cirq.ArithmeticOperation
(helper class for defining arithmetic operations)cirq.CCNOT = cirq.TOFFOLI
aliascirq.CX = cirq.CNOT
aliascirq.final_wavefunction
cirq.subwavefunction
cirq.wavefunction_partial_trace
cirq.von_neumann_entropy
cirq.apply_mixture
cirq.one_hot
cirq.axis_angle
/cirq.AxisAngleDecomposition
cirq.apply_unitaries
cirq.approx_pauli_string_expectation
cirq.flatten[/_with_params/_with_sweep]
for inlining complicated sympy expressions into sweepscirq.LinearCombinationOfOperations
cirq.PauliSum
cirq.SampleCollector
cirq.op_gate_of_type
cirq.op_gate_isinstance
cirq.NOISE_MODEL_LIKE
(flexible argument type for specifying noise models)cirq.PAULI_STRING_LIKE
(flexible argument type for specifying pauli string arguments)cirq.CliffordSimulator
,cirq.StabilizerStateChForm
,cirq.CliffordTableau
,cirq.CliffordState
,cirq.CliffordTrialResult
(all still rough)cirq.StabilizerStateChForm
(still rough)cirq.SimulatesAmplitudes
interfacecirq.DepolarizingNoiseModel
cirq.DepolarizingWithReadoutNoiseModel
cirq.DepolarizingWithDampedReadoutNoiseModel
cirq.pow_pauli_combination
New sub package objects:
- Added
cirq.aqt
package, which contains code to run cirq circuits on AQT's service. cirq.experiments.cross_entropy_benchmarking
cirq.experiments.linear_xeb_fidelity
cirq.experiments.log_xeb_fidelity
cirq.experiments.log_xeb_fidelity_from_probabilities
cirq.experiments.t1_decay
cirq.experiments.xeb_fidelity
cirq.contrib.qasm_import.circuit_from_qasm
cirq.contrib.quirk.quirk_url_to_circuit
cirq.contrib.quirk.quirk_json_to_circuit
cirq.contrib.SVGCircuit
cirq.contrib.circuit_to_svg
Other changes (partial list):
- Deprecated
cirq.Circuit.from_ops
in favor ofcirq.Circuit.__init__
- Deprecated
cirq.Circuit.to_unitary_matrix
in favor ofcirq.Circuit.unitary
- Deprecated
cirq.Circuit.apply_unitary_effect_to_state
in favor ofcirq.Circuit.final_wavefunction
- Deleted
cirq.google.XmonSimulator
(usecirq.Simulator
instead) cirq.approx_eq
now recursively compares the items of iterablescirq.resolve_parameters
now recursively resolves the items of iterablescirq.is_parameterized
now recursively checks the items of iterables- Added
cirq.TrialResult.data
method - Added
cirq.Sampler.sample
method which returns apandas.DataFrame
cirq.ControlledGate.on
now returns acirq.ControlledOperation
instead of acirq.GateOperation
simulator_state
method on simulators is now private_simulator_state
cirq.QasmUGate.__init__
now takes operations in the same order as defined in QASM speccirq.PhasedXPowGate
now longer auto-transforms itself intocirq.XPowGate
orcirq.YPowGate
at special phase angles- Attempting to sample a circuit with no measurements now raises an error
- Fixed
cirq.kak_canonicalize_vector
not ensuring z>=0 when x=pi/4. - Added
cirq.PauliString.__add__/__sub__
methods - Added
cirq.PauliString.conjugated_by
method - Added
cirq.PauliString.dense
method - Added
cirq.X/Y/ZPowGate.__add__/__sub__
methods - Generalized
cirq.Circuit.__init__
to take any tree of moments/operations. - Added
cirq.PauliString._unitary_
methods - Added
DensityMatrixTrialResult.__str__
- Added a
py.typed
file tellingmypy
it can use cirq's inline type annotations - Added
cirq.PeriodicValue.__repr__
cirq.GateOperation._pauli_expansion_
- Controlling by nothing (
operation.controlled_by()
) now has no effect instead of unnecessarily wrapping - Added
cirq.PauliString._decompose_
- Added
cirq.GridQubit.square
static method - Added
cirq.GridQubit.rect
static method - Added
cirq.GridQubit.from_pic
static method - Added
cirq.Circuit.__iadd__
- Added
cirq.PauliString.__bool__
- Density matrix simulator now uses
apply_channel
when possible - Fixed
cirq.AsymmetricDepolarizingChannel._circuit_diagram_info_
ignoring precision argument cirq.SingleQubitGate.on_each
method now takes any tree of qids- Added
cirq.SimulationTrialResult.qubit_map
method - Added
cirq.KakDecomposition.__str__
method - Added
cirq.control.UndirectedGraphDevice
- Added
CircuitDag.all_qubits
- Added
CircuitDag.is_topologically_sorted
- Added
CircuitDag.get_logical_operations
- Added
CircuitDag.random_circuit_dag
- Added
CircuitDag.random_topological_sort
- Added
examples/swap_networks.py
- Added
examples/qaoa.py
- Added
cirq.X/Y/ZPowGate.in_su2
- Added
cirq.X/Y/ZPowGate.with_canonical_global_phase
- Added
cirq.GridQubit.__add__/__sub__
- Added
cirq.LineQubit.__add__/__sub__
- Added
Circuit.with_noise
method - Added
cirq.Moment.__pow__
- Added
cirq.Sweep.__getitem__
with slice support - Added
cirq.SynchronizeTerminalMeasurements
. cirq.experiments.RabiResult.plot
now sets y axis range to [0, 1].- Fixed backwards qubit ordering in
cirq.experiments.two_qubit_state_tomography
- Fixed
Circuit.findall_operations_until_blocked
double counting operations - Added
cirq.Sampler.run_sweep_async
- Generalized
cirq.PauliString.__init__
to take any tree of Pauli operations or dictionary from qubit to Pauli operation or complex number cirq.EjectZ
optimizer can now commute Z gates through swap-like gates- Continued development on
cirq.google.QuantumEngine
related classes, e.g. defined more flexible v2 proto serialization format - Fixed several instances of checking for
sympy.Symbol
instead ofsympy.Basic
- Added
cirq.vis.Heatmap
cirq.EjectZ
optimizer copes better in the presence of symbolic parameterscirq.EjectPhasedPaulis
optimizer copes better in the presence of symbolic parameters- Fixed several cases of simulators ignoring
cirq.MeasurementGate.invert_mask
- Fixed
cirq.CSwapGate
now supporting equality comparisons cirq.Sweepable
type union now allows dictionaries and lists of dictionaries- Added
cirq.scatter_plot_normalized_kak_interaction_coefficients
method cirq.Moment.__eq__
no longer cares about operation order- Added
cirq.TrialResult.__add__
method - Renamed
cirq.experiments.generate_supremancy_circuit[...]
tocirq.google.generate_boixo_2018_supremacy_circuits_[...]
- Added
cirq.Circuit.transform_qubits
method - Fixed
cirq.approx_eq
hanging when given strings - Added
cirq.kak_vector
method for quickly computing many kak coefficients cirq.Duration.__init__
now acceptstimedelta
andsympy.Basic
values- Added
ConstantQubitNoiseModel.__eq__
- Added
ConstantQubitNoiseModel.__repr__
- Re-arranged some files within the
cirq.ops
package - Fixed
cirq.SWAP
andcirq.ISWAP
decompositions not preserving global phase
Notable dev changes:
- Defined development package variant
cirq[dev-env]
which includes development environment requirements - We have gradually begun deprecating things instead of simply deleting them.
- Auto deploy to
cirq-dev
on push to master. - Continuous integration on Windows, OSX, and Linux instances instead of just Linux.
- Incremental build tools compare against mergebase master instead of master itself
- Added
cirq.value.ABCMetaImplementAnyOneOf
metaclass withcirq.value.alternative
decorator - We have started adding doctest-ed
Examples
section to some doc strings - Added
--actually_quiet
parameter to the pytest check script _compat.proper_repr
now also works on pandas data frames.- Deleted
continuous-integration/
in favor ofcheck/
scripts