Skip to content

Commit

Permalink
minor fixes and Quantikz image
Browse files Browse the repository at this point in the history
  • Loading branch information
CalMacCQ committed Aug 23, 2024
1 parent 20e430a commit 34adead
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Binary file added docs/manual/images/phase_gadget_latex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 23 additions & 3 deletions docs/manual/tket_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ circ1 * circ2
```

Note that the two circuits need to have qubits with distinct names.
See the docs on circuit composition.
See the docs on [circuit composition](https://tket.quantinuum.com/user-guide/manual/manual_circuit.html#composing-circuits).

## 2. How can I export an image of my circuit?

Expand Down Expand Up @@ -48,6 +48,26 @@ circ = Circuit(2).CX(0, 1).Rz(0.61, 1).CX(0, 1) # Build circuit
circ.to_latex_file("phase_gadget.tex") # Generates a phase_gadget.tex file
```

This generates a `phase_gadget.tex` file in the working directory.

```latex
\documentclass[tikz]{standalone}
\usetikzlibrary{quantikz}
\begin{document}
\begin{quantikz}
\lstick{q[0]} & \ctrl{1} & \qw & \ctrl{1} & \qw \\
\lstick{q[1]} & \targ{} & \gate[1]{\text{$R_Z$(0.61)}} & \targ{} & \qw \\
\end{quantikz}
\end{document}
```

If we compile this LaTeX we get the following Quantikz image.


```{image} ./images/phase_gadget_latex.png
:align: center
:width: 400px
```

## 3. Can I do symbolic calculations in pytket?

Expand Down Expand Up @@ -124,8 +144,8 @@ unitary1 = circ1.get_unitary()
unitary2 = circ2.get_unitary()
# Compare up to a global phase
compare_unitaries(unitary1, unitary2)
# Compare unitaries up to a global phase
print("Do the unitaries match?", compare_unitaries(unitary1, unitary2))
```


Expand Down

0 comments on commit 34adead

Please sign in to comment.