cirq.phase_by
Returns a phased version of the effect.
cirq.phase_by(
val: Any,
phase_turns: float,
qubit_index: int,
default: TDefault = RaiseTypeErrorIfNotProvided
)
For example, an X gate phased by 90 degrees would be a Y gate.
This works by calling val
's _phaseby method and returning
the result.
Args |
val
|
The value to describe with a unitary matrix.
|
phase_turns
|
The amount to phase the gate, in fractions of a whole
turn. Multiply by 2π to get radians.
|
qubit_index
|
The index of the target qubit the phasing applies to. For
operations this is the index of the qubit within the operation's
qubit list. For gates it's the index of the qubit within the tuple
of qubits taken by the gate's on method.
|
default
|
The default value to return if val can't be phased. If not
specified, an error is raised when val can't be phased.
|
Returns |
If val has a _phaseby method and its result is not NotImplemented,
that result is returned. Otherwise, the function will return the
default value provided or raise a TypeError if none was provided.
|
Raises |
TypeError
|
val doesn't have a _phaseby method (or that method returned
NotImplemented) and no default was specified.
|
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."],[],[]]