cirq.scatter_plot_normalized_kak_interaction_coefficients
Plots the interaction coefficients of many two-qubit operations.
cirq.scatter_plot_normalized_kak_interaction_coefficients(
interactions: Iterable[Union[np.ndarray, 'cirq.SupportsUnitary', 'KakDecomposition']],
*,
include_frame: bool = True,
ax: Optional[mplot3d.axes3d.Axes3D] = None,
**kwargs
)
Plots |
A point for the (x, y, z) normalized interaction coefficients of
each interaction from the given interactions. The (x, y, z) coordinates
are normalized so that the maximum value is at 1 instead of at pi/4.
If include_frame is set to True, then a black wireframe outline of the
canonicalized normalized KAK coefficient space. The space is defined by
the following two constraints:
0 <= abs(z) <= y <= x <= 1
if x = 1 then z >= 0
The wireframe includes lines along the surface of the space at z=0.
The space is a prism with the identity at the origin, a crease along
y=z=0 leading to the CZ/CNOT at x=1 and a vertical triangular face that
contains the iswap at x=y=1,z=0 and the swap at x=y=z=1:
(x=1,y=1,z=0)
swap___iswap___swap (x=1,y=1,z=+-1)
_/\ | /
_/ \ | /
_/ \ | /
_/ \ | /
_/ \|/
(x=0,y=0,z=0) I---------------CZ (x=1,y=0,z=0)
|
Args |
interactions
|
An iterable of two qubit unitary interactions. Each
interaction can be specified as a raw 4x4 unitary matrix, or an
object with a 4x4 unitary matrix according to cirq.unitary (
(e.g. cirq.CZ or a cirq.KakDecomposition or a cirq.Circuit
over two qubits).
|
include_frame
|
Determines whether or not to draw the kak space
wireframe. Defaults to True .
|
ax
|
A matplotlib 3d axes object to plot into. If not specified, a new
figure is created, plotted, and shown.
|
**kwargs
|
Arguments forwarded into the call to scatter that plots the
points. Working arguments include color c='blue' , scale s=2 ,
labelling label="theta=pi/4" , etc. For reference see the
matplotlib.pyplot.scatter documentation:
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.scatter.html
|
Returns |
The matplotlib 3d axes object that was plotted into.
|
Examples |
>>> ax = None
>>> for y in np.linspace(0, 0.5, 4):
... a, b = cirq.LineQubit.range(2)
... circuits = [
... cirq.Circuit(
... cirq.CZ(a, b)**0.5,
... cirq.X(a)**y, cirq.X(b)**x,
... cirq.CZ(a, b)**0.5,
... cirq.X(a)**x, cirq.X(b)**y,
... cirq.CZ(a, b) ** 0.5,
... )
... for x in np.linspace(0, 1, 25)
... ]
... ax = cirq.scatter_plot_normalized_kak_interaction_coefficients(
... circuits,
... include_frame=ax is None,
... ax=ax,
... s=1,
... label=f'y={y:0.2f}')
>>> _ = ax.legend()
>>> import matplotlib.pyplot as plt
>>> plt.show()
|
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."],[],[]]