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 reshape for OneElement when indices lie outside axes #378

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Aug 21, 2024

Fixes issues like

julia> A = OneElement(4, 3)
3-element OneElement{Int64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}}:
 
 
 

julia> reshape(A, 1, 3)
ERROR: BoundsError: attempt to access 3-element LinearIndices{1, Tuple{Base.OneTo{Int64}}} at index [4]

After this,

julia> reshape(A, 1, 3)
1×3 OneElement{Int64, 2, Tuple{Int64, Int64}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}:
     

The index of the non-zero element is arbitrarily chosen to lie beyond the range of the Cartesian indices.

@jishnub jishnub added the bugfix label Aug 21, 2024
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.91%. Comparing base (9868632) to head (1ad13a5).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #378   +/-   ##
=======================================
  Coverage   99.90%   99.91%           
=======================================
  Files           8        8           
  Lines        1110     1112    +2     
=======================================
+ Hits         1109     1111    +2     
  Misses          1        1           

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

@jishnub jishnub requested a review from dlfivefifty August 22, 2024 06:48
@jishnub
Copy link
Member Author

jishnub commented Aug 24, 2024

Gentle bump. There are a few bugfix PRs (labelled as such) that may probably be merged soon.

@dlfivefifty dlfivefifty merged commit 554ddf4 into master Aug 27, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants