|View source on GitHub|
Resolves parameters to actual values.
cirq.study.ParamResolver( param_dict: 'cirq.ParamResolverOrSimilarType' = None ) -> None
Used in the notebooks
|Used in the tutorials|
A parameter is a variable whose value has not been determined. A ParamResolver is an object that can be used to assign values for these variables.
ParamResolvers are hashable; their param_dict must not be mutated.
||A dictionary from the ParameterValue key (str) to its assigned value.|
value_of( value: Union['cirq.TParamKey', float], recursive: bool = True ) -> 'cirq.TParamVal'
Attempt to resolve a parameter to its assigned value.
Floats are returned without modification. Strings are resolved via the parameter dictionary with exact match only. Otherwise, strings are considered to be sympy.Symbols with the name as the input string.
A sympy.Symbol is first checked for exact match in the parameter dictionary. Otherwise, it is treated as a sympy.Basic.
A sympy.Basic is resolved using sympy substitution.
Note that passing a formula to this resolver can be slow due to the underlying sympy library. For circuits relying on quick performance, it is recommended that all formulas are flattened before-hand using cirq.flatten or other means so that formula resolution is avoided. If unable to resolve a sympy.Symbol, returns it unchanged. If unable to resolve a name, returns a sympy.Symbol with that name.
||The parameter to try to resolve.|
||Whether to recursively evaluate formulas.|
|The value of the parameter as resolved by this resolver.|
||If the ParamResolver detects a loop in recursive resolution.|
__bool__() -> bool
__eq__( other )
__getitem__( key: Union[sympy.Basic, float, str] ) -> 'cirq.TParamVal'
__iter__() -> Iterator[Union[str, sympy.Symbol]]
__ne__( other )