Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hilbert_space] Simplify algorithm of space_partition::merge_subspaces() #961

Open
wants to merge 1 commit into
base: 3.3.x
Choose a base branch
from

Conversation

krivenko
Copy link
Contributor

The current implementation of space_partition::merge_subspaces() uses recursion, std::function and repeatedly deletes elements from a std::multimap, which results in a significat runtime overhead.

More concerningly, I experienced a stack oveflow caused by the recursion while trying to run the autopartition algorithm for a bigger system.

The new algorithm simply iterates over subspace connections $i\mapsto f$ generated by a single operator $c^\dagger/c$, and merges all subspaces $f$ corresponding to the same $i$.

…es()`

The new non-recursive algorithm is simpler, faster and safe from stack
overflows.
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.

1 participant