Circuit

Representation of a quantum circuit.

source

unpack

 unpack (seq)

Generator to unpack all values of dicts inside a list of dicts

Type Details
seq Iterable Iterable to recursively unpack

source

draw_circuit

 draw_circuit (circuit, path=None, scale=2)

Draw circuit using latextools library

Type Default Details
circuit Circuit The circuit to draw
path NoneType None The path to save the resulting image to (optional)
scale int 2 The scale of the image
Returns drawSvg.drawing.Drawing Image object
/home/dw/.local/lib/python3.10/site-packages/fastcore/docscrape.py:225: UserWarning: Unknown section Attributes
  else: warn(msg)

source

Circuit

 Circuit (ticks=None, noisy=True)

Representation of a quantum circuit

list(unpack([{'X': {1,2,3}},{'CNOT': {(0,1), (1,3)}}]))
[1, 2, 3, 0, 1, 1, 3]
# Tests

c1 = Circuit(ticks=[{'Z': {0}}])
c2 = Circuit(ticks=[{'X': {3}}])
c3 = Circuit(ticks=[{'X': {3}}, {'Z': {0}}])
c4 = Circuit(ticks=[])
assert(c1.id != c2.id != c3.id != c4.id)
c1.id, c2.id, c3.id, c4.id
('14476', '5b6e8', 'c5aff', '6cc48')