-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Currently ( as with PR: #5 ), we can only visualize Pauli gadgets and Pauli Polynomials in the terminal as follows:
pp = PauliPolynomial(num_qubits=4)
pp >>= PPhase(0.5) @ [X, Y, Z, I]
print(pp)
An interesting extension would be:
- Provide a mechanism to display Pauli Polynomials in Jupyter notebooks
- Provide a possibility to export Pauli Polynomials as
.tex
Files
Display Pauli Polynomials in Jupyter notebooks
An extension towards Jupiter notebooks, already present with Phase gadgets plus Latex support, would be interesting.
For the Jupyter notebooks, one can orient himself at: https://github.com/sg495/pauliopt/blob/main/pauliopt/phase/phase_circuits.py#L937). Here the phase circuit is cast to an SVG. This can be shown in Pybooks using the display
function.
Latex Support
For Latex support a template can be found in the following:
\documentclass[preview]{standalone}
\usepackage{tikz}
\usetikzlibrary{zx-calculus}
\usetikzlibrary{quantikz}
\usepackage{graphicx}
\tikzset{
diagonal fill/.style 2 args={fill=#2, path picture={
\fill[#1, sharp corners] (path picture bounding box.south west) -|
(path picture bounding box.north east) -- cycle;}},
reversed diagonal fill/.style 2 args={fill=#2, path picture={
\fill[#1, sharp corners] (path picture bounding box.north west) |-
(path picture bounding box.south east) -- cycle;}}
}
\tikzset{
pauliY/.style={
anchor=center,
minimum height=0.5em,
minimum width=0.5em,
draw,
line width=\zxDefaultLineWidth,
diagonal fill={colorZxX}{colorZxZ}
}
}
\tikzset{
pauliX/.style={
anchor=center,
minimum height=0.5em,
minimum width=0.5em,
draw,
line width=\zxDefaultLineWidth,
fill=colorZxX
}
}
\tikzset{
pauliZ/.style={
anchor=center,
minimum height=0.5em,
minimum width=0.5em,
draw,
line width=\zxDefaultLineWidth,
fill=colorZxZ
}
}
\tikzset{
pauliPhase/.style={
anchor=center,
minimum height=1em,
minimum width=1em,
draw,
line width=\zxDefaultLineWidth,
fill=white
}
}
\begin{document}
\begin{ZX}
\zxNone{} & & |[pauliPhase]| {\alpha}\\
\\
\zxNone{} \rar & |[pauliX]| \ar[ruu, bend right] \rar & \zxNone{}\\
\zxNone{} \rar & |[pauliY]| \ar[ruuu, bend right] \rar & \zxNone{}\\
\zxNone{} \rar & |[pauliZ]| \ar[ruuuu, bend right] \rar & \zxNone{}\\
\zxNone{} \rar & \zxNone{} \rar & \zxNone{}\\
\end{ZX}
\end{document}
This .tex
code will render a Pauli gadget like this:

Note that this Latex Script is mainly based on the ZX-Calculus library (https://ctan.org/pkg/zx-calculus?lang=en)
Metadata
Metadata
Assignees
Labels
No labels