cirq.SupportsApplyChannel
An object that can efficiently implement a channel.
cirq.SupportsApplyChannel(
*args, **kwargs
)
Methods
_apply_channel_
View source
_apply_channel_(
args: cirq.ApplyChannelArgs
) -> Union[np.ndarray, None, NotImplementedType]
Efficiently applies a channel.
This method is given both the target tensor and workspace of the same
shape and dtype. The method then either performs inline modifications of
the target tensor and returns it, or writes its output into the
a workspace tensor and returns that. This signature makes it possible to
write specialized simulation methods that run without performing large
allocations, significantly increasing simulation performance.
Args |
args
|
A cirq.ApplyChannelArgs object with the args.target_tensor
to operate on, an args.out_buffer , 'args.auxiliary_buffer0and args.auxiliary_buffer1buffers to use as temporary
workspace, and the args.left_axesand args.right_axesof
the tensor to target with the unitary operation. Note that
this method is permitted (and in fact expected) to mutate args.target_tensor` and the given buffers.
|
Returns |
If the receiving object is not able to apply a channel, None
or NotImplemented should be returned.
If the receiving object is able to work inline, it should directly
mutate args.target_tensor and then return args.target_tensor .
The caller will understand this to mean that the result is in
args.target_tensor .
If the receiving object is unable to work inline, it can write its
output over args.out_buffer and then return args.out_buffer .
The caller will understand this to mean that the result is in
args.out_buffer (and so what was args.out will become
args.target_tensor in the next call, and vice versa).
The receiving object is also permitted to allocate a new
numpy.ndarray and return that as its result.
|
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."],[],[]]