Cirq v0.5.0
Themes:
- Noisy simulation.
- Experiments.
- Symbols via sympy.
- Algebraic manipulation of gates.
- Support for other hardware.
Notable new functionality:
- Added
cirq.controlled_by
protocol. Gates and operations now have acontrolled_by
method.ControlledGate
andControlledOperation
support arbitrary numbers of controls. - Added
cirq.channel
andcirq.mixture
protocols for defining noisy evolution. - Added
cirq.DensityMatrixSimulator
. - Added
cirq.NoiseModel
/cirq.NO_NOISE
/cirq.ConstantQubitNoiseModel
classes. Some simulate and sample methods now take noise models. - Added
cirq.amplitude_damp
,cirq.phase_damp
, and other noise channels. - Added convenience methods
cirq.sample
andcirq.sample_sweep
for sampling from circuits without having to explicitly pick a simulator. - Added
cirq.experiments
package withrabi_oscillations
,single_qubit_randomized_benchmarking
, and other predefined experiments. cirq.X
,cirq.Y
, andcirq.Z
are nowcirq.Pauli
instances, whose operations can be multiplied together to producecirq.PauliString
s.- Added
cirq.pauli_expansion
protocol cirq.PauliString
now supports exponentiation and raising to a power. The expressionnp.exp(1j * np.pi / 3 * cirq.X(q1) * cirq.Y(q2))
produces an operation you can append into a circuit.- Added
cirq.LinearDict
for representing linear combinations. cirq.Gate
instances can now be scaled and added together, producing acirq.LinearCombinationOfGates
.- The
unitary
protocol now falls back todecompose
, allowing gates to be defined using only a_decompose_
method. cirq.approx_eq
now works on circuits and gatescirq.value_equality
now has anapproximate
flag, and there is nowcirq.PeriodicValue
for handling approximate angles.- All methods that take a parameter resolver can now take a raw dictionary and default to the empty resolver.
- Gates can now be parameterized using arbitrary
sympy
expressions. - Added
cirq.testing.random_superposition
- Added
cirq.NamedQubit.range
. - Added
cirq.IdentityGate
and the single-qubit identity gatecirq.I
. - Added
cirq.IonDevice
andcirq.NeutralAtomDevice
and related helper methods.
Notable breaking changes:
cirq.QubitId
has been renamed tocirq.Qid
.SingleQubitGate.on_each
now takes a varargs*targets
instead of atargets
list.- All
cirq.Gate
instances must now implement anum_qubits
method.cirq.MeasurementGate
's first argument is now the number of qubits. Usecirq.measure
instead. cirq.Tolerance
has been deleted, replaced by explicitatol
/rtol
arguments.cirq.Symbol
has been deleted, replaced bysympy.Symbol
.cirq.google.XmonSimulator
no longer does automatic decomposition of circuits, which was hidden from and surprising to users. Circuits given to the xmon simulator must now only use supported operations. Usecirq.Simulator
orcirq.sample
instead.- Deleted
cirq.contrib.jobs
package, which was obsoleted by the introduction ofcirq.NoiseModel
.