Skip to content

Broadcast operations for arbitrary styles #408

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Mar 12, 2025

In many broadcast operations that take an AbstractFill and produce another AbstractFill, the result should hold irrespective of the broadcast style involved. We may therefore specialize broadcast(op, F::AbstractFill) without caring about the BroadcastStyle of F.

E.g.:

julia> E = Eye(∞)
ℵ₀×ℵ₀ LinearAlgebra.Diagonal{Float64, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf()×OneToInf()

julia> E^2
ℵ₀×ℵ₀ LinearAlgebra.Diagonal{Float64, Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf()×OneToInf()

This is a result that should hold irrespective of what the broadcast style of the diagonal is. Currently,

julia> Broadcast.BroadcastStyle(typeof(E))
LazyArrays.LazyArrayStyle{2}()

julia> Broadcast.BroadcastStyle(typeof(E.diag))
Base.Broadcast.DefaultArrayStyle{1}()

but if the style of E.diag is also changed to a LazyArrayStyle, the result of E^2 should remain unchanged.

Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.04%. Comparing base (877375f) to head (c2deb57).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #408      +/-   ##
==========================================
- Coverage   99.48%   99.04%   -0.44%     
==========================================
  Files           8        8              
  Lines        1157     1157              
==========================================
- Hits         1151     1146       -5     
- Misses          6       11       +5     

☔ 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.

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.

1 participant