Skip to content

CartesianIndex constructor for BandIndex #1304

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

Merged
merged 4 commits into from
Apr 27, 2025
Merged

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Apr 23, 2025

This allows easier conversion from a BandIndex to a CartesianIndex by using the CartesianIndex constructor. It also skips the intermediate conversion in to_indices where we need the (row, column) tuple directly.

After this, the following is possible:

julia> b = LinearAlgebra.BandIndex(0, 2)
BandIndex(0, 2)

julia> c = CartesianIndex(b)
CartesianIndex(2, 2)

julia> LinearAlgebra.BandIndex(c)
BandIndex(0, 2)

I had not added the constructor earlier to avoid potential invalidations, but I don't think this is a factor, given that Base already defines four methods for CartesianIndex.

@jishnub jishnub force-pushed the jishnub/cartinds_bandindex branch from 5a92b0d to 0509acb Compare April 26, 2025 05:45
Copy link

codecov bot commented Apr 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.74%. Comparing base (e7a8a15) to head (0509acb).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1304   +/-   ##
=======================================
  Coverage   93.73%   93.74%           
=======================================
  Files          34       34           
  Lines       15682    15689    +7     
=======================================
+ Hits        14699    14707    +8     
+ Misses        983      982    -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

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

SGTM

@jishnub jishnub merged commit 8695b51 into master Apr 27, 2025
4 checks passed
@jishnub jishnub deleted the jishnub/cartinds_bandindex branch April 27, 2025 17: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