Skip to content

Commit

Permalink
Check for clearance for vertical classical wires.
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov committed Apr 23, 2021
1 parent 59063dd commit d1976f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Quantikz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,11 @@ function circuit2table_compressed(circuit, qubits)
afilled_up_to = fill(1+PADDING,table.ancillaries)
bfilled_up_to = fill(1+PADDING,table.bits)
for op in circuit
qubits = extremarange(affectedqubits(op))
if isempty(affectedbits(op)) && neededancillaries(op)==0
qubits = extremarange(affectedqubits(op))
else
qubits = minimum(affectedqubits(op)):iend
end
bits = extremarange(affectedbits(op))
ancillaries = neededancillaries(op)
steps = nsteps(op)
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ end
@test circuit2string([NoiseAll(), Measurement(1,2)]) == "\\begin{quantikz}[transparent, row sep={0.8cm,between origins}]\n\\qw & \\gate[1,style={starburst,starburst points=7,inner xsep=-2pt,inner ysep=-2pt,scale=0.5}]{} & \\meterD{} & \\\\\n\\cw & \\cw & \\cw & \\cw\\\\\n\\cw & \\cw & \\cwbend{-2} & \\cw\n\\end{quantikz}"
end

@testset "Clearance for vertical classical wires" begin
@test circuit2string([Measurement(2),Measurement(1,1)]) == circuit2string([Measurement(2),Measurement(1,1)], mode=:expanded) == "\\begin{quantikz}[transparent, row sep={0.8cm,between origins}]\n\\qw & \\qw & \\meterD{} & \\\\\n\\qw & \\meterD{} & & \\\\\n\\cw & \\cw & \\cwbend{-2} & \\cw\n\\end{quantikz}"
end

end

function filetests()
Expand Down

0 comments on commit d1976f0

Please sign in to comment.