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

add 🐬 functionality #189

Merged
merged 2 commits into from
Dec 17, 2024
Merged

add 🐬 functionality #189

merged 2 commits into from
Dec 17, 2024

Conversation

Jutho
Copy link
Owner

@Jutho Jutho commented Dec 13, 2024

Flipping tensor indices, for @Adwait-Naravane and @VictorVanthilt .

Be careful with fermions, as shown in the tests, simply flipping both of a pair of contracted indices does not yield the same contraction when fermions are involved.

@Jutho Jutho requested a review from lkdvos December 13, 2024 15:14
@Jutho
Copy link
Owner Author

Jutho commented Dec 13, 2024

Ok this is not correct yet. I will have to investigate further.

Copy link
Collaborator

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

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

Definitely like the ability to have this!

Just as a sidenote, I'm fine if this is not possible or we don't have the time for this yet:
Do you know if there is any way to make this consistently work with fermions? For example, what happens if we define flip to be:

  • i in codomain and !isdual -> flip
  • i in codomain and isdual -> flip + twist
  • i in domain and !isdual -> flip + twist
  • i in domain and isdual -> flip
    I think In some sense, what I am thinking of is that contract would basically become equivalent to flipping all contracted indices to be <bra|ket> instead of the other way around, and then contracting. I'm just not entirely sure if this is consistent, as in that it commutes with arbitrary permutations + contractions

Also +1 on the PR title

end
return t
end
flip(t::TensorMap, I) = TensorMap(t.data, flip(space(t), I))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think here it's probably best to also include a copy keyword, similar to permute, which can be used to control the sharing of data. At least, it's good to have this in the docstring somewhere

@Jutho
Copy link
Owner Author

Jutho commented Dec 16, 2024

Ok, this turned out slightly more complicated as anticipated, because of Frobenius Schur factors. However, I think the implementation is now fixed, and includes the suggestion of @lkdvos to also include twists. I think this guarantees that if both spaces in a pair of @tensor contracted indices are flipped, then the contraction is unaltered, irrespective of whether either of the indices live in the domain or codomain. This might fail in an @planar context however.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.16%. Comparing base (9f553b0) to head (1056afd).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #189      +/-   ##
==========================================
+ Coverage   82.95%   83.16%   +0.20%     
==========================================
  Files          42       42              
  Lines        5223     5257      +34     
==========================================
+ Hits         4333     4372      +39     
+ Misses        890      885       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jutho Jutho merged commit c041bfe into master Dec 17, 2024
14 checks passed
@Jutho Jutho deleted the jh/fliptensormapindices branch December 17, 2024 13:43
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