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

Fix keytype and zero #574 #575

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix keytype and zero #574 #575

wants to merge 1 commit into from

Conversation

dpinol
Copy link
Contributor

@dpinol dpinol commented Oct 25, 2024

Fixes #574

@fredrikekre
Copy link
Member

keytype isn't the type of the stored indices though, it should match eltype(keys(...)):

julia> v = spzeros(Int, Int32, 10)
10-element SparseVector{Int64, Int32} with 0 stored entries

julia> eltype(keys(v))
Int64

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.00%. Comparing base (485fd4b) to head (8c6a370).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #575      +/-   ##
==========================================
- Coverage   84.14%   84.00%   -0.15%     
==========================================
  Files          12       12              
  Lines        9160     9161       +1     
==========================================
- Hits         7708     7696      -12     
- Misses       1452     1465      +13     

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

@dpinol
Copy link
Contributor Author

dpinol commented Oct 25, 2024

keytype isn't the type of the stored indices though, it should match eltype(keys(...)):

Should I also adapt keys then, for consistency with eachindex & length?

help?> keys
search: keys keytype KeyError haskey getkey UndefKeywordError WeakKeyDict

  keys(a::AbstractArray)
Return an efficient array describing all valid indices....

@fredrikekre
Copy link
Member

No, I think keys is correct, and thus think that keytype should always be Int.

@dpinol
Copy link
Contributor Author

dpinol commented Oct 25, 2024

No, I think keys is correct, and thus think that keytype should always be Int.

why?

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.

zero & keytype always return Int64 for the index type
2 participants