Skip to content

Conversation

@mtfishman
Copy link
Member

Rewrite broadcasting and mapping to make it simpler and more general. The strategy is to rewrite broadcasting expressions involving KroneckerArrays in terms of an internal Broadcasted-like lazy type called Sum which represents a linear combination of objects (normally arrays but they could themselves be broadcast expressions) with corresponding scalar coefficients.

The idea is that because we want to preserve the KroneckerArray structure, as we construct the broadcast expression we catch operations that are linear and build a Sum expression for that linear expression. Then, we can make use of that linear structure when materializing the broadcast expression.

This also flips the implementation around and implements map in terms of broadcast, which simplifies things a lot.

@codecov
Copy link

codecov bot commented Jun 21, 2025

Codecov Report

Attention: Patch coverage is 73.65591% with 49 lines in your changes missing coverage. Please review.

Project coverage is 79.85%. Comparing base (0b5388f) to head (36f1875).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/linearcombination.jl 58.06% 26 Missing ⚠️
src/kroneckerarray.jl 76.04% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   78.05%   79.85%   +1.80%     
==========================================
  Files          10       11       +1     
  Lines         679      695      +16     
==========================================
+ Hits          530      555      +25     
+ Misses        149      140       -9     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

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.

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

@mtfishman mtfishman merged commit 1cd2ce3 into main Jun 21, 2025
13 of 14 checks passed
@mtfishman mtfishman deleted the mf/simplify_broadcast branch June 21, 2025 20:12
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