Skip to content

Don't compute diff unnecessarily in simple update - #416

Merged
kshyatt merged 3 commits into
mainfrom
ksh/su
Aug 15, 2026
Merged

Don't compute diff unnecessarily in simple update#416
kshyatt merged 3 commits into
mainfrom
ksh/su

Conversation

@kshyatt

@kshyatt kshyatt commented Aug 15, 2026

Copy link
Copy Markdown
Member

Right now this compare_weights is being run every iteration, even when completely unused. We can move it down into the showinfo block to avoid wasting some time.

@kshyatt
kshyatt requested a review from lkdvos August 15, 2026 10:13

@lkdvos lkdvos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch! Small extra suggestion but otherwise happy to merge

Comment thread src/algorithms/time_evolution/simpleupdate.jl Outdated
kshyatt and others added 2 commits August 15, 2026 12:20
Co-authored-by: Lukas Devos <ldevos98@gmail.com>
@kshyatt

kshyatt commented Aug 15, 2026

Copy link
Copy Markdown
Member Author

OK all fixed :)

@Yue-Zhengyuan

Copy link
Copy Markdown
Member

My original intention is to check weight difference after each step of SU, so we can stop immediately when it converges, even when the interval to output this information is usually larger. For cases where convergence is not checked (finite-T and real time) it is unnecessary; I just kept weight diff there in case I want to have a look. Even when convergence is checked, I guess we can afford to run a few more steps to reach one full check_interval.

@kshyatt

kshyatt commented Aug 15, 2026

Copy link
Copy Markdown
Member Author

Maybe then we can change the behavior depending on a flag or kwarg?

@Yue-Zhengyuan

Copy link
Copy Markdown
Member

How about calculating weight difference after each step only for ground state evolution, and every check_interval for other cases?

@kshyatt

kshyatt commented Aug 15, 2026

Copy link
Copy Markdown
Member Author

Sure, that also works for me. Feel free to push to this branch.

@Yue-Zhengyuan

Copy link
Copy Markdown
Member

Wait a few hours before I get back to my laptop

@kshyatt

kshyatt commented Aug 15, 2026

Copy link
Copy Markdown
Member Author

Yeah of course, no one is about to die from over comparison of weights 😹

@Yue-Zhengyuan

Copy link
Copy Markdown
Member

Turns out this is already achieved 😂 The ground state evolution is dispatched to time_evolve(it, H; ...) that further needs a Hamiltonian H, and it still has the old behavior that weight diff is calculated in each iteration. Other purposes use time_evolve(it; ...), which is already fixed.

@kshyatt

kshyatt commented Aug 15, 2026

Copy link
Copy Markdown
Member Author

The GPU stuff is irrelevant here so I'll just merge, then. Thanks everyone! <3

@kshyatt
kshyatt merged commit fe38b6b into main Aug 15, 2026
70 of 71 checks passed
@kshyatt
kshyatt deleted the ksh/su branch August 15, 2026 14:30
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/algorithms/time_evolution/simpleupdate.jl 97.08% <100.00%> (-0.03%) ⬇️

... and 3 files with indirect coverage changes

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

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