Refactor entropy function to also use spectrum directly#377
Refactor entropy function to also use spectrum directly#377AFeuerpfeil wants to merge 2 commits intoQuantumKitHub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the entanglement entropy computation to allow calling entropy directly on a precomputed entanglement spectrum (e.g. the result of entanglement_spectrum(psi, loc)), instead of always recomputing the spectrum from the MPS.
Changes:
- Refactor
entropy(state, loc)to delegate to a newentropy(spectrum)overload. - Add
entropy(spectrum::AbstractVector{T})implementation that computes von Neumann entropy from the provided spectrum.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return entropy(entanglement_spectrum(state, loc)) | ||
| end | ||
| function entropy(spectrum::AbstractVector{T}) where {T} | ||
| S = zero(T) |
There was a problem hiding this comment.
The docstring above still documents only entropy(state, [site::Int]), but this PR introduces a new public overload entropy(spectrum). Please update the docstring/signature section to mention the spectrum form and clarify what spectrum structure is expected (sectorized vs plain vector).
Codecov Report❌ Patch coverage is
... and 68 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
Did you request the copilot review or is this another one of these Microsoft deciding to make all of their bullshit opt-out instead of opt-in all of a sudden again? |
|
I did not request anything. |
|
Ok, no worries I'm not against this, I would have just been pretty pissed off if Github all of a sudden would decide to just auto comment on all PRs with copilot. (also, the suggestions are actually not bad 😉 ) |
In this PR, I add the functionality to directly supply the entanglement spectrum obtained from e.g.
entanglement_spectrum(psi, loc)to calculate the von Neumann entropy.