Skip to content

Fix MPO expectation values with supplied environments - #779

Merged
Jakob-Unfried merged 3 commits into
tenpy:mainfrom
rpinho:fix-mpo-expectation-env
Nov 20, 2026
Merged

Jakob-Unfried merged 3 commits into
tenpy:mainfrom
rpinho:fix-mpo-expectation-env

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Calling MPO.expectation_value with the environments from an extracted segment raises a TypeError. The same failure occurs when reusing the environments of an infinite MPS. Pass the environment dictionary to the finite or transfer-matrix method, and keep the segment fallback local to each call. The tests compare the segment energy and infinite energy density with their Ising-chain values.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

@rpinho
rpinho force-pushed the fix-mpo-expectation-env branch from 05505b4 to 72bb41a Compare November 19, 2026 06:05
@Jakob-Unfried

Copy link
Copy Markdown
Member

Mostly good, contains some fixes we definitely want.
I am a bit hesitant about the behavior change, when to run TM vs power.
Will take the day to think about it.

@rpinho

rpinho commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! We would be glad to help in any way we can. What would be helpful for you? What's a hard problem?

@Jakob-Unfried
Jakob-Unfried merged commit cbf6616 into tenpy:main Nov 20, 2026
10 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.

2 participants