Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Add support for expanding singleton dimensions #6

Merged
merged 4 commits into from
Jan 5, 2025
Merged

Conversation

mtfishman
Copy link
Member

Broadcasting in Julia supports expanding singleton dimensions to match a common size. Before this PR, when converting broadcasting expressions like:

julia> fill(1, 2, 2) .+ [1, 2]
2×2 Matrix{Int64}:
 2  2
 3  3

to map expressions, we didn't handle repeating over the singleton dimensions properly. This PR fixes that by creating map expressions that lazily repeat the smaller arrays using a combination of FillArrays.Fill and BlockArrays.BlockArray.

This PR also refactors some of the internals to hopefully make the logic a little clearer.

Copy link

codecov bot commented Jan 5, 2025

Codecov Report

Attention: Patch coverage is 96.34146% with 3 lines in your changes missing coverage. Please review.

Project coverage is 95.83%. Comparing base (3e63462) to head (c115549).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/BroadcastMapConversion.jl 96.34% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #6      +/-   ##
==========================================
+ Coverage   88.37%   95.83%   +7.46%     
==========================================
  Files           1        1              
  Lines          43       96      +53     
==========================================
+ Hits           38       92      +54     
+ Misses          5        4       -1     
Flag Coverage Δ
docs 75.00% <71.95%> (-13.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@mtfishman mtfishman merged commit 7eb11cf into main Jan 5, 2025
12 checks passed
@mtfishman mtfishman deleted the simplify branch January 5, 2025 21:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant