Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added color to register net plot depending on the fidelity of entanglement + Added directional metadata #30

Merged
merged 15 commits into from
Aug 25, 2023

Conversation

adrianariton
Copy link
Contributor

  1. This option only allows for plotting of the fidelity colorwise
  2. Should i add another parameter specifying what observable i should plot to make it more general?

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #30 (eec23ed) into master (b0ab270) will decrease coverage by 3.14%.
The diff coverage is 7.89%.

@@            Coverage Diff             @@
##           master      #30      +/-   ##
==========================================
- Coverage   67.80%   64.67%   -3.14%     
==========================================
  Files          23       23              
  Lines         702      736      +34     
==========================================
  Hits          476      476              
- Misses        226      260      +34     
Files Changed Coverage Δ
ext/QuantumSavoryMakie/QuantumSavoryMakie.jl 0.00% <0.00%> (ø)
src/QuantumSavory.jl 58.91% <17.64%> (-7.18%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@adrianariton
Copy link
Contributor Author

@adrianariton adrianariton changed the title Added color to register net plot depending on the fidelity of entanglement Added color to register net plot depending on the fidelity of entanglement + Added directional metadata Aug 18, 2023
@Krastanov
Copy link
Member

I like the new directed edge metadata, no need for changes there.

I have the impression that the two-qubit coloring can currently lead to crashes if we have bigger entangled states. Could you add a couple of tests showing what happens if you try to plot something like:

r = Register(3)
initialize!(r[1:3], (Z1⊗Z1⊗Z1+ Z2⊗Z2⊗Z2)/sqrt(2))

Could you rename the keyword argument to something like twoqubitobservable=nothing and make checks on isnothing(twoqubitobservable) so that the user can do something like registerplot(..., twoqubitobservable=projector(state))?

@Krastanov
Copy link
Member

I will also suggest separating the gray line plotting from the colored observable plotting. Let's have both, so that the logic is not too intermingled. Basically, copy whatever part of the gray line plotting you need and cordon it off with !isnothing(twoqubitobservable). That would make refactoring the code down the line much easier. It would also make extending it to more complicated observables much easier.

@Krastanov
Copy link
Member

to avoid things breaking you probably will need a guard along the lines of nsubsystems(state) == 2 inside of the !isnothing(twoqubitobservable) block

@adrianariton
Copy link
Contributor Author

adrianariton commented Aug 21, 2023

I added the code as example, i will get to writing the readme and fixing the other issues you mentioned tommorow :)

@adrianariton
Copy link
Contributor Author

adrianariton commented Aug 21, 2023

Regarding the twoqubit observable,
Wouldnt it be actually cleaner to be able to plot all kinds of entasngled states (with more than 2 qubits)?

Im thinking of taking a function as parameter: nqubitobservable(n::Integer), which returns the projector for an n qubit state, and then simply projecting onto it. Is that ok? Or should we stick only with the 2 qubit approach?

I'm thinking I could simply loop through all the states and project them onto the corresponding stabilizer (provided by the function).

@adrianariton
Copy link
Contributor Author

adrianariton commented Aug 22, 2023

For some reason if i dont specify the color for the more thqan 2 qubit systems, and i put it equal to NaN, it does not work for the WGLmakie sim, but it does for the simple recording.
I just lazily put it equal to 0 for now if there isnt a 2 nsubsystem is present.

It also doesnt work if i create a sepparaste array called twoqubitstate_links and only work with it instead of state_links. (same result: works with simple recoreding, but the lines! fails on WGLMakie)

@adrianariton
Copy link
Contributor Author

@Krastanov i added the approach we discussed today with twoqubit links.
Please review my code :)

@adrianariton
Copy link
Contributor Author

adrianariton commented Aug 24, 2023

@Krastanov i removed the examples for now. They do work properly (both of them now) as i managed to figure out what the linesegments! error on WGLMakie was about. Would it be cleaner to add them to a different pull request after this gets merged? Or should i add them now so you can review them?
Edit|: made a small tweak, cause i realized i forgot to guard the second plot.(see commit below).

@Krastanov Krastanov merged commit 29d87e4 into QuantumSavory:master Aug 25, 2023
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.

2 participants