typst / packages

Packages for Typst.
Apache License 2.0
516 stars 313 forks source link

quill:0.4.0 #952

Closed Mc-Zen closed 3 weeks ago

Mc-Zen commented 3 weeks ago

I am submitting

With this release, an alternative way of specifying quantum circuits is introduced. Similar to Qiskit (the well-known quantum computing framework written in Python), a circuit can now also be constructed by successively entering instructions. The circuit is then layed out automatically. This gives less control about the precise positioning of gates but allows for faster construction and also composition of sub-circuits. Moreoever, it is now easy to create templates for generic types of circuits.

For this, the submodule Tequila has been added to Quill. Tequila also features two built-in templates: tq.graph-state() and tq.qft().

#import "@preview/quill:0.4.0": *
#import tequila as tq

#quantum-circuit(
  ..tq.graph-state((0, 1), (1, 2)),
  ..tq.build(y: 3, 
      tq.p($pi$, 0), 
      tq.cx(0, (1, 2)), 
    ),
  ..tq.graph-state(x: 6, y: 2, invert: true, (0, 1), (0, 2)),
  gategroup(x: 1, 3, 3),
  gategroup(x: 1, y: 3, 3, 3),
  gategroup(x: 6, y: 2, 3, 3),
  slice(x: 5)
)

image

laurmaedje commented 3 weeks ago

Sounds very cool!