Skip to content

Conversation

@devmotion
Copy link
Member

Implements Base.broadcastable for PDMat and PDiagMat by falling back to the wrapped matrix and a Diagonal object, respectively. Many generic fallbacks use broadcasting, and by falling back on the underlying better supported AbstractMatrix objects we reduce the number of surprising and undesired results in broadcasting operations but also e.g. subtraction (see #195 (comment)).

One could similarly define Base.broadcastable(a::ScalMat) = Base.broadcastable(Diagonal(fill(a.value, a.dim))) but this leads to undesired results when working with e.g. static arrays (and causes undesired allocations which could maybe be fixed by working with FillArrays.Fill - but only recently we noticed that a dependency on FillArrays would increase loading time significantly: #192).

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e0cad7c) 91.45% compared to head (0d7f2bd) 91.48%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #197      +/-   ##
==========================================
+ Coverage   91.45%   91.48%   +0.02%     
==========================================
  Files           9        9              
  Lines         679      681       +2     
==========================================
+ Hits          621      623       +2     
  Misses         58       58              

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

@devmotion devmotion merged commit cd28425 into master Nov 22, 2023
@devmotion devmotion deleted the dw/broadcastable branch November 22, 2023 11:35
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.

4 participants