Add embed_lazy API#524
Open
arnavk23 wants to merge 4 commits into
Open
Conversation
…th a direct time-fixed comparison against H itself — which is correct since on a non-composite basis embed_lazy should return the operator unchanged.
Contributor
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
Author
|
@Krastanov was going through the unitaryHACK event and also worked on this. Do check it out whenever you are free. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #523.
Motivation
The existing
embedfunction materialises the full tensor-product operator into a dense or sparse matrix immediately. When building Hamiltonians over large composite Hilbert spaces, this forces an unnecessary and often expensive materialisation before the operator is ever applied to a state.embed_lazysolves this by keeping the embedded operator in lazy form, deferring all matrix construction until the caller explicitly callsdenseorsparse.Tests
test/test_timeevolution_tdops.jl- testsembed_lazyin the context ofTimeDependentSum, which has noembedmethod, confirming the fix for the original issue.test/test_steadystate.jl- confirmingembed_lazyon a non-composite basis returns the operator unchanged.Comparison with
embedembedembed_lazyDenseOperator/SparseOperatorLazyTensor/LazySumTimeDependentSum