Skip to content

Cirq v0.5.0

Compare
Choose a tag to compare
@Strilanc Strilanc released this 24 Apr 03:23
e8f9323

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 a controlled_by method. ControlledGate and ControlledOperation support arbitrary numbers of controls.
  • Added cirq.channel and cirq.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 and cirq.sample_sweep for sampling from circuits without having to explicitly pick a simulator.
  • Added cirq.experiments package with rabi_oscillations, single_qubit_randomized_benchmarking, and other predefined experiments.
  • cirq.X, cirq.Y, and cirq.Z are now cirq.Pauli instances, whose operations can be multiplied together to produce cirq.PauliStrings.
  • Added cirq.pauli_expansion protocol
  • cirq.PauliString now supports exponentiation and raising to a power. The expression np.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 a cirq.LinearCombinationOfGates.
  • The unitary protocol now falls back to decompose, allowing gates to be defined using only a _decompose_ method.
  • cirq.approx_eq now works on circuits and gates
  • cirq.value_equality now has an approximate flag, and there is now cirq.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 gate cirq.I.
  • Added cirq.IonDevice and cirq.NeutralAtomDevice and related helper methods.

Notable breaking changes:

  • cirq.QubitId has been renamed to cirq.Qid.
  • SingleQubitGate.on_each now takes a varargs *targets instead of a targets list.
  • All cirq.Gate instances must now implement a num_qubits method. cirq.MeasurementGate's first argument is now the number of qubits. Use cirq.measure instead.
  • cirq.Tolerance has been deleted, replaced by explicit atol/rtol arguments.
  • cirq.Symbol has been deleted, replaced by sympy.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. Use cirq.Simulator or cirq.sample instead.
  • Deleted cirq.contrib.jobs package, which was obsoleted by the introduction of cirq.NoiseModel.