Skip to content

More efficient wicks implementation#6

Merged
LinusBDittmer merged 6 commits intomasterfrom
wicks
Jul 6, 2025
Merged

More efficient wicks implementation#6
LinusBDittmer merged 6 commits intomasterfrom
wicks

Conversation

@jonasleitner
Copy link
Copy Markdown
Owner

... by efficiently caching contraction results.

Copy link
Copy Markdown
Collaborator

@LinusBDittmer LinusBDittmer left a comment

Choose a reason for hiding this comment

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

Some more comments in _contract_operator_string would be nice, functionality and implementation is good.

Comment thread adcgen/wicks.py
flattened_idx = (
2 * left_pos * n_total_operators - left_pos * left_pos
+ 2 * right_pos - 3 * left_pos - 2
) // 2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perhaps we could add a comment on how the formula for flattened_idx works, similar to the docstring explaining how the n_total_operators calculation works?
E.g:
The flattened_idx is calculated by considering the total number of elements in an upper triangular matrix and the number of elements in the triangle formed by the remaining rows.

Copy link
Copy Markdown
Owner Author

@jonasleitner jonasleitner Jul 6, 2025

Choose a reason for hiding this comment

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

Good idea. I updated the comments

@LinusBDittmer
Copy link
Copy Markdown
Collaborator

LGTM 👍

@LinusBDittmer LinusBDittmer merged commit df422db into master Jul 6, 2025
2 checks passed
@LinusBDittmer LinusBDittmer deleted the wicks branch July 6, 2025 18:18
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