Skip to content

Conversation

@TendonFFF
Copy link
Collaborator

Checklist

Thank you for contributing to Tutorials for Quantum Toolbox in Julia! Please make sure you have finished the following tasks before opening the PR.

  • Please read Contributing to Quantum Toolbox in Julia.
  • The (last update) date were modified for new or updated tutorials.
  • For new tutorials, a Version Information section was added at the end and displays the output of versioninfo().
  • All tutorials were able to render locally by running: make render.

Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a Draft Pull Request to let the others know this on-going work.

Description

As title

@TendonFFF TendonFFF marked this pull request as ready for review March 3, 2025 09:25
@albertomercurio
Copy link
Member

Why don't we see the preview?

@github-actions
Copy link

github-actions bot commented Mar 4, 2025

PR Preview Action v1.6.0

🚀 View preview at
https://qutip.github.io/qutip-julia-tutorials/pr-preview/pr-31/

Built to branch gh-pages at 2025-03-12 03:16 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@TendonFFF
Copy link
Collaborator Author

Why don't we see the preview?

After I push out the dummy commit, it somehow worked.

@TendonFFF TendonFFF marked this pull request as draft March 6, 2025 08:22
@TendonFFF
Copy link
Collaborator Author

This pr is currently waiting for this pr to be merged.

@TendonFFF TendonFFF marked this pull request as ready for review March 6, 2025 08:47
@TendonFFF TendonFFF marked this pull request as draft March 6, 2025 08:47
@ytdHuang ytdHuang marked this pull request as ready for review March 7, 2025 06:51
Copy link
Member

@albertomercurio albertomercurio left a comment

Choose a reason for hiding this comment

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

Aside from these comments, it is well written. I would avoid to use many underscores like _g, _ax and many other cases. They make the syntax more complicated.

_ρcav = ptrace(ψGs[idx], 1) # cavity reduced state
# plot wigner
_, _ax, _hm = plot_wigner(_ρcav, location = fig[1,hpos])
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to repeat the ylabel starting from the second one. I think this can be done with something like ylabel!(_ax, nothing). One can also remove the ticks labels for the y axis with something like hideydecotrations!(_ax, ticks = false). With this we should gain a bit of space, as the layout is a bit packed.

Comment on lines 171 to 179
slist = []
for g in gs
H_ = H(M0, N, g)
_, vecs = eigenstates(H_)
S = entropy_mutual(vecs[1], 1, 2)
H_ = H(M0, N, g)
_, vecs = eigenstates(H_)
S = entropy_mutual(vecs[1], 1, 2)
push!(slist, S)
end
push!(slists, slist)
end
Copy link
Member

Choose a reason for hiding this comment

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

I see it only now. Also this case is inefficient and should be avoided in the tutorials. We are initializing an empty vector slist = [] of type Any. Moreover, I always recommend to not use push!, as it allocates memory.

You could use the same example I suggested before, with slist = map(gs) do g.

@albertomercurio
Copy link
Member

LGTM. I don't know if @ytdHuang has something to say.

@ytdHuang
Copy link
Member

Nope~
Let's merge

@ytdHuang ytdHuang merged commit 4f4000d into main Mar 15, 2025
2 checks passed
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.

4 participants