Skip to content

Conversation

@Luisenden
Copy link
Contributor

This PR adds a quantum switch example: a central node serves n-GHZ states to n users using the Piecemaker protocol. The interactive version live_visualization_network_interactive.jl uses WGLMakie and can be integrated as interactive visualization in the docs. In this example, the user can select parameter settings for link_success_probability and memory_depolarization_probability. A live plot shows fidelity vs simulation time Δt, where points accumulate across runs so one can compare settings. A second panel shows the network evolving during protocol execution: edges appear when links are established; fusions and measurements then trigger the visual updates.

The example also includes a script that produces a static plot of the performance static_vic.jl as well as just a separate simple run file simple_run.jl which only collects performance data in a table without plotting. Both of these files import setup.jl.

  • [x ] The code is properly formatted and commented.
  • Substantial new functionality is documented within the docs.
  • All new functionality is tested.
  • All of the automated tests on github pass.
  • We recently started enforcing formatting checks. If formatting issues are reported in the new code you have written, please correct them. There will be plenty of old code that is flagged as we are slowly transitioning to enforced formatting. Please do not worry about or address older formatting issues -- keep your PR just focused on your planned contribution.

…delity computation (new observable is projector of nclient-GHZ state)
… distribution time and ghz-state fidelity as dataframe
…nglerProt (and therefore deleted SelectedEntanglerProt); added Depolarization test to the kraus_lindblad test set
…eded anymore for event driven simulation; added small testfile to see workings of initiate();
…ded docstring and jldoctest to fusioncircuit
…multiple lindblad operators); added kraus-vs-lindblad evolution test to
The fusion operation is performed on the switch node. Let's take a client who just managed to generate a bipartide entangled state -- entangled link -- with its associated qubit at the switch side. The switch executes a `CNOT` gate on the client's qubit (target) and the piecemaker qubit (control). Next, the switch measures the client qubit in the computational basis and sends the outcome to the client (in order to apply the necessary Pauli correction). This procedure merges the bipartide state into the (entangled) state that the piecemaker qubit is currently part of, modulo any required Pauli corrections.

# Noise
The memories residing in the nodes' `Register`s suffer from depolarizing noise, see [`Depolarization`](https://github.com/QuantumSavory/QuantumSavory.jl/blob/2d40bb77b2abdebdd92a0d32830d97a9234d2fa0/src/backgrounds.jl#L18).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a link to the docs, not to the code?

@@ -0,0 +1,52 @@
# System Overview
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a link to your arxiv

SwitchNode->>SwitchNode: Keep checking
end
end
``` No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check the readme of https://github.com/QuantumSavory/QuantumSavory.jl/tree/master/examples/simpleswitch and https://github.com/QuantumSavory/QuantumSavory.jl/tree/master/examples/state_explorer to add similar structural components like a spelled out link to docs and a link to live example (just make up one in the same style, e.g. areweentagledyet...../PICK_A_NAME) -- I will make sure it runs by the time we merge this

- The current n-qubit state (the clients’ memory qubits) is compared to the ideal GHZₙ target state. The resulting fidelity is plotted as a point on the left over the number of taken time steps Δt.

Noise model:
- Memory qubits are subject to depolarizing noise ([`Depolarization`](https://github.com/QuantumSavory/QuantumSavory.jl/blob/2d40bb77b2abdebdd92a0d32830d97a9234d2fa0/src/backgrounds.jl#L18) background). The slider “mem depolar prob” controls the memory depolarization probability.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to docs

end

content = md"""
Pick simulation settings and hit “Run once”. The left panel plots the running fidelity to the target GHZ state; the right panel shows the network state as it evolves.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to your paper

@@ -0,0 +1,59 @@
include("setup.jl")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this whole file to the example tests (see how they are structured)

@@ -0,0 +1,33 @@
include("setup.jl")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this to the example tests with plots (and check if the other examples use CairoMakie and switch to it if necessary)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other examples use GLMakie and WGLMakie as well (e.g., congestionchain, simpleswitch, repeatergrid)

@@ -0,0 +1,17 @@
[deps]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests run with a different project.toml file -- in case some tests fail with a missing dependency, probably you just need to add the dependency to the test project.toml

Copy link
Contributor Author

@Luisenden Luisenden Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when I run julia --project=. runtests.jl in test I get the following error

"ERROR: LoadError: UndefVarError: onchange not defined in Main.var"##234""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that might be because of a weird setup for your project environment; we can debug it with ] status

link_success_prob::Float64, seed::Int, logging::DataFrame, rounds::Int)

# Set a random seed
Random.seed!(seed)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep things random!

@Krastanov
Copy link
Member

I forgot to share the comment from today's meeting. Here it is:

-                run(sim)
+                # TODO suggestions from stefan that makes it possible to remove
 code duplication
+                t = 0
+                while true
+                   t += some_step # a fraction of the simulation time unit
+                   run(sim, t)
+                   notify(plot_observables)
+                   sleep(some_pause)
+                   if ...
+                      break
+                   end
+                end
+                # end of TODO

)

timed = @elapsed run(sim)
println("Simulation finished in $(timed) seconds")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it into a log statement so that it does not pollute the logs in the test runner


fig = plot_fidelity(logging)
display(fig)
wait() # keeps REPL open until the figure is closed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this block the tests?


@info "Simulation with $(nclients) clients finished in $(elapsed_time) seconds"
end
println(results_per_client) No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log, not print

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants