cirq.resolve_parameters
Resolves symbol parameters in the effect using the param resolver.
cirq.resolve_parameters(
val: T,
param_resolver: 'cirq.ParamResolverOrSimilarType',
recursive: bool = True
) -> T
Used in the notebooks
This function will use the _resolve_parameters_
magic method
of val
to resolve any Symbols with concrete values from the given
parameter resolver.
Args |
val
|
The object to resolve (e.g. the gate, operation, etc)
|
param_resolver
|
the object to use for resolving all symbols
|
recursive
|
if True, resolves parameters recursively over the
resolver; otherwise performs a single resolution step.
|
Returns |
a gate or operation of the same type, but with all Symbols
replaced with floats or terminal symbols according to the
given cirq.ParamResolver . If val has no _resolve_parameters_
method or if it returns NotImplemented, val itself is returned.
Note that in some cases, such as when directly resolving a sympy
Symbol, the return type could differ from the input type; however,
for the much more common case of resolving parameters on cirq
objects (or if resolving a Union[Symbol, float] instead of just a
Symbol), the return type will be the same as val so we reflect
that in the type signature of this protocol function.
|
Raises |
RecursionError if the ParamResolver detects a loop in resolution.
ValueError if recursive=False is passed to an external
_resolveparameters method with no recursive parameter.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-06-27 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]