Skip to content

Commit

Permalink
[add] placement tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mc-Zen committed Sep 4, 2024
1 parent 602ae80 commit 30fe18c
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tequila-impl.typ
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

#let build(
n: auto,
x: 0,
x: 1,
y: 0,
append-wire: true,
..args
Expand All @@ -97,7 +97,7 @@
if num-qubits == auto {
num-qubits = calc.max(..operations.map(x => x.qubit + calc.max(0, x.n - 1))) + 1
}
let tracks = ((1,),) * num-qubits
let tracks = ((),) * num-qubits

for op in operations {
let start = op.qubit
Expand Down Expand Up @@ -145,7 +145,7 @@



#let graph-state(..edges, n: auto, x: 0, y: 0, invert: false) = {
#let graph-state(..edges, n: auto, x: 1, y: 0, invert: false) = {
edges = edges.pos()
let max-qubit = 0
for edge in edges {
Expand Down
Binary file added tests/tequila/basic/ref/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions tests/tequila/basic/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@
tq.h(0, 1, 2)
))



#pagebreak()

#quill.quantum-circuit(..tq.build(
append-wire: false,
tq.s(0, 1, 2),
tq.meter(range(1,3)),
))

Binary file added tests/tequila/placement/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/tequila/placement/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/tequila/placement/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions tests/tequila/placement/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#set page(width: auto, height: auto, margin: 0pt)
#import "/src/quill.typ"
#import quill: tequila as tq

#quill.quantum-circuit(
1, $X$, $Y$, quill.gate("R", x: 1, y: 1),
..tq.build(
x: 2, y: 1,
tq.h(0),
tq.cx(0, 1),
)
)

#pagebreak()


#quill.quantum-circuit(
quill.lstick($|0〉$, n: 3),
..tq.graph-state(
y: 1,
(0, 1)
),
..tq.build(
x: 2, y: 3, n: 3,
tq.h(0),
tq.cx(0, 1),
),
..tq.build(
y: 4,
tq.y(0), tq.swap(0, 1),
)
)

#pagebreak()


#quill.quantum-circuit(
..tq.build(
x: 0, y: 0, append-wire: false,
tq.h(0),
tq.cx(0, 1),
)
)

0 comments on commit 30fe18c

Please sign in to comment.