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

Specify eltype for CU1Irrep product iterator #115

Merged
merged 3 commits into from
Apr 8, 2024
Merged

Specify eltype for CU1Irrep product iterator #115

merged 3 commits into from
Apr 8, 2024

Conversation

lkdvos
Copy link
Collaborator

@lkdvos lkdvos commented Apr 7, 2024

I am not sure if this actually has some performance implications in the code, but at the very least it changes the following:
Before:

julia> collect(CU1Irrep(0)  CU1Irrep(1))
1-element Vector{Any}:
 Irrep[CU₁](1, 2)

After:

julia> collect(CU1Irrep(0)  CU1Irrep(1))
1-element Vector{CU1Irrep}:
 (1, 2)

Copy link

codecov bot commented Apr 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.40%. Comparing base (fe3c9c2) to head (dc1d33c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #115      +/-   ##
==========================================
+ Coverage   81.29%   81.40%   +0.11%     
==========================================
  Files          42       42              
  Lines        5575     5576       +1     
==========================================
+ Hits         4532     4539       +7     
+ Misses       1043     1037       -6     

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

@Jutho
Copy link
Owner

Jutho commented Apr 7, 2024

Maybe there can be some extra tests in test/sectors.jl:
e.g. below line 21

@test eltype(it) == I
@constinferred collect(it)

@lkdvos
Copy link
Collaborator Author

lkdvos commented Apr 8, 2024

I was looking for something to test, but collect(it) does not actually help, the inferred type is Vector{Any} and this is what it returns, so no error is raised. Similarly I got stuck with trying to test iterate(it), this is also correctly inferred, it is just the iterator interface of julia Base that is a bit strange, as it defaults eltype to Any.
Testing the eltype directly is definitely better, I really should have thought of that 😁

@Jutho
Copy link
Owner

Jutho commented Apr 8, 2024

Maybe typeof(collect(it)) == Vector{I} as extra test?

@lkdvos lkdvos force-pushed the eltype branch 3 times, most recently from 4c688f0 to dc1d33c Compare April 8, 2024 15:07
@Jutho
Copy link
Owner

Jutho commented Apr 8, 2024

Looks great; thanks. I'll merge when the tests are complete.

@Jutho Jutho merged commit e72b722 into master Apr 8, 2024
14 checks passed
@lkdvos lkdvos deleted the eltype branch April 9, 2024 06:00
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