cirq.Sweep¶
-
class
cirq.Sweep[source]¶ A sweep is an iterator over ParamResolvers.
A ParamResolver assigns values to Symbols. For sweeps, each ParamResolvermust specify the same Symbols that are assigned. So a sweep is a way toiterate over a set of different values for a fixed set of Symbols. This isuseful for a circuit, where there are a fixed set of Symbols, and you wantto iterate over an assignment of all values to all symbols.For example, a sweep can explicitly assign a set of equally spaced pointsbetween two endpoints using a Linspace,sweep = Linspace(“angle”, start=0.0, end=2.0, length=10)This can then be used with a circuit that has an ‘angle’ Symbol torun simulations multiple simulations, one for each of the values in thesweepresult = simulator.run_sweep(program=circuit, params=sweep)Sweeps support Cartesian and Zip products using the ‘*’ and ‘+’ operators,see the Product and Zip documentation.-
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
param_tuples()An iterator over (key, value) pairs assigning Symbol key to value. Attributes
keysThe keys for the all of the Symbols that are resolved. -