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_byprotocol. Gates and operations now have acontrolled_bymethod.ControlledGateandControlledOperationsupport arbitrary numbers of controls. - Added
cirq.channelandcirq.mixtureprotocols for defining noisy evolution. - Added
cirq.DensityMatrixSimulator. - Added
cirq.NoiseModel/cirq.NO_NOISE/cirq.ConstantQubitNoiseModelclasses. Some simulate and sample methods now take noise models. - Added
cirq.amplitude_damp,cirq.phase_damp, and other noise channels. - Added convenience methods
cirq.sampleandcirq.sample_sweepfor sampling from circuits without having to explicitly pick a simulator. - Added
cirq.experimentspackage withrabi_oscillations,single_qubit_randomized_benchmarking, and other predefined experiments. cirq.X,cirq.Y, andcirq.Zare nowcirq.Pauliinstances, whose operations can be multiplied together to producecirq.PauliStrings.- Added
cirq.pauli_expansionprotocol cirq.PauliStringnow 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.LinearDictfor representing linear combinations. cirq.Gateinstances can now be scaled and added together, producing acirq.LinearCombinationOfGates.- The
unitaryprotocol now falls back todecompose, allowing gates to be defined using only a_decompose_method. cirq.approx_eqnow works on circuits and gatescirq.value_equalitynow has anapproximateflag, and there is nowcirq.PeriodicValuefor 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
sympyexpressions. - Added
cirq.testing.random_superposition - Added
cirq.NamedQubit.range. - Added
cirq.IdentityGateand the single-qubit identity gatecirq.I. - Added
cirq.IonDeviceandcirq.NeutralAtomDeviceand related helper methods.
Notable breaking changes:
cirq.QubitIdhas been renamed tocirq.Qid.SingleQubitGate.on_eachnow takes a varargs*targetsinstead of atargetslist.- All
cirq.Gateinstances must now implement anum_qubitsmethod.cirq.MeasurementGate's first argument is now the number of qubits. Usecirq.measureinstead. cirq.Tolerancehas been deleted, replaced by explicitatol/rtolarguments.cirq.Symbolhas been deleted, replaced bysympy.Symbol.cirq.google.XmonSimulatorno 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.Simulatororcirq.sampleinstead.- Deleted
cirq.contrib.jobspackage, which was obsoleted by the introduction ofcirq.NoiseModel.