Skip to content

Refactor entropy function to also use spectrum directly#377

Open
AFeuerpfeil wants to merge 2 commits intoQuantumKitHub:mainfrom
AFeuerpfeil:pr-entanglement_spectrum
Open

Refactor entropy function to also use spectrum directly#377
AFeuerpfeil wants to merge 2 commits intoQuantumKitHub:mainfrom
AFeuerpfeil:pr-entanglement_spectrum

Conversation

@AFeuerpfeil
Copy link
Contributor

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.

Copilot AI review requested due to automatic review settings February 9, 2026 20:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 new entropy(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.

Comment on lines 10 to 13
return entropy(entanglement_spectrum(state, loc))
end
function entropy(spectrum::AbstractVector{T}) where {T}
S = zero(T)
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/algorithms/toolbox.jl 0.00% 5 Missing ⚠️
Files with missing lines Coverage Δ
src/algorithms/toolbox.jl 19.21% <0.00%> (-75.95%) ⬇️

... and 68 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lkdvos
Copy link
Member

lkdvos commented Feb 9, 2026

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?

@AFeuerpfeil
Copy link
Contributor Author

AFeuerpfeil commented Feb 9, 2026

I did not request anything.
Let me check my settings. Maybe I still have this auto-review on.
PS: Indeed, the auto-review setting was on.

@lkdvos
Copy link
Member

lkdvos commented Feb 9, 2026

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 😉 )

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